{"id":20426865,"url":"https://github.com/mps9506/echor","last_synced_at":"2025-04-12T19:10:11.948Z","repository":{"id":29581923,"uuid":"122131508","full_name":"mps9506/echor","owner":"mps9506","description":"Download EPA ECHO data in R","archived":false,"fork":false,"pushed_at":"2024-05-15T19:08:56.000Z","size":43765,"stargazers_count":9,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T19:10:02.996Z","etag":null,"topics":["epa","pollution","r","r-package","rstats","water-quality"],"latest_commit_sha":null,"homepage":"https://mps9506.github.io/echor/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mps9506.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-02-19T23:01:20.000Z","updated_at":"2025-01-14T18:43:38.000Z","dependencies_parsed_at":"2023-09-24T05:26:07.169Z","dependency_job_id":null,"html_url":"https://github.com/mps9506/echor","commit_stats":{"total_commits":381,"total_committers":3,"mean_commits":127.0,"dds":0.09186351706036744,"last_synced_commit":"a3b590e75fe0392e32c83d6df60ebc22f9521d95"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mps9506%2Fechor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mps9506%2Fechor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mps9506%2Fechor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mps9506%2Fechor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mps9506","download_url":"https://codeload.github.com/mps9506/echor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618277,"owners_count":21134200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["epa","pollution","r","r-package","rstats","water-quality"],"created_at":"2024-11-15T07:17:57.678Z","updated_at":"2025-04-12T19:10:11.912Z","avatar_url":"https://github.com/mps9506.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}\nknitr::opts_chunk$set(\n  dev = \"ragg_png\",\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  fig.retina = 2\n)\n\noptions(crayon.enabled = NULL)\n\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(mpsTemplates)\nlibrary(echor)\nlibrary(ragg)\n```\n\n# echor\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN status](https://www.r-pkg.org/badges/version/echor)](https://cran.r-project.org/package=echor)\n[![echor status badge](https://mps9506.r-universe.dev/badges/echor)](https://mps9506.r-universe.dev)\n\n[![R build status](https://github.com/mps9506/echor/workflows/R-CMD-check/badge.svg)](https://github.com/mps9506/echor/actions)\n[![Coverage status](https://codecov.io/gh/mps9506/echor/branch/master/graph/badge.svg)](https://app.codecov.io/github/mps9506/echor?branch=master)\n[![DOI](https://zenodo.org/badge/122131508.svg)](https://zenodo.org/badge/latestdoi/122131508)\n\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nechor downloads wastewater discharge and air emission data for EPA permitted facilities using the [EPA ECHO API](https://echo.epa.gov/).\n\n## Installation\n\nechor is on CRAN:\n\n```{r Install, eval=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}\ninstall.packages(\"echor\")\n```\n\nOr install the development version:\n\n```{r InstallDev, eval=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}\ninstall.packages('echor', repos = 'https://mps9506.r-universe.dev')\n```\n\n## Usage\n\n[Getting started](https://mps9506.github.io/echor/articles/introduction.html)\n\n[Functions](https://mps9506.github.io/echor/reference/index.html)\n\n## Examples\n\n### Download information about facilities with an NPDES permit\n\nWe 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)\n\n```{r example1, echo=TRUE, message=FALSE, warning=FALSE}\nlibrary(echor)\n\n## echoWaterGetFacilityInfo() will return a dataframe or simple features (sf) dataframe.\n\ndf \u003c- echoWaterGetFacilityInfo(output = \"df\", \n                               p_c1lon = '-96.387509', \n                               p_c1lat = '30.583572', \n                               p_c2lon = '-96.281422', \n                               p_c2lat = '30.640008',\n                               p_ptype = \"NPD\")\n\nhead(df)\n```\n\nThe 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.\n\n```{r example2, echo=TRUE, message=FALSE, warning=FALSE}\ndf \u003c- echoWaterGetFacilityInfo(output = \"df\", \n                               p_c1lon = '-96.387509', \n                               p_c1lat = '30.583572', \n                               p_c2lon = '-96.281422', \n                               p_c2lat = '30.640008',\n                               qcolumns = '1,14,23,24,25',\n                               p_ptype = \"NPD\")\nhead(df)\n```\n\n\n\nWhen returned as sf dataframes, the data is suitable for immediate spatial plotting or analysis.\n\n```{r example3, eval=TRUE, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE, out.width=\"100%\"}\nlibrary(ggspatial)\nlibrary(sf)\nlibrary(ggrepel)\nlibrary(prettymapr)\n\ndf \u003c- echoWaterGetFacilityInfo(output = \"sf\", \n                               p_c1lon = '-96.387509', \n                               p_c1lat = '30.583572', \n                               p_c2lon = '-96.281422', \n                               p_c2lat = '30.640008',\n                               p_ptype = \"NPD\")\n\n\nggplot(df) +\n  annotation_map_tile(zoomin = -1, progress = \"none\") +\n  geom_sf(inherit.aes = FALSE, shape = 21, \n          color = \"darkred\", fill = \"darkred\", \n          size = 2, alpha = 0.25) +\n  geom_label_repel(data = df, aes(label = SourceID,\n                                  geometry = geometry),\n                   stat = \"sf_coordinates\",\n                   point.padding = .5, min.segment.length = 0.1,\n                   size = 2, color = \"dodgerblue\") +\n  theme_mps_noto() +\n  labs(x = \"Longitude\", y = \"Latitude\", \n       title = \"NPDES permits near Texas A\u0026M\",\n       caption = \"Source: EPA ECHO database\")\n\n```\n\n### Download discharge/emissions data\n\nUse `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.\n\n```{r message=TRUE, warning=FALSE}\ndf \u003c- echoGetEffluent(p_id = 'tx0119407', parameter_code = '00300')\n\ndf \u003c- df %\u003e%\n  mutate(dmr_value_nmbr = as.numeric(dmr_value_nmbr),\n         monitoring_period_end_date = as.Date(monitoring_period_end_date,\n                                              \"%m/%d/%Y\")) %\u003e%\n  filter(!is.na(dmr_value_nmbr) \u0026 limit_value_type_code == \"C1\")\n\nggplot(df) +\n  geom_line(aes(monitoring_period_end_date, dmr_value_nmbr)) +\n  theme_mps_noto() +\n  labs(x = \"Monitoring period date\",\n       y = \"Dissolved oxygen concentration (mg/l)\",\n       title = \"Reported minimum dissolved oxygen concentration\",\n       subtitle = \"NPDES ID = TX119407\",\n       caption = \"Source: EPA ECHO\")\n\n```\n\n## Session Info\n\n```{r message=FALSE, warning=FALSE, error=FALSE}\nsessioninfo::platform_info()\nsessioninfo::package_info()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmps9506%2Fechor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmps9506%2Fechor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmps9506%2Fechor/lists"}