rnoaa (version 0.2.0)

ncdc_datasets: Search NOAA datasets

Description

From the NOAA API docs: All of our data are in datasets. To retrieve any data from us, you must know what dataset it is in.

Usage

ncdc_datasets(datasetid = NULL, datatypeid = NULL, stationid = NULL,
  locationid = NULL, startdate = NULL, enddate = NULL, sortfield = NULL,
  sortorder = NULL, limit = 25, offset = NULL, callopts = list(),
  token = NULL, dataset = NULL, page = NULL, year = NULL,
  month = NULL)

Arguments

datatypeid
Accepts a valid data type id or a chain of data type ids in a comma-separated vector. Data returned will contain all of the data type(s) specified (optional)
locationid
Accepts a valid location id or a chain of location ids in a comma-separated vector. Data returned will contain data for the location(s) specified (optional)
stationid
Accepts a valid station id or a chain of of station ids in a comma-separated vector. Data returned will contain data for the station(s) specified (optional)
sortfield
The field to sort results by. Supports id, name, mindate, maxdate, and datacoverage fields (optional)
sortorder
Which order to sort by, asc or desc. Defaults to asc (optional)
limit
Defaults to 25, limits the number of results in the response. Maximum is 1000 (optional)
offset
Defaults to 0, used to offset the resultlist (optional)
token
This must be a valid token token supplied to you by NCDC's Climate Data Online access token generator. (required) Get an API key (=token) at http://www.ncdc.noaa.gov/cdo-web/token. You can pass your token in as an argument or store it in your .Rprofile file with an entry like
  • options("noaakey" = "your-noaa-token")
callopts
Further arguments passed on to the API GET call. (optional)
datasetid
(optional) Accepts a single valid dataset id. Data returned will be from the dataset specified, see datasets()
startdate
(optional) Accepts valid ISO formated date (yyyy-mm-dd) or date time (YYYY-MM-DDThh:mm:ss). Data returned will have data after the specified date. The date range must be less than 1 year.
enddate
(optional) Accepts valid ISO formated date (yyyy-mm-dd) or date time (YYYY-MM-DDThh:mm:ss). Data returned will have data before the specified date. The date range must be less than 1 year.
dataset
THIS IS A DEPRECATED ARGUMENT. See datasetid.
page
THIS IS A DEPRECATED ARGUMENT. There is no equivalent argument in v2 of the NOAA API.
year
THIS IS A DEPRECATED ARGUMENT. Use combination of startdate and enddate arguments.
month
THIS IS A DEPRECATED ARGUMENT. Use combination of startdate and enddate arguments.

Value

A data.frame for all datasets, or a list of length two, each with a data.frame.

Examples

Run this code
## Not run: ------------------------------------
# # Get a table of all datasets
# ncdc_datasets()
# 
# # Get details from a particular dataset
# ncdc_datasets(datasetid='ANNUAL')
# 
# # Get datasets with Temperature at the time of observation (TOBS) data type
# ncdc_datasets(datatypeid='TOBS')
# 
# # Get datasets with data for a series of the same parameter arg, in this case
# # stationid's
# ncdc_datasets(stationid=c('COOP:310090','COOP:310184','COOP:310212'))
# 
# # Multiple datatypeid's
# ncdc_datasets(datatypeid=c('ACMC','ACMH','ACSC'))
# ncdc_datasets(datasetid='ANNUAL', datatypeid=c('ACMC','ACMH','ACSC'))
## ---------------------------------------------

Run the code above in your browser using DataCamp Workspace