tidyhydat

tidyhydat: Extract and Tidy Canadian Hydrometric Data - Published in JOSS (2017)

https://github.com/ropensci/tidyhydat

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

citz government-data hydrology hydrometrics r r-package rstats tidy-data water-resources

Keywords from Contributors

reproducibility
Last synced: 6 months ago · JSON representation

Repository

An R package to import Water Survey of Canada hydrometric data and make it tidy

Basic Info
Statistics
  • Stars: 71
  • Watchers: 12
  • Forks: 22
  • Open Issues: 9
  • Releases: 25
Topics
citz government-data hydrology hydrometrics r r-package rstats tidy-data water-resources
Created over 8 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.Rmd

---
title: README
output: md_document
---


    
```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# tidyhydat 



[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/license/apache-2-0)
[![R build status](https://github.com/ropensci/tidyhydat/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/tidyhydat/actions)

[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/tidyhydat)](https://cran.r-project.org/package=tidyhydat) [![CRAN Downloads](https://cranlogs.r-pkg.org/badges/tidyhydat?color=brightgreen)](https://CRAN.R-project.org/package=tidyhydat) [![cran checks](https://badges.cranchecks.info/worst/tidyhydat.svg)](https://cran.r-project.org/web/checks/check_results_tidyhydat.html)  [![r-universe](https://ropensci.r-universe.dev/badges/tidyhydat)](https://ropensci.r-universe.dev/builds)
[![](http://badges.ropensci.org/152_status.svg)](https://github.com/ropensci/software-review/issues/152)  [![DOI](http://joss.theoj.org/papers/10.21105/joss.00511/status.svg)](https://doi.org/10.21105/joss.00511) [![DOI](https://zenodo.org/badge/100978874.svg)](https://zenodo.org/badge/latestdoi/100978874) 



## 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](https://tibble.tidyverse.org/) of daily flows.

## Installation
You can install `tidyhydat` from CRAN:
```{r, echo=TRUE, eval=FALSE}
install.packages("tidyhydat")
```


To install the development version of the `tidyhydat` package, you can install directly from the rOpenSci development server:
```{r, echo=TRUE, eval=FALSE}
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](https://cran.r-project.org/package=dplyr/vignettes/dplyr.html).
  
```{r, eval = TRUE, echo=TRUE, message=FALSE, warning=FALSE}
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:
```{r, eval=FALSE}
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:
```{r}
realtime_dd(station_number = "08MF005")
```

Or we can use `realtime_ws`:

```{r}
realtime_ws(
  station_number = "08MF005",
  parameters = c(46, 5), ## see param_id for a list of codes
  start_date = Sys.Date() - 14,
  end_date = Sys.Date()
)
```

## Compare realtime_ws and realtime_dd
`tidyhydat` provides two methods to download realtime data. `realtime_dd()` provides a function to import .csv files from [here](https://dd.weather.gc.ca/hydrometric/csv/). 
`realtime_ws()` is an client for a web service hosted by ECCC. `realtime_ws()` has several difference to `realtime_dd()`. These include:

- *Speed*: The `realtime_ws()` is much faster for larger queries (i.e. many stations). For single station queries to `realtime_dd()` is more appropriate.
- *Length of record*: `realtime_ws()` records goes back further in time. 
- *Type of parameters*: `realtime_dd()` are restricted to river flow (either flow and level) data. In contrast `realtime_ws()` can download several different parameters depending on what is available for that station. See `data("param_id")` for a list and explanation of the parameters.
- *Date/Time filtering*: `realtime_ws()` provides argument to select a date range. Selecting a data range with `realtime_dd()` is not possible until after all files have been downloaded. 

### Plotting

Plot methods are also provided to quickly visualize realtime data:
```{r}
realtime_ex <- realtime_dd(station_number = "08MF005")

plot(realtime_ex)
```

and also historical data:
```{r, fig.height=7, fig.width=12}
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](https://github.com/ropensci/tidyhydat/issues/).

These are very welcome!

## How to Contribute

If you would like to contribute to the package, please see our 
[CONTRIBUTING](https://github.com/ropensci/tidyhydat/blob/master/CONTRIBUTING.md) guidelines.
  
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ropensci/tidyhydat/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
  
## Citation
Get citation information for `tidyhydat` in R by running:
```{r, echo=FALSE, comment=""}
citation("tidyhydat")
```



[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)

## 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.
  

Owner

  • Name: rOpenSci
  • Login: ropensci
  • Kind: organization
  • Email: info@ropensci.org
  • Location: Berkeley, CA

JOSS Publication

tidyhydat: Extract and Tidy Canadian Hydrometric Data
Published
December 15, 2017
Volume 2, Issue 20, Page 511
Authors
Sam J. Albers ORCID
Hydrology and Hydrometric Programs, Ministry of Environment and Climate Change Strategy, British Columbia Provincial Government
Editor
Arfon Smith ORCID
Tags
tidy data hydrology Canada

GitHub Events

Total
  • Issues event: 13
  • Watch event: 6
  • Delete event: 4
  • Issue comment event: 23
  • Push event: 18
  • Pull request event: 8
  • Fork event: 2
  • Create event: 5
Last Year
  • Issues event: 13
  • Watch event: 6
  • Delete event: 4
  • Issue comment event: 23
  • Push event: 18
  • Pull request event: 8
  • Fork event: 2
  • Create event: 5

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 685
  • Total Committers: 12
  • Avg Commits per committer: 57.083
  • Development Distribution Score (DDS): 0.048
Past Year
  • Commits: 11
  • Committers: 3
  • Avg Commits per committer: 3.667
  • Development Distribution Score (DDS): 0.182
Top Committers
Name Email Commits
Sam Albers s****s@g****a 652
Dewey Dunnington d****y@f****t 12
ateucher a****r@g****m 5
rywhale r****y@g****m 4
Maëlle Salmon m****n@y****e 3
gdelaplante 9****e 2
Arfon Smith a****n 2
mpdavison m****l@n****m 1
Vincenzo Coia v****a@g****m 1
Travis Simmons 6****s 1
Robert Chlumsky r****k@g****m 1
Jon Goetz J****Z@G****C 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 150
  • Total pull requests: 69
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 27
  • Total pull request authors: 12
  • Average comments per issue: 1.21
  • Average comments per pull request: 0.57
  • Merged pull requests: 64
  • Bot issues: 5
  • Bot pull requests: 0
Past Year
  • Issues: 10
  • Pull requests: 11
  • Average time to close issues: about 14 hours
  • Average time to close pull requests: about 14 hours
  • Issue authors: 6
  • Pull request authors: 2
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.55
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • boshek (106)
  • github-actions[bot] (5)
  • rajibshibly (4)
  • jongoetz (4)
  • njatel (3)
  • DaveHutch (2)
  • rywhale (2)
  • gdelaplante (2)
  • pausoto7 (2)
  • WatershedFlow (2)
  • SteveCoss (2)
  • alex-koiter (1)
  • ateucher (1)
  • elizabethng (1)
  • saeeshm (1)
Pull Request Authors
  • boshek (65)
  • maelle (3)
  • Travis-Simmons (2)
  • arfon (2)
  • gdelaplante (2)
  • mpdavison (2)
  • rchlumsk (1)
  • rywhale (1)
  • paleolimbot (1)
  • jongoetz (1)
  • vincenzocoia (1)
  • ateucher (1)
Top Labels
Issue Labels
enhancement (29) bug (17) ropensci_review (11) cran-error (8) provisional-data-gap (4)
Pull Request Labels
bug (1)

Packages

  • Total packages: 2
  • Total downloads:
    • cran 632 last-month
  • Total docker downloads: 130,623
  • Total dependent packages: 4
    (may contain duplicates)
  • Total dependent repositories: 10
    (may contain duplicates)
  • Total versions: 40
  • Total maintainers: 1
proxy.golang.org: github.com/ropensci/tidyhydat
  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: tidyhydat

Extract and Tidy Canadian 'Hydrometric' Data

  • Versions: 20
  • Dependent Packages: 4
  • Dependent Repositories: 10
  • Downloads: 632 Last month
  • Docker Downloads: 130,623
Rankings
Docker downloads count: 0.0%
Forks count: 4.1%
Stargazers count: 5.1%
Average: 7.3%
Dependent repos count: 9.3%
Dependent packages count: 10.6%
Downloads: 14.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2.3 depends
  • DBI >= 0.7 imports
  • RSQLite >= 2.0 imports
  • cli >= 1.0.0 imports
  • crayon >= 1.3.4 imports
  • dbplyr >= 1.1.0 imports
  • dplyr >= 0.7.4 imports
  • httr >= 1.3.1 imports
  • lubridate >= 1.6.0 imports
  • rappdirs >= 0.3.1 imports
  • readr >= 1.1.1 imports
  • rlang >= 0.1.2 imports
  • tidyr >= 0.7.1 imports
  • covr * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/cran-check-api.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r master composite