Commit 4692758d authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

single pcodes are different

parent 6177e51f
......@@ -34,10 +34,10 @@ readNWISpCode <- function(parameterCd){
parameterCd <- parameterCd[!is.na(parameterCd)]
baseURL <- drURL("pCode", Access=pkg.env$access)
fullURL <- paste0(baseURL, "fmt=rdb&group_cd=%")
if(any(parameterCd == "all")){
temp_df <- importRDB1(fullURL, asDateTime = FALSE)
parameterData <- data.frame(
parameter_cd = temp_df$parm_cd,
......@@ -54,7 +54,12 @@ readNWISpCode <- function(parameterCd){
parameterData <- parameterCdFile[parameterCdFile$parameter_cd %in% parameterCd,]
if(nrow(parameterData) != length(parameterCd)){
if(nrow(parameterData) > 0){
parameterCd <- parameterCd[!parameterCd %in% unique(parameterData$parameter_cd)]
}
if(length(parameterCd) == 1){
baseURL <- drURL("pCodeSingle", Access=pkg.env$access)
subURL <- paste0(baseURL, "fmt=rdb&parm_nm_cd=", parameterCd)
temp_df <- importRDB1(subURL, asDateTime = FALSE)
parameterData <- data.frame(
......
......@@ -53,6 +53,7 @@ setAccess = function(access="public"){
pkg.env$stat = "https://waterservices.usgs.gov/nwis/stat/"
pkg.env$useNat = "https://waterdata.usgs.gov/nwis/water_use"
pkg.env$pCode = "https://help.waterdata.usgs.gov/code/parameter_cd_query"
pkg.env$pCodeSingle = "https://help.waterdata.usgs.gov/code/parameter_cd_nm_query"
# NOTE: state water use are still in: constructUseURL
pkg.env$Result = "https://www.waterqualitydata.us/data/Result/search"
......
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