Function queries the CDEC site to obtain desired station data based on station, sensor number, duration code and start/end date. Use `cdec_datasets()` to view an updated list of all available data at a station.

cdec_query(
  station,
  sensor_num,
  dur_code,
  start_date = NULL,
  end_date = NULL,
  tzone = "America/Los_Angeles"
)

Arguments

station

three letter identification for CDEC location (example "KWK", "SAC", "CCR")

sensor_num

sensor number for the measure of interest. (example "20", "01", "25")

dur_code

duration code for measure interval, "E", "H", "D", which correspong to Event, Hourly and Daily.

start_date

date to start the query on.

end_date

an optional date to end query on, defaults to current date.

tzone

a time zone used. By default this is America/Los_Angeles, this accounts for daylight saving.

Value

data frame containing queried data from CDEC for a specific station, sensor, and date range

Examples

if (FALSE) {
kwk_hourly_flows <- CDECRetrieve::cdec_query("KWK", "20", "H", "2017-01-01")
ccr_hourly_temps <- CDECRetrieve::cdec_query("CCR", "25", "H", Sys.Date())
}