CIMISweather: Get data from CIMIS API

Description Usage Arguments Details Value Author(s) Examples

Description

This allows the R user to send a general query to the CIMIS API to get various data from the API.

Usage

1
2
3
CIMISweather(startDate, endDate, targets, unitOfMeasure = "M",
  dataItems = character(), prioritizeSCS = NA, ..., includeQC = FALSE,
  appKey = getOption("Rcimis_key", stop("You need a key.")), .opts = list())

Arguments

startDate

The start date, in ISO format (e.g. "YYYY-MM-DD"). Cannot be earlier than 1987-06-7

endDate

The end date in ISO format

targets

The CIMIS assigned station number, zip code, address, or Lat/Long (comma separated). See StnInfo dataset for list of stations.

unitOfMeasure

"M" for metric units, "E" for empirical

dataItems

optional. If not provided, function will return all variables

prioritizeSCS

Should results from Spatial CIMIS (interpolated) be prioritized?

...

Additional arguments passed to the CIMIS API.

includeQC

Should columns with quality control flags be included in results?

appKey

The API key. By default, the function checks getOptions for the api as "Rcimis_key". This avoids exposing this private, secure information in scripts and console.

.opts

options passed to getForm to control the RCurl HTTP request.

Details

This is a general function to get data from the CIMIS API that takes arbitrary API parameters.

Value

a data frame, JSON object, or XML object, depending on options passed to getCIMIS

Author(s)

Matt Espe and Duncan Temple Lang

Examples

1
2
3
4
5
#Get the station number for the Davis, CA station

#Davis is station #6, and data starts 1982-07-17
if(!is.null(getOption("Rcimis_key")))
    ans = CIMISweather(startDate = "1987-07-17", endDate = Sys.Date(), targets = 6)

mespe/Rcimis documentation built on May 22, 2019, 6:53 p.m.