ch_tidyhydat_ECDE_meta {CSHShydRology} | R Documentation |
Extracts tombstone (meta) data for stations from tidyhydat in a format similar to that used by the Environment Canada Data Explorer (ECDE). The default does not capture all the fields in ECDE, which includes the most recent status of many fields such as operating schedule. Returning these values slows the function, particularly when all WSC stations are selected.
ch_tidyhydat_ECDE_meta(stations, all_ECDE = FALSE)
stations |
A vector of WSC station IDs, i.e. |
all_ECDE |
Should all ECDE values be returned? If |
Returns a list with three items:
meta
- a dataframe of metadata from tidyhydat in ECDE form (not all ECDE fields are reproduced in this summary)
H_version
- version information, and
th_meta
- a dataframe with all tidyhdat fields including:
Station - StationID
StationName - Station Name
HYDStatus - Active or Discontinued
Prov - Province
Latitude
Longitude
DrainageArea - km^2
Years - number of years with data
From - Start Year
To - End Year
Reg. - Regulated?
Flow - not captured (differs from ECDE), unless all_ECDE = TRUE
Level - not captured (differs from ECDE), unless all_ECDE = TRUE
Sed - not captured (differs from ECDE), unless all_ECDE = TRUE
OperSched - not captured (differs from ECDE), unless all_ECDE = TRUE
RealTime - if TRUE/Yes
RHBN - if TRUE/Yes is in the reference hydrologic basin network
Region - number of region instead of name (differs from ECDE), unless all_ECDE = TRUE
Datum - reference number (differs from ECDE), unless all_ECDE = TRUE
Operator - reference number (differs from ECDE), unless all_ECDE = TRUE
Paul Whitfield, Kevin Shook
ch_get_ECDE_metadata
ch_tidyhydat_ECDE
# This example uses the built-in test database, by setting the hydat_path parameter
# You will want to use it with your actual HYDAT database
library(tidyhydat)
# check for existence of test database
test_db <- hy_test_db()
if (file.exists(test_db)) {
stations <- c("05AA008", "08MF005", "05HD008")
hy_set_default_db(test_db)
result <- ch_tidyhydat_ECDE_meta(stations)
metadata <- result[[1]]
version <- result[[2]]
hy_set_default_db(NULL) # Reset HYDAT database
}
## Not run:
# This example is not run, as it will take several hours to execute and will
# return many warnings for stations having no data. Note that it is using the actual
# HYDAT database, which must have been installed previously
# This use of the function is intended for the package maintainers to
# update the HYDAT_list data frame
result <- ch_tidyhydat_ECDE_meta("all", TRUE)
HYDAT_list <- result$meta
## End(Not run)