Experimental, accepts single variable for now (one type of timeseries). Handles gauges and portals in different ways, which are not fully developed. Mostly a lot of translating between hydstra and kiwis to allow symmetric specification.
Usage
fetch_timeseries(
portal,
gauge,
start_time,
end_time,
variable,
units,
timeunit,
statistic,
datatype,
portal_type = "auto",
gauge_portal = "auto",
request_timezone = "db_default",
return_timezone = "UTC",
robustness = "robust",
check_output = TRUE
)
Arguments
- portal
URL to Kisters KiWIS database.
- gauge
character vector of gauge numbers, as
station_no
for Kiwis functions (site_list
for Hydstra)- start_time
character or date or date time for the start in database default timezone. Default NULL.
- end_time
character or date or date time for the end in database default timezone. Default NULL.
- variable
character vector of variables we want to extract. Matches on
parametertype_name
- units
units of the variable, used when there may be > 1 e.g. cumecs, ML/d for discharge. If NULL, gets all available. Matches to
ts_unitsymbol
- timeunit
The time interval to request, e.g. "Daily", the default. Main values seem to be 'Daily', 'Monthly', 'Yearly', and 'AsStored' (the raw data). Matches to part of
ts_name
- statistic
The aggregation statistic, e.g. "Mean", the default. Main values seem to be 'Mean', 'Max', 'Min', 'Total', though not all are available for each variable- rainfall tends to use Total, while discharge tends to use mean, max, min. Matches to part of
ts_name
- datatype
as in
fetch_kiwis_timeseries()
, or thedatasource
argument for hydstra, e.g.fetch_hydstra_timeseries()
- portal_type
I want to either be able to pass this a vector of length
portal
or 'auto'- gauge_portal
I want to either be able to pass this a named list of length
portal
or a tibble withportal
andgauge
columns, or 'auto' to do our best at auto-detecting.- request_timezone
ignored if start_time and end_time are time objects, otherwise a timezone from
OlsonNames()
or 'db_default'- return_timezone
character in
OlsonNames()
or one of three special cases:'db_default'
,'char'
or'raw'
. Default 'UTC'. If 'db_default', uses the API default. BOM defaults to +10. If'char'
or'raw'
, returns the time column as-is from the API (A string in the format'YYYY-MM-DDTHH:MM:SS+TZ'
)- robustness
experimental, always set to 'robust'. Intention to have another option to reduce API calls with more opportunity for error
- check_output
logical, default TRUE- inform if there are duplicated gauges across portals or missing gauges