Skip to content

Note to users of earlier versions of EGRET

Laura DeCicco edited this page Feb 5, 2015 · 12 revisions

For those of you who have been using EGRET and dataRetrieval be aware of the following major changes:

  1. the names of all of the functions used to retrieve data have changed based on initial user feedback. Here is a crosswalk table of the old function names and the new ones:
Old function name Current function name
getDVData readNWISDaily
getSampleData readNWISSample
getMetaData readNWISInfo and readUserInfo
getSTORETSampleData readWQPSample
getSampleDataFromFile readUserSample
getDailyDataFromFile readUserDaily
  1. If you have already created a workspace with the old software and would like to go back into EGRET and use it, you will need to create a list which contains the primary objects used by EGRET. Assuming that you already have three data frames: INFO, Daily, and Sample, what you need to do after you have loaded the workspace is give the command:
eList <- as.egret(INFO,Daily,Sample,NA)

and if you also have the object called surfaces then you should give the command

eList <- as.egret(INFO,Daily,Sample,surfaces)

You will note that virtually every function that you use to produce tables or graphics now has eList as its first argument. So, for example, rather than plotConcHist()R you would now say plotConcHist(eList). If you are in doubt about how to work with the functions you can always refer to their help page (for example ?plotConcHist).

  1. Change in mergeReport behavior.

Previously mergeReport would return a Sample data frame that was updated with discharge information. Now, the function returns the EGRET object (commonly referred to in the workflow examples as eList). In the returned eList, the Sample data frame includes the updated discharge information. So, if you want to either look at that data frame, you can extract it as follows:

Daily <- readNWISDaily("06934500","00060","1979-10-01","2010-09-30")
Sample <-readNWISSample("06934500","00631","1970-10-01","2011-09-30")
INFO <-readNWISInfo("06934500","00631")
eList <-mergeReport(INFO, Daily, Sample)

Sample <- eList$Sample

Note: if you don't run that last line, the Sample data frame will not have the updated discharge information. You do not need an updated Sample data frame for future EGRET functions, but it might be confusing.

This is especially confusing for long-time EGRET users who don't change their workflow:

# Don't do this!:
Sample <-mergeReport(INFO, Daily, Sample)
eList <- as.egret(INFO,Daily,Sample)
# Don't do that.

That is WRONG because what was returned from the mergeReport function is not a Sample data frame, but an egret object. The correct workflow is simply:

eList <-mergeReport(INFO, Daily, Sample)
Clone this wiki locally