ch_tidyhydat_ECDE_meta {CSHShydRology}R Documentation

Creates an ECDE-like dataframe of metadata from tidyhydat


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)



A vector of WSC station IDs, i.e. c("05BB001", "05BB003", "05BB004", "05BB005"). If stations = "all" then values are returned for all stations. Note that you should ensure that that the tidyhydat database is up to date, if you select stations = "all", so that the most recent set of stations is used.


Should all ECDE values be returned? If FALSE the default, then values of Flow, Level, Sed, OperSched, Region, Datum, and Operator are omitted or will differ from the ECDE values. If all_ECDE = TRUE, then the function will return values identical to ECDE. Note that setting all_ECDE = TRUE will result in very long execution times, as it is necessary to extract many daily values for each station to determine the values of Flow, Level, Sed, and OperSched to determine the final values.


Returns a list with three items:


Paul Whitfield, Kevin Shook

See Also

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
# check for existence of test database
test_db <- hy_test_db()
if (file.exists(test_db)) {
  stations <- c("05AA008", "08MF005", "05HD008")
  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)

[Package CSHShydRology version 1.4.0 Index]