EGRET

An R-package for the analysis of long-term changes in water quality and streamflow, including the water-quality method Weighted Regressions on Time, Discharge, and Season (WRTDS). https://doi-usgs.github.io/EGRET/

https://github.com/DOI-USGS/EGRET

Science Score: 67.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 9 DOI reference(s) in README
  • Academic publication links
    Links to: wiley.com, acs.org
  • Committers with academic emails
    9 of 19 committers (47.4%) from academic institutions
  • Institutional organization owner
    Organization doi-usgs has institutional domain (www.usgs.gov)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.2%) to scientific vocabulary

Keywords

r r-package rstats usgs water-quality water-quality-data

Keywords from Contributors

geo-data-portal grid-data trait
Last synced: 6 months ago · JSON representation

Repository

An R-package for the analysis of long-term changes in water quality and streamflow, including the water-quality method Weighted Regressions on Time, Discharge, and Season (WRTDS). https://doi-usgs.github.io/EGRET/

Basic Info
Statistics
  • Stars: 93
  • Watchers: 23
  • Forks: 49
  • Open Issues: 9
  • Releases: 21
Topics
r r-package rstats usgs water-quality water-quality-data
Created about 13 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
title: "README"
output:
  md_document:
    variant: markdown_github
editor_options: 
  chunk_output_type: console
---

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

# EGRET 

[![CRAN version](http://www.r-pkg.org/badges/version/EGRET)](https://cran.r-project.org/package=EGRET)
[![](http://cranlogs.r-pkg.org/badges/EGRET)](https://cran.r-project.org/package=EGRET)
[![](http://cranlogs.r-pkg.org/badges/grand-total/EGRET)](https://cran.r-project.org/package=EGRET)


Exploration and Graphics for RivEr Trends (`EGRET`): 
An R-package for the analysis of long-term changes in water quality and streamflow, including the water-quality method Weighted Regressions on Time, Discharge, and Season (WRTDS).

Look for new and improved documentation here:


The link for the official USGS publication user guide is here:

[https://pubs.usgs.gov/tm/04/a10/](https://pubs.usgs.gov/tm/04/a10/)

A companion package [`EGRETci`](https://doi-usgs.github.io/EGRETci/) implements a set of approaches to the analysis of uncertainty associated with WRTDS trend analysis.

If you are familiar with the traditional `EGRET` workflow, check out the [Overview and Updates](https://doi-usgs.github.io/EGRET/articles/Overview.html to see how all the latest updates relate.

Recent introduction to WRTDS and the `EGRET` package at the 12th National Monitoring Conference
April 19, 2021:



[New capabilities](https://www.youtube.com/watch?v=ThxdHxrw5qk)

## Package Installation
To install the EGRET package, you must be using R 3.0 or greater and run the following command:

```{r eval=FALSE}
install.packages("EGRET")
```

## Background:

Evaluating long-term changes in river conditions (water quality and discharge) is an important use of hydrologic data. To carry out such evaluations, the hydrologist needs tools to facilitate several key steps in the process: acquiring the data records from a variety of sources, structuring it in ways that facilitate the analysis, routines that will process the data to extract information about changes that may be happening, and graphical techniques that can display findings about change. The R package `EGRET` (Exploration and Graphics for RivEr Trends) was developed for carrying out each of these steps in an integrated manner. It is designed to accept easily data from three sources: U.S. Geological Survey hydrologic data, Water Quality Portal Data (currently including U.S. Environmental Protection Agency (EPA) STORET data, and USDA STEWARDS data), and user-supplied flat files. The `EGRET` package has components oriented towards the description of long-term changes in streamflow statistics (high flow, average flow, and low flow) as well as changes in water quality. For the water-quality analysis, it uses Weighted Regressions on Time, Discharge and Season (WRTDS) to describe long-term trends in both concentration and flux. `EGRET` also creates a wide range of graphical presentations of the water-quality data and of the WRTDS results. The following report serves as a user guide, providing detailed guidance on installation and use of the software, documentation of the analysis methods used, as well as guidance on some of the kinds of questions and approaches that the software can facilitate.

`EGRET` includes statistics and graphics for streamflow history, water quality trends, and the statistical modeling algorithm Weighted Regressions on Time, Discharge, and Season (WRTDS).  Please see the official EGRET User Guide for more information on the `EGRET` package:

[https://doi.org/10.3133/tm4A10](https://doi.org/10.3133/tm4A10) 
The best ways to learn about the WRTDS approach is to read the User Guide and two journal articles. These articles are available, for free, from the journals in which they were published. The first relates to nitrate and total phosphorus data for 9 rivers draining to Chesapeake Bay. The URL is:

[https://onlinelibrary.wiley.com/doi/full/10.1111/j.1752-1688.2010.00482.x](https://onlinelibrary.wiley.com/doi/full/10.1111/j.1752-1688.2010.00482.x). 

The second is an application to nitrate data for 8 monitoring sites on the Mississippi River or its major tributaries.  The URL is: 

[https://pubs.acs.org/doi/abs/10.1021/es201221s](https://pubs.acs.org/doi/abs/10.1021/es201221s)

For a thorough discussion of the generalized flow normalization method implemented in the EGRET enhancements, see the paper: "Tracking changes in nutrient delivery to western Lake Erie: Approaches to compensate for variability and trends in streamflow" (doi:10.1016/j.jglr.2018.11.012).


## Sample Workflow

WRTDS on the Choptank River at Greensboro MD, for Nitrate:

```{r eval=FALSE}
library(EGRET)

############################
# Gather discharge data:
siteID <- "01491000" #Choptank River at Greensboro, MD
startDate <- "" #Gets earliest date
endDate <- "2011-09-30"
# Gather sample data:
parameter_cd<-"00631" #5 digit USGS code
Sample <- readNWISSample(siteID,parameter_cd,startDate,endDate)
#Gets earliest date from Sample record:
#This is just one of many ways to assure the Daily record
#spans the Sample record
startDate <- min(as.character(Sample$Date)) 
# Gather discharge data:
Daily <- readNWISDaily(siteID,"00060",startDate,endDate)
# Gather site and parameter information:

# Here user must input some values for
# the default (interactive=TRUE)
INFO<- readNWISInfo(siteID,parameter_cd)
INFO$shortName <- "Choptank River at Greensboro, MD"

# Merge discharge with sample data:
eList <- mergeReport(INFO, Daily, Sample)
```


```{r startPlots}
library(EGRET)
# Sample data included in package:
eList <- Choptank_eList

boxConcMonth(eList)
boxQTwice(eList)
plotConcTime(eList)
plotConcQ(eList)
```

```{r multiPlot, fig.height=7}
multiPlotDataOverview(eList)
```

```{r runModel}
# Run WRTDS model:
eList <- modelEstimation(eList)

#eList:
plotConcTimeDaily(eList)
plotFluxTimeDaily(eList)
plotConcPred(eList)
plotFluxPred(eList)
plotResidPred(eList)
plotResidQ(eList)
plotResidTime(eList)
boxResidMonth(eList)
boxConcThree(eList)
plotConcHist(eList)
plotFluxHist(eList)
```

```{r multiPlots}
# Multi-line plots:
date1 <- "1985-09-01"
date2 <- "1997-09-01"
date3 <- "2010-09-01"
qBottom<-0.2
qTop<-10
plotConcQSmooth(eList, date1, date2, date3, qBottom, qTop, 
                   concMax=2,legendTop = 0.85)
q1 <- 2
q2 <- 10
q3 <- 20
centerDate <- "07-01"
yearEnd <- 1980
yearStart <- 2010
plotConcTimeSmooth(eList, q1, q2, q3, centerDate, yearStart, yearEnd, legendTop = 0.55, legendLeft = 1990)

```

```{r fluxPlots, fig.height=9}
# Multi-plots:
fluxBiasMulti(eList)
```

```{r contourPlots}
#Contour plots:
clevel<-seq(0,2,0.5)
yearStart <- 1980
yearEnd <- 2010

plotContours(eList, yearStart,yearEnd,qBottom=0.5,
             qTop = 20, contourLevels = clevel)

plotDiffContours(eList, year0 = 1990,
                 year1 = 2010,
                 qBottom = 0.5,
                 qTop = 20,
                 maxDiff = 0.6)
```


### Sample workflow for a flowHistory application for the entire record

```{r}
library(EGRET)

# Flow history analysis
# Gather discharge data:
siteID <- "01491000" #Choptank River at Greensboro, MD
startDate <- "" # Get earliest date
endDate <- "" # Get latest date
Daily <- readNWISDaily(siteID, "00060", startDate, endDate)
# Gather site and parameter information:
# Here user must input some values for
# the default (interactive=TRUE)
INFO <- readNWISInfo(siteID, "00060")
INFO$shortName <- "Choptank River at Greensboro, MD"
eList <- as.egret(INFO, Daily, NA, NA)

# Check flow history data:
plotFlowSingle(eList, istat = 7,qUnit = "thousandCfs")
plotSDLogQ(eList)
plotQTimeDaily(eList, qLower = 1, qUnit = 3)
```

```{r plotFours, fig.height=7}
plotFour(eList, qUnit=3)
plotFourStats(eList, qUnit=3)

```

## Reporting bugs

Please consider reporting bugs and asking questions on the Issues page:



## Subscribe

Please email questions, comments, and feedback to: 
egret_comments@usgs.gov

Additionally, to subscribe to an email list concerning updates to these R packages, please send a request to egret_comments@usgs.gov.

## Package Support

The Water Mission Area of the USGS has supported the development and maintenance of the `EGRET` R-package. Further maintenance is expected to be stable through October 2025. Resources are available primarily for maintenance and responding to user questions. Priorities on the development of new features are determined by the `EGRET` development team.


## Sunset date 

Funding for `EGRET` currently expires fall 2025. Expectations are that maintenance and customer service will continue to be supported past that date.

## How to cite EGRET:

```{r }
citation(package = "EGRET")
```

## References

See this list for WRTDS applications in print:




```{r disclaimer, child="DISCLAIMER.md", eval=TRUE}
```

Owner

  • Name: U.S. Geological Survey
  • Login: DOI-USGS
  • Kind: organization
  • Email: gs_help_git@usgs.gov
  • Location: United States of America

By integrating our diverse scientific expertise, we understand complex natural science phenomena and provide scientific products that lead to solutions.

GitHub Events

Total
  • Issues event: 6
  • Watch event: 5
  • Issue comment event: 4
  • Push event: 10
  • Pull request event: 18
  • Fork event: 1
Last Year
  • Issues event: 6
  • Watch event: 5
  • Issue comment event: 4
  • Push event: 10
  • Pull request event: 18
  • Fork event: 1

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 1,626
  • Total Committers: 19
  • Avg Commits per committer: 85.579
  • Development Distribution Score (DDS): 0.109
Past Year
  • Commits: 40
  • Committers: 1
  • Avg Commits per committer: 40.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Laura DeCicco l****o@u****v 1,448
DeCicco L****O@U****V 72
Lindsay Carr l****r@u****v 38
Andrew Yan a****n@u****v 21
Jessica Thompson j****s@u****v 12
wdwatkins w****s@u****v 8
tcadkin-usgs t****n@u****v 6
GitHub Actions Robot a****s@g****m 5
Oliver s****r@u****v 5
Jordan S Read j****d@u****v 2
Katrin Leinweber 9****r@u****m 1
Scott Chamberlain m****s@g****m 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
runner r****r@M****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 128
  • Total pull requests: 272
  • Average time to close issues: 6 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 42
  • Total pull request authors: 10
  • Average comments per issue: 1.93
  • Average comments per pull request: 0.39
  • Merged pull requests: 263
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 17
  • Average time to close issues: 5 months
  • Average time to close pull requests: 3 days
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 1.67
  • Average comments per pull request: 0.0
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rmhirsch49 (39)
  • ldecicco-USGS (30)
  • kimiakarimi (5)
  • emorway-usgs (4)
  • elp94 (3)
  • tungttnguyen (3)
  • kqasem (3)
  • raruggie (3)
  • jmacart (2)
  • StefanoMezzini (2)
  • jsta (2)
  • Farshad171 (2)
  • mturtora-USGS (2)
  • limnoliver (1)
  • wdwatkins (1)
Pull Request Authors
  • ldecicco-USGS (248)
  • lindsayplatt (14)
  • ayan-usgs (3)
  • jordansread (2)
  • wdwatkins (2)
  • tcadkin-usgs (1)
  • katrinleinweber (1)
  • sckott (1)
  • limnoliver (1)
  • fawda123 (1)
Top Labels
Issue Labels
enhancement (12) question (10) bug (2) wontfix (2) Beginner (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 26
proxy.golang.org: github.com/doi-usgs/egret
  • Versions: 13
  • 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
proxy.golang.org: github.com/DOI-USGS/EGRET
  • Versions: 13
  • 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

Dependencies

DESCRIPTION cran
  • R >= 3.5 depends
  • MASS * imports
  • dataRetrieval >= 2.0.1 imports
  • fields * imports
  • foreach * imports
  • grDevices * imports
  • graphics * imports
  • methods * imports
  • stats * imports
  • survival * imports
  • truncnorm * imports
  • utils * imports
  • EGRETci * suggests
  • covr * suggests
  • doParallel * suggests
  • dplyr * suggests
  • extrafont * suggests
  • knitr * suggests
  • lubridate * suggests
  • parallel * suggests
  • pkgdown * suggests
  • png * suggests
  • rkt * suggests
  • rmarkdown * suggests
  • testthat * suggests
  • zyp * 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/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 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/test-coverage.yaml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite