|
|
`dataRetrieval`
|
|
|
=============
|
|
|
|
|
|
R package source for data retrieval specifically for the EGRET R package:
|
|
|
Retrieval functions for USGS and EPA hydrologic and water quality data.
|
|
|
|
|
|
Please visit the EGRET wiki for more information:
|
|
|
[EGRET Wiki](https://github.com/USGS-R/EGRET/wiki)
|
|
|
A fairly large overhaul of the functions was done on November 31, 2014. Feedback from initial users was incorporated. For questions, bug reports, and suggestions please create an Issue here:
|
|
|
|
|
|
`dataRetrieval`
|
|
|
=============
|
|
|
[dataRetrieval Issues page](https://github.com/USGS-R/dataRetrieval/issues)
|
|
|
|
|
|
|
|
|
## Function Overview
|
|
|
|
|
|
Web service retrieval functions:
|
|
|
|
|
|
|Function | Inputs | Description |
|
|
|
| -------------| ------------------------|:-------------|
|
|
|
|`readNWISdata` | `...`, service | NWIS data using user-specified queries |
|
|
|
|`readNWISdv` | `Common 3`, parameter code, statCd | NWIS daily data with `Common` query |
|
|
|
|`readNWISqw` | `Common 3`, parameter code, expanded | NWIS water quality data with `Common` query |
|
|
|
|`readNWISuv` | `Common 3`, parameter code | NWIS instantaneous data with `Common` query |
|
|
|
|`readNWISpCode` | parameterCd | NWIS parameter code information |
|
|
|
|`readNWISgwl` | `Common 3` | NWIS groundwater level data with `Common` query |
|
|
|
|`readNWISpeak` | `Common 3` | NWIS peak flow data with `Common` query |
|
|
|
|`readNWISmeas` | `Common 3` | NWIS surface-water measurement data with `Common` query |
|
|
|
|`readNWISrating` | siteNumber, type | NWIS rating table for an active USGS streamgage |
|
|
|
|`readNWISsite` | siteNumber | NWIS site information |
|
|
|
|`whatNWISsites` | `...` | NWIS site search using user-specified queries |
|
|
|
|`whatNWISdata` | siteNumber, service | NWIS data availability, including period of record and count |
|
|
|
|`readWQPdata` | `...` | WQP data using user-specified queries |
|
|
|
|`readWQPqw` | `Common 3` | WQP data with `Common 3` query and either parameter code or characteristic name|
|
|
|
|`whatWQPsites` | `...` | WQP site search using user-specified queries |
|
|
|
|
|
|
R package for data retrieval of water quality and hydrology data. This package was designed to integrate with the `EGRET` package. Please visit the `EGRET` wiki for more information:
|
|
|
[EGRET Wiki](https://github.com/USGS-R/EGRET/wiki)
|
|
|
* `Common 3` = siteNumber, startDate, endDate
|
|
|
|
|
|
## Functions Overview
|
|
|
Moving `EGRET` specific functions to `EGRET` (version 2.0.0 and greater):
|
|
|
|
|
|
|
|
|
|Information Source | Site Query | Meta Data | Data |
|
|
|
|Information Source | Meta Data | Data |
|
|
|
| -------------| -------------| ------------- |:-------------|
|
|
|
|NWIS | `getNWISSites` | `getNWISInfo`* | `getNWISData` |
|
|
|
| | `getNWISDataAvailability` | `getNWISSiteInfo` | `getNWISDaily`* |
|
|
|
| | | `getNWISPcodeInfo` | `getNWISSample`* |
|
|
|
| | | | `getNWISdvData` |
|
|
|
| | | | `getNWISunitData` |
|
|
|
| | | | `getNWISqwData` |
|
|
|
| Water Quality Portal | `getWQPSites` | `getWQPInfo`* | `getWQPSample`* |
|
|
|
| | | | `getWQPqwData` |
|
|
|
| | | | `getWQPData` |
|
|
|
| User-supplied files | | `getUserInfo`* | `getUserDaily`* |
|
|
|
| | | | `getUserSample`* |
|
|
|
|NWIS | `getNWISInfo` | `getNWISSample` |
|
|
|
| | | `getNWISDaily` |
|
|
|
| Water Quality Portal | `getWQPInfo`| `getWQPSample` |
|
|
|
| User-supplied files | `getUserInfo` | `getUserDaily`|
|
|
|
| | | `getUserSample` |
|
|
|
|
|
|
`* Designed specifically to provide dataframes suitable for use by the `EGRET` package.
|
|
|
|
|
|
|
|
|
##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 Installation
|
|
|
To install the dataRetrieval package, you must be using R 3.0 or greater and run the following command:
|
|
|
|
|
|
install.packages("dataRetrieval",
|
|
|
repos=c("http://usgs-r.github.com","http://cran.us.r-project.org"),
|
|
|
dependencies=TRUE,
|
|
|
type="both")
|
|
|
|
|
|
```R
|
|
|
install.packages("dataRetrieval")
|
|
|
```
|
|
|
|
|
|
##Version updates
|
|
|
---------------
|
|
|
###dataRetrieval 1.4.0-in developement
|
|
|
Changed naming convention:
|
|
|
|
|
|
###dataRetrieval 2.0.0
|
|
|
|
|
|
* Changing naming convention. Migrated `EGRET` specific retrievals to `EGRET`
|
|
|
* Added back WaterML2 parsing tool
|
|
|
* Added specific groundwater, rating, peak, and surfacewater measurement functions
|
|
|
* Attached metadata attributes to returned dataframes
|
|
|
|
|
|
|Original Name | New Name |
|
|
|
| ------------- |:-------------|
|
|
|
|getDVData | getNWISDaily |
|
|
|
|getSampleData | getNWISSample |
|
|
|
|getSTORETData* | getWQPSample |
|
|
|
|getSampleDataFromFile | getUserSample |
|
|
|
|getDailyDataFromFile | getUserDaily |
|
|
|
|getMetaData | splits into getNWISInfo and getUserInfo |
|
|
|
|getSiteFileData | getNWISSiteInfo |
|
|
|
|getParameterInfo | getNWISPcodeInfo |
|
|
|
|getDataAvailability | getNWISDataAvailability |
|
|
|
|'retrieve' functions | 'get' |
|
|
|
|
|
|
Changed WaterML2 rbind fill from plyr function to dplyr. Removed plyr import, added dplyr.
|
|
|
###dataRetrieval 1.4.0
|
|
|
* Changed naming convention:
|
|
|
|
|
|
|
|
|
|
... | ... | @@ -71,13 +78,13 @@ Changed WaterML2 rbind fill from plyr function to dplyr. Removed plyr import, ad |
|
|
* Updated getNWISSiteInfo to retrieve multiple site file datasets at once using a vector of siteNumbers as input argument.
|
|
|
* Updated error-handling for Web service calls. More information is returned when errors happen
|
|
|
* Added some basic processing to Water Quality Portal raw data retrievals. Date columns are returned as Date objects, value columns are numeric, and a column is created from the date/time/timezone columns that is POSIXct.
|
|
|
* Added very generalized NWIS and WQP retrieval functions (getNWISData, getNWISSites, getGeneralWQPData, and getWQPSites) which allow the user to use any argument available on the Web service platform.
|
|
|
* Added very generalized NWIS and WQP retrieval functions (getNWISData, getNWISSites, getGeneralWQPData, and whatWQPsites) which allow the user to use any argument available on the Web service platform.
|
|
|
|
|
|
|
|
|
###dataRetrieval 1.3.2
|
|
|
|
|
|
* Deprecated getQWData, updated getWQPData to take either parameter code or characteristic name.
|
|
|
* Changed the name of raw data retrievals to: getNWISqwData, getNWISunitData, getNWISdvData, and getWQPqwData (from: getNWISqwData, retrieveUnitNWISData, retrieveNWISData, getRawQWData)
|
|
|
* Deprecated getQWData, updated readWQPdata to take either parameter code or characteristic name.
|
|
|
* Changed the name of raw data retrievals to: readNWISqw, getNWISunitData, getNWISdvData, and getWQPqwData (from: readNWISqw, retrieveUnitNWISData, retrieveNWISData, getRawQWData)
|
|
|
* Added NA warning to getDVData function
|
|
|
* Updated mergeReport to allow for Sample data with different measurements taken on the same day
|
|
|
|
... | ... | @@ -85,19 +92,13 @@ Changed WaterML2 rbind fill from plyr function to dplyr. Removed plyr import, ad |
|
|
##Sample Workflow
|
|
|
|
|
|
Load data from web services:
|
|
|
|
|
|
```R
|
|
|
library(dataRetrieval)
|
|
|
Daily <- getNWISDaily("06934500","00060","1979-10-01","2010-09-30")
|
|
|
Sample <-getNWISSample("06934500","00631","1970-10-01","2011-09-30")
|
|
|
INFO <-getNWISInfo("06934500","00631", interactive=FALSE)
|
|
|
Sample <-mergeReport(Daily, Sample)
|
|
|
|
|
|
|
|
|
##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.
|
|
|
```
|
|
|
|
|
|
##Disclaimer
|
|
|
This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the [official USGS copyright policy](http://www.usgs.gov/visual-id/credit_usgs.html#copyright/ "official USGS copyright policy")
|
... | ... | |