ch_tidyhydat_ECDE_meta: Creates an ECDE-like dataframe of metadata from 'tidyhydat'

View source: R/ch_tidyhydat_ECDE_meta.R

ch_tidyhydat_ECDE_metaR Documentation

Creates an ECDE-like dataframe of metadata from tidyhydat

Description

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.

Usage

ch_tidyhydat_ECDE_meta(stations, all_ECDE = FALSE)

Arguments

stations

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.

all_ECDE

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.

Value

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

Author(s)

Paul Whitfield, Kevin Shook

See Also

ch_get_ECDE_metadata ch_tidyhydat_ECDE

Examples


# This example requires \pkg{tidyhydat} to be installed
# the \code{HYDAT} database, which makes automatic checking slow
stations <- c("05BB001", "05BB003", "05BB004", "05BB005")
result <- ch_tidyhydat_ECDE_meta(stations)
metadata <- result[[1]]
version <- result[[2]]


# This example is not run, as it can take over an hour to execute
# It is intended to be used by the package maintainers to update \code{HYDAT_list}
result <- ch_tidyhydat_ECDE_meta("all", TRUE)
HYDAT_list <- result$meta



CSHS-hydRology/CSHShydRology documentation built on Aug. 18, 2022, 4:44 p.m.