queryEnvCovAPI: Query the Environmental Covariate API

View source: R/queryEnvCovAPI.R

queryEnvCovAPIR Documentation

Query the Environmental Covariate API

Description

Query the Environmental Covariate API for data between two dates.

Usage

queryEnvCovAPI(min.date, max.date, oursitevar, type = "D")

Arguments

min.date

The start date for data to include. This is a text string in the format %Y-%m-%d, or YYYY-MM-DD. Queries on the Unit table tblu assume a start time of midnight on the day specified.

max.date

The end date for data to include. Same format as min.date. Queries on the Unit table tblu assume an end time of midnight on the day specified.

oursitevar

An integer indicating the site identifier. These identifiers must be the custom ones designed specifically for the Environmental Covariate Database.

type

A text string indicating if either Daily "D" or Unit "U" values should be queried. At present, only "D" is implemented.

Details

For a given time interval (e.g., day or hour), a site may have more than one statistic recorded. Statistics are mean, median, max, or min over the time point. The statistic returned by this routine for time intervals with multiple statistics is determined by the following rules, applied in order of precedence:

  1. median is selected before the mean

  2. mean is selected before the max or min

  3. if max AND min are available (but neither median or mean), an average of min and max is returned

  4. if only one of max or min is available, it is returned.

Value

A data frame of the query results, with a fields for both flow and temperature values, what statistics are returned, and date or time interval. The returned data frame has the following fields:

  • date = date of the measurement in POSIXct format.

  • flow_statistic = an integer specifying the type of statistic returned for flow (1 = maximum; 2 = minimum; 3 = mean; 8 = median).

  • flow_statistic_name = the name of the flow statistic. "Maximum", "Minimum", "Mean", "Median" as specified by flow_statistic. flow_statistic_name and flow_statistic are redundant, the former is included for convenience.

  • flow_cfs = the value of flow statistic in cubic feet per second.

  • temp_statistic = an integer specifying the type of statistic returned for flow (1 = maximum; 2 = minimum; 3 = mean; 8 = median).

  • temp_statistic_name = the name of the flow statistic. "Maximum", "Minimum", "Mean", "Median" as specified by temp_statistic. temp_statistic_name and temp_statistic are redundant, the former is included for convenience.

  • temp_cfs = the value of flow statistic in cubic feet per second.

Author(s)

Trent McDonald and Jason Mitchell

See Also

plot2Panel

Examples

## Not run: 
#   ---- Query for daily results.  
tmp <- queryEnvCovAPI(min.date = "2000-01-01",
              max.date = "2010-12-31",
              oursitevar = 11,
              type = "D")

## End(Not run)


tmcd82070/CAMP_RST documentation built on April 6, 2022, 12:07 a.m.