ch_tidyhydat_ECDE {CSHShydRology} | R Documentation |
Accessing daily flow data using tidyhydat is quick and efficient. However, it sometimes conflicts with other functions as tidyhydat changes variable names and some default entries. This function converts a tibble obtained from a tidyhydat tibble to a dataframe with standard Environment and Climate Change Canada Data Explorer (ECDE) names.
ch_tidyhydat_ECDE(data)
data |
Tibble of daily flows retrieved using tidyhydat function |
A dataframe or a list of flows with formats consistent with datafiles read using ch_read_ECDE_flows
:
ID |
stationID |
PARAM |
Parameter 1 for Flow 2 for Level |
Date |
Original charater string converted to date format |
Flow |
Daily mean flow m |
SYM |
Quality flag |
Paul Whitfield
# 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)) {
hydat_path = hy_set_default_db(test_db)
mdata <- hy_daily_flows(station_number=c("05AA008"))
m_data <- ch_tidyhydat_ECDE(mdata)
mdata <- hy_daily_flows(station_number=c("05AA008", "08MF005", "05HD008"))
mnew <- ch_tidyhydat_ECDE(mdata)
str(mnew[[1]])
str(mnew[[2]])
str(mnew[[3]])
# note the order is in increasing alphabetical order
hy_set_default_db(NULL) # Reset HYDAT database
}