Commit 969200ec authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Helps with #495.

parent 4bca2ae9
Package: dataRetrieval
Type: Package
Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data
Version: 2.7.5.9000
Version: 2.7.5.9001
Authors@R: c(
person("Laura", "DeCicco", role = c("aut","cre"),
email = "ldecicco@usgs.gov",
......
dataRetrieval 2.7.6
==================
* Adjusted Water Quality Portal (WPQ) URLs to follow new structure
* Fixed bug where some WQP results were being duplicated
* Added an argument to readWQPdata to ignore fetching site and parameter attributes.
dataRetrieval 2.7.5
==========
* Fixed some time zone joining bugs that were happening if the timezone column had no information in the first ~100 returned rows.
......
......@@ -11,6 +11,7 @@
#' "America/Anchorage", as well as the following which do not use daylight savings time: "America/Honolulu",
#' "America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla". See also \code{OlsonNames()}
#' for more information on time zones.
#' @param ignore_attributes logical to choose to ignore fetching site and parameter attributes. Default is \code{FALSE}.
#' @keywords data import WQP web service
#' @return A data frame with at least the following columns:
#' \tabular{lll}{
......@@ -135,7 +136,7 @@
#' parameterCd = "00010")
#'
#' }
readWQPdata <- function(..., querySummary=FALSE, tz="UTC"){
readWQPdata <- function(..., querySummary=FALSE, tz="UTC", ignore_attributes = FALSE){
tz <- match.arg(tz, OlsonNames())
......@@ -156,12 +157,8 @@ readWQPdata <- function(..., querySummary=FALSE, tz="UTC"){
retval <- importWQP(urlCall, zip= values["zip"] == "yes", tz=tz)
if(!all(is.na(retval))){
if(!all(is.na(retval)) & !ignore_attributes){
# When POST is working:
# site_list <- unique(retval$MonitoringLocationIdentifier)
# siteInfo <- whatWQPsites(siteid=site_list, zip="yes")
#
siteInfo <- whatWQPsites(...)
siteInfoCommon <- data.frame(station_nm=siteInfo$MonitoringLocationName,
......@@ -203,10 +200,14 @@ readWQPdata <- function(..., querySummary=FALSE, tz="UTC"){
attr(retval, "url") <- urlCall
attr(retval, "queryTime") <- Sys.time()
return(retval)
} else {
message("The following url returned no data:\n")
message(urlCall)
return(NULL)
}
return(retval)
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
\alias{readWQPdata}
\title{General Data Import from Water Quality Portal}
\usage{
readWQPdata(..., querySummary = FALSE, tz = "UTC")
readWQPdata(..., querySummary = FALSE, tz = "UTC", ignore_attributes = FALSE)
}
\arguments{
\item{\dots}{see \url{https://www.waterqualitydata.us/webservices_documentation} for a complete list of options. A list of arguments can also be supplied.}
......@@ -17,6 +17,8 @@ Possible values to provide are "America/New_York","America/Chicago", "America/De
"America/Anchorage", as well as the following which do not use daylight savings time: "America/Honolulu",
"America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla". See also \code{OlsonNames()}
for more information on time zones.}
\item{ignore_attributes}{logical to choose to ignore fetching site and parameter attributes. Default is \code{FALSE}.}
}
\value{
A data frame with at least the following columns:
......
......@@ -180,6 +180,8 @@ test_that("General WQP retrievals working", {
expect_equal(attr(site1, "url"), "https://www.waterqualitydata.us/data/summary/monitoringLocation/search?siteid=USGS-07144100&summaryYears=5&dataProfile=periodOfRecord&zip=yes&mimeType=csv")
wqp.summary_no_atts <- readWQPdata(args_2, ignore_attributes = TRUE)
expect_true(!all(c("siteInfo","variableInfo") %in% names(attributes(wqp.summary_no_atts))))
})
test_that("WQP head query retrievals working", {
......
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