request_data: Retrieve data from the StreamPULSE database

View source: R/request_data.R

request_dataR Documentation

Retrieve data from the StreamPULSE database

Description

Uses StreamPULSE API to query data via MySQL. Visit the data portal at https://data.streampulse.org to download data via a browser.

Usage

request_data(
  sitecode,
  startdate = NULL,
  enddate = NULL,
  variables = NULL,
  token = NULL
)

Arguments

sitecode

underscore-separated region and site code, e.g. 'NC_Eno'. Full list of regions and site codes available at https://data.streampulse.org/sitelist. Or, you can use the query_available_data function in this package.

startdate

date string formatted 'YYYY-MM-DD', representing the first day of data to be requested. If data coverage does not extend this far back in time, the argument will be adjusted to the first day with available data. Omit this argument to include all records up to the first available. To see the range of available dates for a particular site, use the query_available_data function in this package.

enddate

date string formatted 'YYYY-MM-DD', representing the last day of data to be requested. If data coverage does not extend this far in time, the argument will be adjusted to the last day with available data. Omit this argument to include all records up to the last available. To see the range of available dates for a particular site, use the query_available_data function in this package.

variables

character vector of variable names to request. To see which variables are available for a given site, use the query_available_data function in this package. Omit this argument to request all variables potentially useful for metabolism modeling: c('DO_mgL','DOsat_pct','satDO_mgL','WaterPres_kPa', 'Depth_m','WaterTemp_C','Light_PAR','AirPres_kPa','Discharge_m3s').

token

a unique alphanumeric string for each registered user of StreamPULSE. Only necessary for accessing embargoed data.

Details

Request data for a single region and site within the StreamPULSE database. All sites are embargoed for 1 year or more from the time they first appear in the database. Embargoed data are only available to the user who submits them, and can be accessed via a unique token.

Value

returns a list containing two data.frames. The first contains all requested data. The second contains site metadata. Variable names and corresponding values are stacked in two long columns. Use prep_metabolism to format the output of this function.

Author(s)

Mike Vlah, vlahm13@gmail.com

Aaron Berdanier

See Also

prep_metabolism for organizing data returned by this function.

Examples

query_available_data(region='all')

streampulse_data = request_data(sitecode='NC_Eno',
    startdate='2016-06-10', enddate='2016-10-23')

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