Skip to content
/ rtdd Public
forked from rywhale/rtdd

WSC DataMart files --> zrxp for WISKI ingest

Notifications You must be signed in to change notification settings

beatonan/rtdd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rtdd

Bring near real-time hydrometric data from the Government of Canada’s DataMart service into R.

Note that much of this funcionality is built into tidyhydat. Use that if you can.

Installing

if(!requireNamespace("remotes")) install.packages("remotes")
remotes::install_github('rywhale/rtdd')

Station Metadata

All Stations

By default, dd_hydro_meta will return metadata for all avaiable stations, across Canada

stn_meta <- dd_hydro_meta()
#> No encoding supplied: defaulting to UTF-8.
str(stn_meta)
#> Classes 'tbl_df', 'tbl' and 'data.frame':    2127 obs. of  5 variables:
#>  $ STATION_ID  : chr  "01AD003" "01AD004" "01AF002" "01AF007" ...
#>  $ STATION_NAME: chr  "ST. FRANCIS RIVER AT OUTLET OF GLASIER LAKE" "SAINT JOHN RIVER AT EDMUNDSTON" "SAINT JOHN RIVER AT GRAND FALLS" "GRANDE RIVIERE AT VIOLETTE BRIDGE" ...
#>  $ STATION_LAT : num  47.2 47.4 47 47.2 47.5 ...
#>  $ STATION_LON : num  -69 -68.3 -67.7 -67.9 -68.4 ...
#>  $ PROV_TERR   : chr  "NB" "NB" "NB" "NB" ...

By Province/Territory

You can also filter by a province or territory short code. See ?dd_hydro_meta for valid options

ont_stn_meta <- dd_hydro_meta(prov_terr = "ON")
#> No encoding supplied: defaulting to UTF-8.

Station Data

You can retrieve either an individual station’s data or all the data available for given a province or territory. There are also multiple update intervals available:

  • hourly - (Default) Last 2 complete days of data plus the current incomplete day
  • daily - Last 30 complete days of data plus the current incomplete day

Single Station

stn_data <- dd_hydro_data(station_id = "05QB002", prov_terr = "ON")
#> No encoding supplied: defaulting to UTF-8.
str(stn_data)
#> Classes 'tbl_df', 'tbl' and 'data.frame':    540 obs. of  6 variables:
#>  $ STATION_ID : chr  "05QB002" "05QB002" "05QB002" "05QB002" ...
#>  $ TIMESTAMP  : POSIXct, format: "2019-07-02 05:40:00" "2019-07-02 05:45:00" ...
#>  $ WATER_LEVEL: num  356 356 356 356 356 ...
#>  $ QA_QC_WL   : num  1 1 1 1 1 1 1 1 1 1 ...
#>  $ DISCHARGE  : logi  NA NA NA NA NA NA ...
#>  $ QA_QC_DIS  : logi  NA NA NA NA NA NA ...

All Stations in Province/Territory

You can grab all the data for a given province/territory by setting all_stns=TRUE.

all_stn_data <- dd_hydro_data(prov_terr = "YT", all_stns = TRUE)
#> No encoding supplied: defaulting to UTF-8.
str(all_stn_data)
#> Classes 'tbl_df', 'tbl' and 'data.frame':    36014 obs. of  6 variables:
#>  $ STATION_ID : chr  "10MD001" "10MD001" "10MD001" "10MD001" ...
#>  $ TIMESTAMP  : POSIXct, format: "2019-07-02 07:00:00" "2019-07-02 07:05:00" ...
#>  $ WATER_LEVEL: num  3.55 3.54 3.55 3.54 3.55 ...
#>  $ QA_QC_WL   : num  1 1 1 1 1 1 1 1 1 1 ...
#>  $ DISCHARGE  : num  36.6 35.6 36.6 35.8 36.6 36 36.4 36.1 36.6 36.2 ...
#>  $ QA_QC_DIS  : num  1 1 1 1 1 1 1 1 1 1 ...

About

WSC DataMart files --> zrxp for WISKI ingest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%