Science Score: 46.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
Links to: zenodo.org -
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.0%) to scientific vocabulary
Keywords
epa
pollution
r
r-package
rstats
water-quality
Last synced: 5 months ago
·
JSON representation
Repository
Download EPA ECHO data in R
Basic Info
- Host: GitHub
- Owner: mps9506
- License: other
- Language: R
- Default Branch: master
- Homepage: https://mps9506.github.io/echor/
- Size: 41.7 MB
Statistics
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 6
- Releases: 9
Topics
epa
pollution
r
r-package
rstats
water-quality
Created about 8 years ago
· Last pushed almost 2 years ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
knitr::opts_chunk$set(
dev = "ragg_png",
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.retina = 2
)
options(crayon.enabled = NULL)
library(dplyr)
library(ggplot2)
library(mpsTemplates)
library(echor)
library(ragg)
```
# echor
[](https://cran.r-project.org/package=echor)
[](https://mps9506.r-universe.dev)
[](https://github.com/mps9506/echor/actions)
[](https://app.codecov.io/github/mps9506/echor?branch=master)
[](https://zenodo.org/badge/latestdoi/122131508)
## Overview
echor downloads wastewater discharge and air emission data for EPA permitted facilities using the [EPA ECHO API](https://echo.epa.gov/).
## Installation
echor is on CRAN:
```{r Install, eval=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
install.packages("echor")
```
Or install the development version:
```{r InstallDev, eval=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
install.packages('echor', repos = 'https://mps9506.r-universe.dev')
```
## Usage
[Getting started](https://mps9506.github.io/echor/articles/introduction.html)
[Functions](https://mps9506.github.io/echor/reference/index.html)
## Examples
### Download information about facilities with an NPDES permit
We can look up plants by permit id, bounding box, and numerous other parameters. I plan on providing documentation of available parameters. However, arguments can be looked up here: [get_cwa_rest_services_get_facility_info](https://echo.epa.gov/tools/web-services/facility-search-water#!/Facility_Information/get_cwa_rest_services_get_facility_info)
```{r example1, echo=TRUE, message=FALSE, warning=FALSE}
library(echor)
## echoWaterGetFacilityInfo() will return a dataframe or simple features (sf) dataframe.
df <- echoWaterGetFacilityInfo(output = "df",
p_c1lon = '-96.387509',
p_c1lat = '30.583572',
p_c2lon = '-96.281422',
p_c2lat = '30.640008',
p_ptype = "NPD")
head(df)
```
The ECHO database can provide over 270 different columns. echor returns a subset of these columns that should work for most users. However, you can specify what data you want returned. Use `echoWaterGetMeta()` to return a dataframe with column numbers, names, and descriptions to identify the columns you want returned. Then include the column numbers as a comma separated string in the `qcolumns` argument. In the example below, the `qcolumns` argument indicates the dataframe will include plant name, 8-digit HUC, latitude, longitude, and total design flow.
```{r example2, echo=TRUE, message=FALSE, warning=FALSE}
df <- echoWaterGetFacilityInfo(output = "df",
p_c1lon = '-96.387509',
p_c1lat = '30.583572',
p_c2lon = '-96.281422',
p_c2lat = '30.640008',
qcolumns = '1,14,23,24,25',
p_ptype = "NPD")
head(df)
```
When returned as sf dataframes, the data is suitable for immediate spatial plotting or analysis.
```{r example3, eval=TRUE, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE, out.width="100%"}
library(ggspatial)
library(sf)
library(ggrepel)
library(prettymapr)
df <- echoWaterGetFacilityInfo(output = "sf",
p_c1lon = '-96.387509',
p_c1lat = '30.583572',
p_c2lon = '-96.281422',
p_c2lat = '30.640008',
p_ptype = "NPD")
ggplot(df) +
annotation_map_tile(zoomin = -1, progress = "none") +
geom_sf(inherit.aes = FALSE, shape = 21,
color = "darkred", fill = "darkred",
size = 2, alpha = 0.25) +
geom_label_repel(data = df, aes(label = SourceID,
geometry = geometry),
stat = "sf_coordinates",
point.padding = .5, min.segment.length = 0.1,
size = 2, color = "dodgerblue") +
theme_mps_noto() +
labs(x = "Longitude", y = "Latitude",
title = "NPDES permits near Texas A&M",
caption = "Source: EPA ECHO database")
```
### Download discharge/emissions data
Use `echoGetEffluent()` or `echoGetCAAPR()` to download tidy dataframes of permitted water discharger Discharge Monitoring Report (DMR) or permitted emitters Clean Air Act annual emissions reports. Please note that all variables are returned as *character* vectors.
```{r message=TRUE, warning=FALSE}
df <- echoGetEffluent(p_id = 'tx0119407', parameter_code = '00300')
df <- df %>%
mutate(dmr_value_nmbr = as.numeric(dmr_value_nmbr),
monitoring_period_end_date = as.Date(monitoring_period_end_date,
"%m/%d/%Y")) %>%
filter(!is.na(dmr_value_nmbr) & limit_value_type_code == "C1")
ggplot(df) +
geom_line(aes(monitoring_period_end_date, dmr_value_nmbr)) +
theme_mps_noto() +
labs(x = "Monitoring period date",
y = "Dissolved oxygen concentration (mg/l)",
title = "Reported minimum dissolved oxygen concentration",
subtitle = "NPDES ID = TX119407",
caption = "Source: EPA ECHO")
```
## Session Info
```{r message=FALSE, warning=FALSE, error=FALSE}
sessioninfo::platform_info()
sessioninfo::package_info()
```
Owner
- Name: Michael Schramm
- Login: mps9506
- Kind: user
- Location: Raleigh, NC
- Company: Texas A&M University, @TxWRI
- Website: michaelpaulschramm.com
- Twitter: mpschramm
- Repositories: 73
- Profile: https://github.com/mps9506
Research specialist with the Texas Water Resources Institute at Texas A&M University. All things water quality and watersheds.
GitHub Events
Total
- Issues event: 1
- Watch event: 3
- Issue comment event: 1
Last Year
- Issues event: 1
- Watch event: 3
- Issue comment event: 1
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| mps9506 | m****m@g****m | 349 |
| Michael Schramm | m****m@a****u | 34 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 48
- Total pull requests: 49
- Average time to close issues: about 1 month
- Average time to close pull requests: 8 days
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 0.52
- Average comments per pull request: 0.04
- Merged pull requests: 48
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mps9506 (45)
- rburghol (1)
- lionel- (1)
- benamie (1)
Pull Request Authors
- mps9506 (51)
Top Labels
Issue Labels
bug (10)
enhancement (4)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 321 last-month
- Total docker downloads: 42,005
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 10
- Total maintainers: 1
cran.r-project.org: echor
Access EPA 'ECHO' Data
- Homepage: https://github.com/mps9506/echor
- Documentation: http://cran.r-project.org/web/packages/echor/echor.pdf
- License: MIT + file LICENSE
-
Latest release: 0.1.9
published over 2 years ago
Rankings
Forks count: 21.9%
Downloads: 25.0%
Stargazers count: 26.2%
Average: 27.7%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- dplyr * imports
- geojsonsf * imports
- httr * imports
- plyr * imports
- purrr * imports
- readr * imports
- rlang * imports
- tibble * imports
- tidyr >= 1.0.0 imports
- utils * imports
- ggplot2 * suggests
- ggrepel * suggests
- ggspatial * suggests
- here * suggests
- httptest * suggests
- kableExtra * suggests
- knitr * suggests
- raster * suggests
- rmarkdown * suggests
- sf * suggests
- testthat * suggests
- utf8 * 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/build-packagedown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v3 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/render-readme.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- r-lib/actions/setup-renv v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite