query_available_data: View sites, dates, and variables available in the StreamPULSE...

View source: R/query_available_data.R

query_available_dataR Documentation

View sites, dates, and variables available in the StreamPULSE database

Description

Uses StreamPULSE API to query data via MySQL. To download data, see request_data.

Usage

query_available_data(
  region = NULL,
  site = NULL,
  startdate = NULL,
  enddate = NULL,
  variable = NULL
)

Arguments

region

string representing region. Must be a StreamPULSE region abbreviation like 'NC' or 'AZ'. Set this argument to 'all' for a list of all available region and site abbreviations.

site

string representing site. Must be a StreamPULSE site abbreviation like 'Eno' or 'LV'.

startdate

date string formatted 'YYYY-MM-DD'. Must be specified if enddate is. Only records fully encompassing the range defined by startdate and enddate will be returned. See details for a caveat.

enddate

date string formatted 'YYYY-MM-DD'. Must be specified if enddate is. Only records fully encompassing the range defined by startdate and enddate will be returned. See details for a caveat.

variable

string representing a StreamPULSE variable name, such as 'DO_mgL'. Set this argument to 'all' for a list of all variable names.

Details

Only records fully encompassing the range defined by startdate and enddate will be returned UNLESS variable is also specified. In that case, any sites for which that variable has been measured at any point during the specified date range will be returned.

The data returned by this function depend on which of the input parameters are specified and which are omitted. See examples for all possible ways to use this function.

Value

returns a list containing one or more data frames containing site, variable, or time data. Which of these data frames is/are returned depends on which of the input parameters are specified. See examples

Author(s)

Mike Vlah, vlahm13@gmail.com

See Also

request_data for downloading StreamPULSE data.

Examples

#View all sites in region
query_available_data(region='AZ')

#View all sites in all regions
query_available_data(region='all')

#View all variables at site and available time range for site
query_available_data(region='AZ', site='LV')

#View all sites at which variable has been sampled
query_available_data(variable='Depth_m')

#View full list of variables
query_available_data(variable='all')

#View all sites for which temporal coverage encompasses the specified dates
query_available_data(startdate='2016-06-13', enddate='2017-11-01')

#View all variables available at site, encompassing date range
query_available_data(region='NC', site='Eno', startdate='2017-01-08',
    enddate='2017-04-09')

#View date range available for variable at site
query_available_data(region='NC', site='Eno', variable='WaterTemp_C')

#View all sites at which variable has been sampled within date range.
#This one takes a while to run.
query_available_data(startdate='2017-01-08', enddate='2017-04-09',
    variable='DO_mgL')

streampulse/StreamPULSE documentation built on Nov. 2, 2024, 9:54 p.m.