Skip to contents

Make a request to the api/v2/structures/divrec/stagevolume/ endpoint to retrieve structure stage/volume data for WDID(s) within a specified date range.

Usage

get_structure_stage_ts(
  wdid = NULL,
  start_date = "1900-01-01",
  end_date = Sys.Date(),
  api_key = NULL
)

Arguments

wdid

character vector or list of WDID codes

start_date

character date to request data start point YYYY-MM-DD. Default is start date is "1900-01-01".

end_date

character date to request data end point YYYY-MM-DD. Default end date is the current date the function is run.

api_key

character, optional. If more than maximum number of requests per day is desired, an API key can be obtained from CDSS.

Value

dataframe with stage/volume data for CDSS structure(s) of interest

Examples

if (FALSE) {
# Request endpoint: api/v2/structures/divrec/stagevolume
stage_vol <- get_structure_stage_ts(
                   wdid             = "0303732",
                   start_date       = "2000-01-01",
                   end_date         = "2005-01-01"
                 )

# plot stage
plot(stage_vol$stage~stage_vol$datetime, type = "s")

# plot volume
plot(stage_vol$volume~stage_vol$datetime, type = "s")

# get stage/volume data for multiple WDIDs
multi_wdids <- get_structure_stage_ts(
               wdid          = c("0504010", "0504020", "0504021"),
               start_date    = "2021-06-01",
               end_date      = "2021-08-01"
               )
}