All Projects → ropensci → tidyhydat

ropensci / tidyhydat

Licence: Apache-2.0 license
An R package to import Water Survey of Canada hydrometric data and make it tidy

Programming Languages

r
7636 projects
CSS
56736 projects
TeX
3793 projects

Projects that are alternatives of or similar to tidyhydat

bcdata
An R package for searching & retrieving data from the B.C. Data Catalogue
Stars: ✭ 68 (+1.49%)
Mutual labels:  r-package, citz
intro-to-tidyhydat-and-tidyverse
Introduction to R and the tidyverse in Hydrology
Stars: ✭ 16 (-76.12%)
Mutual labels:  hydrology, citz
SoilMachine
Advanced, modular, coupled geomorpohology simulator for real-time procedural terrain generation.
Stars: ✭ 166 (+147.76%)
Mutual labels:  hydrology
prediction
Tidy, Type-Safe 'prediction()' Methods
Stars: ✭ 86 (+28.36%)
Mutual labels:  tidy-data
PLNmodels
A collection of Poisson lognormal models for multivariate count data analysis
Stars: ✭ 44 (-34.33%)
Mutual labels:  r-package
bioc 2020 tidytranscriptomics
Workshop on tidytranscriptomics: Performing tidy transcriptomics analyses with tidybulk, tidyverse and tidyheatmap
Stars: ✭ 25 (-62.69%)
Mutual labels:  tidy-data
suppdata
Grabbing SUPPlementary DATA in R
Stars: ✭ 31 (-53.73%)
Mutual labels:  r-package
bootstrap-theme
The new home for the new bootstrap v4 themed BC Gov. look-and-feel
Stars: ✭ 16 (-76.12%)
Mutual labels:  citz
syn
syn - the thesaurus
Stars: ✭ 45 (-32.84%)
Mutual labels:  r-package
geodaData
Data package for accessing GeoDa datasets using R
Stars: ✭ 15 (-77.61%)
Mutual labels:  r-package
rcppsimdjson
Rcpp Bindings for the 'simdjson' Header Library
Stars: ✭ 103 (+53.73%)
Mutual labels:  r-package
crminer
⛔ ARCHIVED ⛔ Fetch 'Scholary' Full Text from 'Crossref'
Stars: ✭ 17 (-74.63%)
Mutual labels:  r-package
PyForecast
PyForecast is a statistical modeling tool used by Reclamation water managers and reservoir operators to train and build predictive models for seasonal inflows and streamflows. PyForecast allows users to make current water-year forecasts using models developed with the program.
Stars: ✭ 24 (-64.18%)
Mutual labels:  hydrology
datawizard
Magic potions to clean and transform your data 🧙
Stars: ✭ 149 (+122.39%)
Mutual labels:  r-package
fec-parse
A Node module to parse raw FEC electronic filings, inspired by Fech.
Stars: ✭ 16 (-76.12%)
Mutual labels:  government-data
states
Create country-year/month/day panels consistent with the COW or Gleditsch & Ward independent states lists
Stars: ✭ 13 (-80.6%)
Mutual labels:  r-package
py3dep
A part of HyRiver software stack for getting topography data within the US through 3D Elevation Program (3DEP)
Stars: ✭ 30 (-55.22%)
Mutual labels:  hydrology
rdomains
Classifying the content of domains
Stars: ✭ 47 (-29.85%)
Mutual labels:  r-package
lingtypology
R package for linguistic cartography and typological databases search
Stars: ✭ 47 (-29.85%)
Mutual labels:  r-package
nlrx
nlrx NetLogo R
Stars: ✭ 66 (-1.49%)
Mutual labels:  r-package

tidyhydat

License Coverage status R build status

CRAN_Status_Badge CRAN Downloads cran checks r-universe DOI DOI R-CMD-check

What does tidyhydat do?

  • Provides functions (hy_*) that access hydrometric data from the HYDAT database, a national archive of Canadian hydrometric data and return tidy data.
  • Provides functions (realtime_*) that access Environment and Climate Change Canada’s real-time hydrometric data source.
  • Provides functions (search_*) that can search through the approximately 7000 stations in the database and aid in generating station vectors
  • Keep functions as simple as possible. For example, for daily flows, the hy_daily_flows() function queries the database, tidies the data and returns a tibble of daily flows.

Installation

You can install tidyhydat from CRAN:

install.packages("tidyhydat")

To install the development version of the tidyhydat package, you can install directly from the rOpenSci development server:

install.packages("tidyhydat", repos = "https://dev.ropensci.org")

Usage

More documentation on tidyhydat can found at the rOpenSci doc page: https://docs.ropensci.org/tidyhydat/

When you install tidyhydat, several other packages will be installed as well. One of those packages, dplyr, is useful for data manipulations and is used regularly here. To use actually use dplyr in a session you must explicitly load it. A helpful dplyr tutorial can be found here.

library(tidyhydat)
library(dplyr)

HYDAT download

To use many of the functions in the tidyhydat package you will need to download a version of the HYDAT database, Environment and Climate Change Canada’s database of historical hydrometric data then tell R where to find the database. Conveniently tidyhydat does all this for you via:

download_hydat()

This downloads (with your permission) the most recent version of HYDAT and then saves it in a location on your computer where tidyhydat’s function will look for it. Do be patient though as this can take a long time! To see where HYDAT was saved you can run hy_default_db(). Now that you have HYDAT downloaded and ready to go, you are all set to begin looking at Canadian hydrometric data.

Real-time

To download real-time data using the datamart we can use approximately the same conventions discussed above. Using realtime_dd() we can easily select specific stations by supplying a station of interest:

realtime_dd(station_number = "08MF005")
#>   Queried on: 2022-11-11 15:18:39 (UTC)
#>   Date range: 2022-10-11 to 2022-11-11 
#> # A tibble: 18,006 × 8
#>    STATION_NUMBER PROV_TE…¹ Date                Param…² Value Grade Symbol Code 
#>    <chr>          <chr>     <dttm>              <chr>   <dbl> <chr> <chr>  <chr>
#>  1 08MF005        BC        2022-10-11 08:00:00 Flow     1190 <NA>  <NA>   1    
#>  2 08MF005        BC        2022-10-11 08:05:00 Flow     1190 <NA>  <NA>   1    
#>  3 08MF005        BC        2022-10-11 08:10:00 Flow     1190 <NA>  <NA>   1    
#>  4 08MF005        BC        2022-10-11 08:15:00 Flow     1190 <NA>  <NA>   1    
#>  5 08MF005        BC        2022-10-11 08:20:00 Flow     1190 <NA>  <NA>   1    
#>  6 08MF005        BC        2022-10-11 08:25:00 Flow     1190 <NA>  <NA>   1    
#>  7 08MF005        BC        2022-10-11 08:30:00 Flow     1190 <NA>  <NA>   1    
#>  8 08MF005        BC        2022-10-11 08:35:00 Flow     1180 <NA>  <NA>   1    
#>  9 08MF005        BC        2022-10-11 08:40:00 Flow     1190 <NA>  <NA>   1    
#> 10 08MF005        BC        2022-10-11 08:45:00 Flow     1190 <NA>  <NA>   1    
#> # … with 17,996 more rows, and abbreviated variable names ¹​PROV_TERR_STATE_LOC,
#> #   ²​Parameter

Plotting

Plot methods are also provided to quickly visualize realtime data:

realtime_ex <- realtime_dd(station_number = "08MF005")

plot(realtime_ex)

and also historical data:

hy_ex <- hy_daily_flows(station_number = "08MF005", start_date = "2013-01-01")

plot(hy_ex)

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an issue.

These are very welcome!

How to Contribute

If you would like to contribute to the package, please see our CONTRIBUTING guidelines.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Citation

Get citation information for tidyhydat in R by running:

To cite package 'tidyhydat' in publications use:

  Albers S (2017). "tidyhydat: Extract and Tidy Canadian Hydrometric
  Data." _The Journal of Open Source Software_, *2*(20).
  doi:10.21105/joss.00511 <https://doi.org/10.21105/joss.00511>,
  <http://dx.doi.org/10.21105/joss.00511>.

A BibTeX entry for LaTeX users is

  @Article{,
    title = {tidyhydat: Extract and Tidy Canadian Hydrometric Data},
    author = {Sam Albers},
    doi = {10.21105/joss.00511},
    url = {http://dx.doi.org/10.21105/joss.00511},
    year = {2017},
    publisher = {The Open Journal},
    volume = {2},
    number = {20},
    journal = {The Journal of Open Source Software},
  }

ropensci_footer

License

Copyright 2017 Province of British Columbia

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].