if (FALSE) {
# Just passing the datasetid without fields gives all columns back
tabledap('erdCinpKfmBT')
# Pass time constraints
tabledap('erdCinpKfmBT', 'time>=2006-08-24')
# Pass in fields (i.e., columns to retrieve) & time constraints
tabledap('erdCinpKfmBT',
fields = c('longitude', 'latitude', 'Aplysia_californica_Mean_Density'),
'time>=2006-08-24'
)
# Get info on a datasetid, then get data given information learned
info('erdCalCOFIlrvsiz')$variables
tabledap('erdCalCOFIlrvsiz', fields=c('latitude','longitude','larvae_size',
'itis_tsn'), 'time>=2011-10-25', 'time<=2011-10-31')
# An example workflow
## Search for data
(out <- ed_search(query='fish', which = 'table'))
## Using a datasetid, search for information on a datasetid
id <- out$alldata[[1]]$dataset_id
vars <- info(id)$variables
## Get data from the dataset
vars$variable_name[1:3]
tabledap(id, fields = vars$variable_name[1:3])
# Time constraint
## Limit by time with date only
(info <- info('erdCinpKfmBT'))
tabledap(info, fields = c(
'latitude','longitude','Haliotis_fulgens_Mean_Density'),
'time>=2001-07-14')
# Use distinct parameter - compare to distinct = FALSE
tabledap('sg114_3',
fields=c('longitude','latitude','trajectory'),
'time>=2008-12-05', distinct = TRUE)
# Use units parameter
## In this example, values are the same, but sometimes they can be different
## given the units value passed
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', units='udunits')
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', units='ucum')
# Use orderby parameter
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', orderby='temperature')
# Use orderbymax parameter
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', orderbymax='temperature')
# Use orderbymin parameter
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', orderbymin='temperature')
# Use orderbyminmax parameter
tabledap('erdCinpKfmT', fields=c('longitude','latitude','time','temperature'),
'time>=2007-09-19', 'time<=2007-09-21', orderbyminmax='temperature')
# Use orderbymin parameter with multiple values
tabledap('erdCinpKfmT',
fields=c('longitude','latitude','time','depth','temperature'),
'time>=2007-06-10', 'time<=2007-09-21',
orderbymax=c('depth','temperature')
)
# Integrate with taxize
out <- tabledap('erdCalCOFIlrvcntHBtoHI',
fields = c('latitude','longitude','scientific_name','itis_tsn'),
'time>=2007-06-10', 'time<=2007-09-21'
)
tsns <- unique(out$itis_tsn[1:100])
library("taxize")
classif <- classification(tsns, db = "itis")
head(rbind(classif)); tail(rbind(classif))
# Write to memory (within R), or to disk
(out <- info('erdCinpKfmBT'))
## disk, by default (to prevent bogging down system w/ large datasets)
## the 2nd call is much faster as it's mostly just the time of reading
## in the table from disk
system.time( tabledap('erdCinpKfmBT', store = disk()) )
system.time( tabledap('erdCinpKfmBT', store = disk()) )
## memory
tabledap('erdCinpKfmBT', store = memory())
# use a different ERDDAP server
## NOAA IOOS NERACOOS
url <- "http://www.neracoos.org/erddap/"
tabledap("E01_optics_hist", url = url)
}
Run the code above in your browser using DataLab