Science Score: 26.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
-
â—‹Academic publication links
-
â—‹Committers with academic emails
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (16.2%) to scientific vocabulary
Keywords
data-science
env
r
r-package
rlang
rstats
Keywords from Contributors
species-sensitivity-distribution
bcdc
citz
Last synced: 6 months ago
·
JSON representation
Repository
R 📦 to download 🇨🇦 open water quality data
Basic Info
- Host: GitHub
- Owner: bcgov
- License: apache-2.0
- Language: R
- Default Branch: master
- Size: 694 KB
Statistics
- Stars: 13
- Watchers: 9
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
data-science
env
r
r-package
rlang
rstats
Created about 8 years ago
· Last pushed 11 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "tools/readme/",
message = FALSE
)
```
[](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)
[](https://travis-ci.org/bcgov/canwqdata)[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/bcgov/canwqdata/actions?workflow=R-CMD-check)
[](https://codecov.io/gh/bcgov/canwqdata?branch=master)
# canwqdata
An R `r emo::ji("package")` to download open water quality data from Environment and Climate Change Canada's [National Long-term Water Quality Monitoring Data](http://donnees.ec.gc.ca/data/substances/monitor/national-long-term-water-quality-monitoring-data/).
### Features
This package is designed to get Canadian Water Quality Monitoring data into R quickly and easily. You can get data from a single monitoring station, multiple stations, or from an entire basin. Note that current version of this package can only retrieve data from BC, not from other provinces.
### Installation
```r
remotes::install_github("bcgov/canwqdata")
```
### Usage
First load the package:
```{r}
library(canwqdata)
library(tidyverse)
```
The first thing you will probably want to do is get a list of the available BC sites and associated metadata:
```{r}
sites <- wq_sites()
sites
```
Then get some data from a particular station:
`BC08EF0001` is a site in BC called *`r tools::toTitleCase(tolower(sites$SITE_NAME[sites$SITE_NO == "BC08EF0001"]))`*
```{r}
skeena_river <- wq_site_data("BC08EF0001")
skeena_river
```
We can also get data from more than one station:
```{r}
wq_site_data(c("BC08NF0001", "BC08NM0160"))
```
Or an entire basin:
The basins are in the `PEARSEDA` column of the data.frame returned by `wq_sites()`:
```{r}
basins <- sort(unique(sites$PEARSEDA))
basins
fraser <- wq_basin_data("FRASER-LOWER MAINLAND")
```
Do some quick summary stats of the fraser dataset:
```{r}
library(dplyr)
fraser %>%
group_by(SITE_NO) %>%
summarise(first_date = min(DATE_TIME_HEURE),
latest_date = max(DATE_TIME_HEURE),
n_params = length(unique(VARIABLE)),
total_samples = n())
```
We can also look at metadata that helps us understand what is in the different columns.
`wq_params()` returns a list of water quality parameters (variables), and related data - units, methods, codes, etc:
```{r}
params <- wq_params()
glimpse(params)
# wq_param_desc shows the column headings (in all other tables) and what they mean
wq_data_desc() %>%
glimpse()
```
Let's look at Total Nitrogen in the Fraser basin:
```{r}
fraser_n_total <- fraser %>% filter(VARIABLE == "NITROGEN TOTAL")
```
Now lets do some plotting - plot Total Nitrogen over time at all the sites,
(plot it on a log scale so that they all fit)
```{r}
library(ggplot2)
ggplot(fraser_n_total, aes(x = DATE_TIME_HEURE, y = VALUE_VALEUR)) +
geom_point(size = 0.4, alpha = 0.4, colour = "purple") +
facet_wrap(~ SITE_NO) +
scale_y_log10()
```
It's also possible to download data from an entire BC:
```{r}
bc_sites <- sites %>%
pull(SITE_NO)
all_bc_data <- wq_site_data(bc_sites)
glimpse(all_bc_data)
```
### Project Status
Under development, but ready for use and testing.
### Getting Help or Reporting an Issue
To report bugs/issues/feature requests, please file an [issue](https://github.com/bcgov/canwqdata/issues/).
### How to Contribute
If you would like to contribute to the package, please see our
[CONTRIBUTING](CONTRIBUTING.md) guidelines.
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
### License
Copyright 2025 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
http://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.
This repository is maintained by [Environmental Reporting BC](http://www2.gov.bc.ca/gov/content?id=FF80E0B985F245CEA62808414D78C41B). Click [here](https://github.com/bcgov/EnvReportBC-RepoList) for a complete list of our repositories on GitHub.
Owner
- Name: bcgov
- Login: bcgov
- Kind: organization
- Email: Developer.Experience@gov.bc.ca
- Location: Canada
- Website: https://github.com/bcgov/BC-Policy-Framework-For-GitHub
- Repositories: 2,150
- Profile: https://github.com/bcgov
This is the home for code that is open
GitHub Events
Total
- Push event: 6
- Pull request event: 2
- Create event: 1
Last Year
- Push event: 6
- Pull request event: 2
- Create event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Andy Teucher | a****r@g****a | 76 |
| szy-al | Z****g@g****a | 25 |
| repo-mountie[bot] | 4****] | 3 |
| stephhazlitt | s****t@g****a | 2 |
| KarHarker | k****r@g****a | 1 |
Committer Domains (Top 20 + Academic)
gov.bc.ca: 4
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 5
- Total pull requests: 4
- Average time to close issues: about 2 months
- Average time to close pull requests: 5 days
- Total issue authors: 2
- Total pull request authors: 3
- Average comments per issue: 0.6
- Average comments per pull request: 1.5
- Merged pull requests: 4
- Bot issues: 4
- Bot pull requests: 2
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 27 minutes
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- repo-mountie[bot] (4)
- KarHarker (1)
Pull Request Authors
- szy-al (2)
- repo-mountie[bot] (2)
- ateucher (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
DESCRIPTION
cran
- dplyr >= 0.7 imports
- httr >= 1.3 imports
- memoise >= 1.1 imports
- readr >= 1.1 imports
- rvest >= 0.3 imports
- stats * imports
- xml2 >= 1.1 imports
- covr * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/cache v4 composite
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-tinytex v2 composite