R>> EGRET>> 返回
项目作者: USGS-R

项目描述 :
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). http://usgs-r.github.io/EGRET/
高级语言: R
项目地址: git://github.com/USGS-R/EGRET.git
创建时间: 2013-01-14T19:45:02Z
项目社区:https://github.com/USGS-R/EGRET

开源协议:Other

下载


" class="reference-link">EGRET

CRAN
version

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:
https://doi-usgs.github.io/EGRET

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

https://pubs.usgs.gov/tm/04/a10

A companion package 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

Package Installation

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

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

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

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”
().

Sample Workflow

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

  1. library(EGRET)
  2. ############################
  3. # Gather discharge data:
  4. siteID <- "01491000" #Choptank River at Greensboro, MD
  5. startDate <- "" #Gets earliest date
  6. endDate <- "2011-09-30"
  7. # Gather sample data:
  8. parameter_cd<-"00631" #5 digit USGS code
  9. Sample <- readNWISSample(siteID,parameter_cd,startDate,endDate)
  10. #Gets earliest date from Sample record:
  11. #This is just one of many ways to assure the Daily record
  12. #spans the Sample record
  13. startDate <- min(as.character(Sample$Date))
  14. # Gather discharge data:
  15. Daily <- readNWISDaily(siteID,"00060",startDate,endDate)
  16. # Gather site and parameter information:
  17. # Here user must input some values for
  18. # the default (interactive=TRUE)
  19. INFO<- readNWISInfo(siteID,parameter_cd)
  20. INFO$shortName <- "Choptank River at Greensboro, MD"
  21. # Merge discharge with sample data:
  22. eList <- mergeReport(INFO, Daily, Sample)
  1. library(EGRET)
  2. # Sample data included in package:
  3. eList <- Choptank_eList
  4. boxConcMonth(eList)

  1. boxQTwice(eList)

  1. plotConcTime(eList)

  1. plotConcQ(eList)

  1. multiPlotDataOverview(eList)

  1. # Run WRTDS model:
  2. eList <- modelEstimation(eList)
  3. #>
  4. #> first step running estCrossVal may take about 1 minute
  5. #> estCrossVal % complete:
  6. #> 0 1 2 3 4 5 6 7 8 9 10
  7. #> 11 12 13 14 15 16 17 18 19 20
  8. #> 21 22 23 24 25 26 27 28 29 30
  9. #> 31 32 33 34 35 36 37 38 39 40
  10. #> 41 42 43 44 45 46 47 48 49 50
  11. #> 51 52 53 54 55 56 57 58 59 60
  12. #> 61 62 63 64 65 66 67 68 69 70
  13. #> 71 72 73 74 75 76 77 78 79 80
  14. #> 81 82 83 84 85 86 87 88 89 90
  15. #> 91 92 93 94 95 96 97 98 99
  16. #> Next step running estSurfaces with survival regression:
  17. #> Survival regression (% complete):
  18. #> 0 1 2 3 4 5 6 7 8 9 10
  19. #> 11 12 13 14 15 16 17 18 19 20
  20. #> 21 22 23 24 25 26 27 28 29 30
  21. #> 31 32 33 34 35 36 37 38 39 40
  22. #> 41 42 43 44 45 46 47 48 49 50
  23. #> 51 52 53 54 55 56 57 58 59 60
  24. #> 61 62 63 64 65 66 67 68 69 70
  25. #> 71 72 73 74 75 76 77 78 79 80
  26. #> 81 82 83 84 85 86 87 88 89 90
  27. #> 91 92 93 94 95 96 97 98 99
  28. #> Survival regression: Done
  29. #eList:
  30. plotConcTimeDaily(eList)
  31. #> plotGenConc = TRUE requires running WRTDSKalman
  32. #> on eList. Switching to WRTDS concentration.

  1. plotFluxTimeDaily(eList)
  2. #> plotGenFlux = TRUE requires running WRTDSKalman
  3. #> on eList. Switching to WRTDS concentration.

  1. plotConcPred(eList)

  1. plotFluxPred(eList)

  1. plotResidPred(eList)

  1. plotResidQ(eList)

  1. plotResidTime(eList)

  1. boxResidMonth(eList)

  1. boxConcThree(eList)

  1. plotConcHist(eList)

  1. plotFluxHist(eList)

  1. # Multi-line plots:
  2. date1 <- "1985-09-01"
  3. date2 <- "1997-09-01"
  4. date3 <- "2010-09-01"
  5. qBottom<-0.2
  6. qTop<-10
  7. plotConcQSmooth(eList, date1, date2, date3, qBottom, qTop,
  8. concMax=2,legendTop = 0.85)

  1. q1 <- 2
  2. q2 <- 10
  3. q3 <- 20
  4. centerDate <- "07-01"
  5. yearEnd <- 1980
  6. yearStart <- 2010
  7. plotConcTimeSmooth(eList, q1, q2, q3, centerDate, yearStart, yearEnd, legendTop = 0.55, legendLeft = 1990)

  1. # Multi-plots:
  2. fluxBiasMulti(eList)

  1. #Contour plots:
  2. clevel<-seq(0,2,0.5)
  3. yearStart <- 1980
  4. yearEnd <- 2010
  5. plotContours(eList, yearStart,yearEnd,qBottom=0.5,
  6. qTop = 20, contourLevels = clevel)

  1. plotDiffContours(eList, year0 = 1990,
  2. year1 = 2010,
  3. qBottom = 0.5,
  4. qTop = 20,
  5. maxDiff = 0.6)

Sample workflow for a flowHistory application for the entire record

  1. library(EGRET)
  2. # Flow history analysis
  3. # Gather discharge data:
  4. siteID <- "01491000" #Choptank River at Greensboro, MD
  5. startDate <- "" # Get earliest date
  6. endDate <- "" # Get latest date
  7. Daily <- readNWISDaily(siteID, "00060", startDate, endDate)
  8. #> GET: https://waterservices.usgs.gov/nwis/dv/?site=01491000&format=rdb%2C1.0&ParameterCd=00060&StatCd=00003&startDT=1851-01-01
  9. #> There are 28235 data points, and 28235 days.
  10. # Gather site and parameter information:
  11. # Here user must input some values for
  12. # the default (interactive=TRUE)
  13. INFO <- readNWISInfo(siteID, "00060")
  14. #> GET: https://waterservices.usgs.gov/nwis/site/?siteOutput=Expanded&format=rdb&site=01491000
  15. #> Your site for streamflow data is:
  16. #> 01491000 .
  17. #> Your site name is CHOPTANK RIVER NEAR GREENSBORO, MD
  18. #> but you can modify this to a short name in a style you prefer.
  19. #> This name will be used to label graphs and tables.
  20. #> If you want the program to use the name given above, just do a carriage return,
  21. #> otherwise enter the preferred short name(no quotes):
  22. #>
  23. #> The latitude and longitude of the site are: 38.99719 , -75.78581 (degrees north and west).
  24. #>
  25. #> The drainage area at this site is 113 square miles
  26. #> which is being stored as 292.6687 square kilometers.
  27. #>
  28. #> It is helpful to set up a station abbreviation when doing multi-site studies,
  29. #> enter a unique id (three or four characters should work). It is case sensitive.
  30. #> Even if you don't feel you need an abbreviation for your site you need to enter something(no quotes):
  31. #>
  32. #> Your water quality data are for parameter number:
  33. #> 00060
  34. #> which has the name:' Discharge, cubic feet per second '.
  35. #> Typically you will want a shorter name to be used in graphs and tables.
  36. #> The suggested short name is:' Stream flow, mean. daily '.
  37. #> If you would like to change the short name, enter it here,
  38. #> otherwise just hit enter (no quotes):
  39. #> The units for the water quality data are: ft3/s .
  40. #> It is helpful to set up a constiuent abbreviation, enter a unique id
  41. #> three or four characters should work something like tn or tp or NO3).
  42. #> Even if you don't feel you need an abbreviation you need to enter something (no quotes):
  43. #>
  44. #> Required concentration units are mg/l.
  45. #> The INFO dataframe indicates: ft3/s
  46. #> Flux calculations will be wrong if units are not consistent.
  47. INFO$shortName <- "Choptank River at Greensboro, MD"
  48. eList <- as.egret(INFO, Daily, NA, NA)
  49. # Check flow history data:
  50. plotFlowSingle(eList, istat = 7,qUnit = "thousandCfs")

  1. plotSDLogQ(eList)

  1. plotQTimeDaily(eList, qLower = 1, qUnit = 3)

  1. plotFour(eList, qUnit=3)

  1. plotFourStats(eList, qUnit=3)

Reporting bugs

Please consider reporting bugs and asking questions on the Issues page:
https://github.com/DOI-USGS/EGRET/issues

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:

  1. citation(package = "EGRET")
  2. #> To cite EGRET in publications, please use:
  3. #>
  4. #> Hirsch, R.M., De Cicco, L.A., Murphy, J., 2025, Exploration and
  5. #> Graphics for RivEr Trends (EGRET), version 3.0.11,
  6. #> doi:10.5066/P9CC9JEX
  7. #>
  8. #> A BibTeX entry for LaTeX users is
  9. #>
  10. #> @Manual{,
  11. #> author = {Robert Hirsch and Laura DeCicco and Jennifer Murphy},
  12. #> title = {Exploration and Graphics for RivEr Trends (EGRET)},
  13. #> publisher = {U.S. Geological Survey},
  14. #> year = {2025},
  15. #> url = {https://pubs.usgs.gov/tm/04/a10/},
  16. #> }

References

See this list for WRTDS applications in print:

https://doi-usgs.github.io/EGRET/articles/References_WRTDS.html

Disclaimer

This software is preliminary or provisional and is subject to revision.
It is being provided to meet the need for timely best science. The
software has not received final approval by the U.S. Geological Survey
(USGS). No warranty, expressed or implied, is made by the USGS or the
U.S. Government as to the functionality of the software and related
material nor shall the fact of release constitute any such warranty. The
software is provided on the condition that neither the USGS nor the U.S.
Government shall be held liable for any damages resulting from the
authorized or unauthorized use of the software.