Commit 805fb9cd authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #275 from ldecicco-USGS/master

update version
parents 9c00e516 047bb460
Package: dataRetrieval
Type: Package
Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data
Version: 2.5.12
Date: 2016-08-08
Version: 2.6.0
Date: 2016-08-26
Authors@R: c( person("Robert", "Hirsch", role = c("aut"),
email = "rhirsch@usgs.gov"),
person("Laura", "DeCicco", role = c("aut","cre"),
......@@ -13,7 +13,7 @@ Authors@R: c( person("Robert", "Hirsch", role = c("aut"),
email = "jread@usgs.gov"),
person("Lindsay","Carr", role=c("ctb"),
email = "lcarr@usgs.gov"),
person("David","Watkins", role=c("ctb"),
person("David","Watkins", role=c("aut"),
email = "wwatkins@usgs.gov"))
Description: Collection of functions to help retrieve U.S. Geological Survey
(USGS) and U.S. Environmental Protection Agency (EPA) water quality and
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/readNGWMNdata.R
\name{readNGWMNlevels}
\alias{readNGWMNlevels}
\title{Retrieve groundwater levels from the National Ground Water Monitoring Network \url{http://cida.usgs.gov/ngwmn/}.}
\usage{
readNGWMNlevels(featureID)
}
\arguments{
\item{featureID}{character Vector of feature IDs in the formatted with agency code and site number
separated by a period, e.g. \code{USGS.404159100494601}.}
}
\description{
Retrieve groundwater levels from the National Ground Water Monitoring Network \url{http://cida.usgs.gov/ngwmn/}.
}
\examples{
\dontrun{
#one site
site <- "USGS.430427089284901"
oneSite <- readNGWMNlevels(featureID = site)
#multiple sites
sites <- c("USGS.272838082142201","USGS.404159100494601", "USGS.401216080362703")
multiSiteData <- readNGWMNlevels(sites)
#non-USGS site
site <- "MBMG.892195"
data <- readNGWMNlevels(featureID = site)
#site with no data returns empty data frame
noDataSite <- "UTGS.401544112060301"
noDataSite <- readNGWMNlevels(featureID = noDataSite)
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/readNGWMNdata.R
\name{readNGWMNsites}
\alias{readNGWMNsites}
\title{Retrieve site data from the National Ground Water Monitoring Network \url{http://cida.usgs.gov/ngwmn/}.}
\usage{
readNGWMNsites(featureID)
}
\arguments{
\item{featureID}{character Vector of feature IDs in the formatted with agency code and site number
separated by a period, e.g. \code{USGS.404159100494601}.}
}
\value{
A data frame the following columns:
#' \tabular{lll}{
Name \tab Type \tab Description \cr
site \tab char \tab Site FID \cr
description \tab char \tab Site description \cr
dec_lat_va, dec_lon_va \tab numeric \tab Site latitude and longitude \cr
}
}
\description{
Retrieve site data from the National Ground Water Monitoring Network \url{http://cida.usgs.gov/ngwmn/}.
}
\examples{
\dontrun{
#one site
site <- "USGS.430427089284901"
oneSite <- readNGWMNsites(featureID = site)
#multiple sites
sites <- c("USGS.272838082142201","USGS.404159100494601", "USGS.401216080362703")
multiSiteInfo <- readNGWMNsites(sites)
#non-USGS site
site <- "MBMG.892195"
siteInfo <- readNGWMNsites(featureID = site)
}
}
......@@ -6,24 +6,29 @@ test_that("General NWIS retrievals working", {
multiSite <- readNWISdata(sites=c("04025500","040263491"), service="iv",
parameterCd="00060")
expect_is(multiSite$dateTime, 'POSIXct')
# saveRDS(multiSite, "rds/multiSite.rds")
bBoxEx <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010")
expect_that(length(unique(bBoxEx$site_no)) > 1, is_true())
# saveRDS(bBoxEx, "rds/bBoxEx.rds")
startDate <- as.Date("2013-10-01")
endDate <- as.Date("2014-09-30")
waterYear <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010",
service="dv", startDate=startDate, endDate=endDate)
# saveRDS(waterYear, "rds/waterYear.rds")
expect_is(waterYear$dateTime, 'POSIXct')
siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",hasDataTypeCd="iv",
service="site")
# saveRDS(siteInfo,"rds/siteInfo.rds")
expect_is(siteInfo$station_nm, "character")
qwData <- readNWISdata(bBox=c(-82.5,41.52,-81,41),startDate=as.Date("2000-01-01"),
drain_area_va_min=50, qw_count_nu=50,qw_attributes="expanded",
qw_sample_wide="wide",list_of_search_criteria=c("lat_long_bounding_box",
"drain_area_va","obs_count_nu"),service="qw")
# saveRDS(qwData, "rds/qwData.rds")
expect_is(qwData$startDateTime, "POSIXct")
url <- "http://waterservices.usgs.gov/nwis/dv/?site=09037500&format=rdb&ParameterCd=00060&StatCd=00003&startDT=1985-10-02&endDT=2012-09-06"
......@@ -31,15 +36,18 @@ test_that("General NWIS retrievals working", {
urlEmpty <- "http://nwis.waterdata.usgs.gov/nwis/qwdata?multiple_site_no=413437087150601&sort_key=site_no&group_key=NONE&inventory_output=0&begin_date=&end_date=&TZoutput=0&param_group=NUT,INN&qw_attributes=0&format=rdb&qw_sample_wide=0&rdb_qw_attributes=expanded&date_format=YYYY-MM-DD&rdb_compression=value&list_of_search_criteria=multiple_site_no"
dv <- importRDB1(urlEmpty, asDateTime = FALSE)
# saveRDS(dv, "rds/emptyDV.rds")
expect_that(nrow(dv) == 0, is_true())
dailyStat <- readNWISdata(site=c("03112500","03111520"),service="stat",statReportType="daily",
statType=c("p25","p50","p75","min","max"),parameterCd="00065",convertType=FALSE)
# saveRDS(dailyStat,"rds/dailyStat.rds")
expect_that(length(dailyStat$min_va) > 1, is_true())
expect_is(dailyStat$p25_va,"character")
waterYearStat <- readNWISdata(site=c("03112500"),service="stat",statReportType="annual",
statYearType="water", missingData="on")
# saveRDS(waterYearStat, "rds/waterYearStat.rds")
expect_is(waterYearStat$mean_va,"numeric")
expect_is(waterYearStat$parameter_cd,"character")
})
......
......@@ -66,7 +66,7 @@ test_that("CRAN-friendly importWaterML1 test", {
fileName <- "WaterML1Example.xml"
fullPath <- file.path(filePath, fileName)
importUserWML1 <- importWaterML1(fullPath, asDateTime = TRUE)
# saveRDS(importUserWML1, "rds/importUserWML1.rds")
# default is to turn dates to characters
expect_is(importUserWML1$dateTime, 'POSIXct')
......@@ -83,6 +83,7 @@ test_that("External importWaterML1 test", {
obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv')
data <- importWaterML1(obs_url,TRUE)
# saveRDS(data, "rds/dvWML1.rds")
expect_is(data$dateTime, 'POSIXct')
groundWaterSite <- "431049071324301"
......@@ -91,6 +92,7 @@ test_that("External importWaterML1 test", {
groundwaterExampleURL <- constructNWISURL(groundWaterSite, NA,
startGW,endGW, service="gwlevels")
groundWater <- importWaterML1(groundwaterExampleURL)
# saveRDS(groundWater, "rds/groundwater.rds")
expect_is(groundWater$dateTime, 'character')
......@@ -103,6 +105,7 @@ test_that("External importWaterML1 test", {
siteNumber <- c('01480015',"04085427") #one site seems to have lost it's 2nd dd
obs_url <- constructNWISURL(siteNumber,c("00060","00010"),startDate,endDate,'dv')
data <- importWaterML1(obs_url)
# saveRDS(data, "rds/twoWML1.rds")
expect_that(length(unique(data$site_no)) == 2, is_true())
expect_that(ncol(data) == 8, is_true()) # 3 data, 3 remark codes, and 4 (agency, site, dateTime, tz)
......@@ -114,6 +117,7 @@ test_that("External importWaterML1 test", {
inactiveAndActive <- c("07334200","05212700")
inactiveAndActive <- constructNWISURL(inactiveAndActive, "00060", "2014-01-01", "2014-01-10",'dv')
inactiveAndActive <- importWaterML1(inactiveAndActive)
# saveRDS(inactiveAndActive, "rds/inactiveAndActive.rds")
expect_that(length(unique(inactiveAndActive$site_no)) == 1, is_true())
#raw XML
......@@ -138,23 +142,28 @@ test_that("External importWaterML1 test", {
})
context("importWaterML2")
test_that("importWaterML2 internal test", {
filePath <- system.file("extdata", package="dataRetrieval")
fileName <- "WaterML2Example.xml"
fullPath <- file.path(filePath, fileName)
UserData <- importWaterML2(fullPath)
# saveRDS(UserData, "rds/UserData.rds")
expect_is(UserData$value, 'numeric')
expect_is(UserData$qualifier, 'character')
})
test_that("importWaterML2 external test", {
testthat::skip_on_cran()
url <- "http://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&sites=01646500&parameterCd=00060,00065"
data <- importWaterML2(url)
# saveRDS(data, "rds/externalML2.rds")
expect_is(data$value, 'numeric')
expect_gt(nrow(data),0)
})
})
context("importWQP_noCRAN")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment