diff --git a/DESCRIPTION b/DESCRIPTION index 7e1a44c0c193fb35847d5e44fa7e75419007c950..2cb835c55feef7d2a57e4f93c0bb73e54619f86b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: dataRetrieval Type: Package Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data -Version: 2.0.1.9000 +Version: 2.0.1 Date: 2014-12-02 Authors@R: c( person("Robert", "Hirsch", role = c("aut"), email = "rhirsch@usgs.gov"), diff --git a/R/constructNWISURL.r b/R/constructNWISURL.r index 0294adb8dcb78eb8ec8c89b9f68b7e5c31288115..36508f022e00e0bfed004b0af40a9e8fcc2acb3e 100644 --- a/R/constructNWISURL.r +++ b/R/constructNWISURL.r @@ -6,8 +6,10 @@ #' #' @param siteNumber string or vector of strings USGS site number. This is usually an 8 digit number #' @param parameterCd string or vector of USGS parameter code. This is usually an 5 digit number. -#' @param startDate string starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate string ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @param statCd string or vector USGS statistic code only used for daily value service. This is usually 5 digits. Daily mean (00003) is the default. #' @param service string USGS service to call. Possible values are "dv" (daily values), "uv" (unit/instantaneous values), #' "qw" (water quality data), "gwlevels" (groundwater),and "rating" (rating curve), "peak", "meas" (discrete streamflow measurements). @@ -224,8 +226,10 @@ constructNWISURL <- function(siteNumber,parameterCd="00060",startDate="",endDate #' #' @param siteNumber string or vector of strings USGS site number. This is usually an 8 digit number #' @param parameterCd string or vector of USGS parameter code. This is usually an 5 digit number. -#' @param startDate string starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate string ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @keywords data import WQP web service #' @return url string #' @export @@ -242,7 +246,7 @@ constructWQPURL <- function(siteNumber,parameterCd,startDate,endDate){ multipleSites <- length(siteNumber) > 1 multiplePcodes <- length(parameterCd)>1 - siteNumber <- paste(siteNumber, collapse=",") + siteNumber <- paste(siteNumber, collapse=";") if(all(nchar(parameterCd) == 5)){ suppressWarnings(pCodeLogic <- all(!is.na(as.numeric(parameterCd)))) diff --git a/R/importWQP.R b/R/importWQP.R index 12a585b3e40225ef85c0e40d4d1efdbbbb376182..d02e5dc246204adccbf1d9e0df8d84e23583cf3a 100644 --- a/R/importWQP.R +++ b/R/importWQP.R @@ -9,7 +9,7 @@ #' Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles", #' "America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla" #' @return retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for -#' start and end times. +#' start and end times, and converted to UTC. See \url{http://www.waterqualitydata.us/portal_userguide.jsp} for more information. #' @export #' @seealso \code{\link{readWQPdata}}, \code{\link{readWQPqw}}, \code{\link{whatWQPsites}} #' @import RCurl @@ -109,13 +109,15 @@ importWQP <- function(url, zip=FALSE, tz=""){ retval$ActivityStartDateTime <- with(retval, as.POSIXct(paste(ActivityStartDate, ActivityStartTime.Time),format="%Y-%m-%d %H:%M:%S", tz = "UTC")) retval$ActivityStartDateTime <- retval$ActivityStartDateTime + timeZoneStart*60*60 retval$ActivityStartDateTime <- as.POSIXct(retval$ActivityStartDateTime) + attr(retval$ActivityStartDateTime, "tzone") <- "UTC" } if(any(!is.na(timeZoneEnd))){ retval$ActivityEndDateTime <- with(retval, as.POSIXct(paste(ActivityEndDate, ActivityEndTime.Time),format="%Y-%m-%d %H:%M:%S", tz = "UTC")) retval$ActivityEndDateTime <- retval$ActivityEndDateTime + timeZoneEnd*60*60 - retval$ActivityEndDateTime <- as.POSIXct(retval$ActivityEndDateTime) + retval$ActivityEndDateTime <- as.POSIXct(retval$ActivityEndDateTime) + attr(retval$ActivityEndDateTime, "tzone") <- "UTC" } if(all(is.na(retval$ActivityEndDateTime))){ diff --git a/R/readNWISdv.r b/R/readNWISdv.r index 883682c4de29868291247bca31ed697c81ebc2bf..14a5f30b22a5d8f36c58c8455f371633751f0741 100644 --- a/R/readNWISdv.r +++ b/R/readNWISdv.r @@ -6,15 +6,17 @@ #' #' @param siteNumber character USGS site number. This is usually an 8 digit number. Multiple sites can be requested with a character vector. #' @param parameterCd character of USGS parameter code(s). This is usually an 5 digit number. -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @param statCd character USGS statistic code. This is usually 5 digits. Daily mean (00003) is the default. #' @return A data frame with the following columns: #' \tabular{lll}{ #' Name \tab Type \tab Description \cr #' agency \tab character \tab The NWIS code for the agency reporting the data\cr #' site \tab character \tab The USGS site number \cr -#' datetime \tab Date \tab The date of the value \cr +#' Date \tab Date \tab The date of the value \cr #' code \tab character \tab Any codes that qualify the corresponding value\cr #' value \tab numeric \tab The numeric value for the parameter \cr #' } @@ -66,6 +68,8 @@ readNWISdv <- function (siteNumber,parameterCd,startDate="",endDate="",statCd="0 if(nrow(data)>0){ data$dateTime <- as.Date(data$dateTime) data$tz_cd <- NULL + data$Date <- data$dateTime + data$dateTime <- NULL } diff --git a/R/readNWISqw.r b/R/readNWISqw.r index a743b9926414d9066b1a0c8ca209e33f1797566a..454f60d76970c50435d208aaf4dff38d963cb104 100644 --- a/R/readNWISqw.r +++ b/R/readNWISqw.r @@ -4,10 +4,12 @@ #' A list of parameter codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/pmcodes/} #' A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table} #' -#' @param siteNumber character of USGS site numbers. This is usually an 8 digit number +#' @param siteNumbers character of USGS site numbers. This is usually an 8 digit number #' @param pCodes character of USGS parameter code(s). This is usually an 5 digit number. -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @param expanded logical defaults to TRUE. If TRUE, retrieves additional information. Expanded data includes #' remark_cd (remark code), result_va (result value), val_qual_tx (result value qualifier code), meth_cd (method code), #' dqi_cd (data-quality indicator code), rpt_lev_va (reporting level), and rpt_lev_cd (reporting level type). @@ -41,21 +43,19 @@ #' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, #' \code{\link{readWQPqw}}, \code{\link{constructNWISURL}} #' @examples -#' siteNumber <- c('04024430','04024000') +#' siteNumbers <- c('04024430','04024000') #' startDate <- '2010-01-01' #' endDate <- '' #' pCodes <- c('34247','30234','32104','34220') #' -#' rawNWISqwData <- readNWISqw(siteNumber,pCodes,startDate,endDate) -#' rawNWISqwDataExpandReshaped <- readNWISqw(siteNumber,pCodes, -#' startDate,endDate,expanded=TRUE) -#' rawNWISqwDataExpand <- readNWISqw(siteNumber,pCodes, -#' startDate,endDate,expanded=TRUE,reshape=FALSE) +#' rawNWISqwData <- readNWISqw(siteNumbers,pCodes,startDate,endDate) +#' rawNWISqwDataReshaped <- readNWISqw(siteNumbers,pCodes, +#' startDate,endDate,reshape=TRUE) #' -readNWISqw <- function (siteNumber,pCodes,startDate="",endDate="", +readNWISqw <- function (siteNumbers,pCodes,startDate="",endDate="", expanded=TRUE,reshape=FALSE,tz=""){ - url <- constructNWISURL(siteNumber,pCodes,startDate,endDate,"qw",expanded=expanded) + url <- constructNWISURL(siteNumbers,pCodes,startDate,endDate,"qw",expanded=expanded) data <- importRDB1(url,asDateTime=TRUE, qw=TRUE, tz = tz) originalHeader <- comment(data) @@ -75,7 +75,7 @@ readNWISqw <- function (siteNumber,pCodes,startDate="",endDate="", } - siteInfo <- readNWISsite(siteNumber) + siteInfo <- readNWISsite(siteNumbers) varInfo <- readNWISpCode(pCodes) attr(data, "siteInfo") <- siteInfo diff --git a/R/readNWISsite.r b/R/readNWISsite.r index 087182d3fe7ab69a36ef04a010e10906e7490a71..aa69f3dfad960fa897ce045a094faa438b4b477d 100644 --- a/R/readNWISsite.r +++ b/R/readNWISsite.r @@ -9,12 +9,47 @@ #' Name \tab Type \tab Description \cr #' agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr #' site_no \tab character \tab The USGS site number \cr +#' station_nm \tab character \tab Site name \cr +#' site_tp_cd \tab character \tab Site type \cr +#' lat_va \tab numeric \tab DMS latitude \cr +#' long_va \tab numeric \tab DMS longitude \cr +#' dec_lat_va \tab numeric \tab Decimal latitude \cr +#' dec_long_va \tab numeric \tab Decimal longitude \cr +#' coord_meth_cd \tab character \tab Latitude-longitude method \cr +#' coord_acy_cd \tab character \tab Latitude-longitude accuracy \cr +#' coord_datum_cd \tab character \tab Latitude-longitude datum \cr +#' dec_coord_datum_cd \tab character \tab Decimal Latitude-longitude datum \cr +#' district_cd \tab character \tab District code \cr +#' state_cd \tab character \tab State code \cr +#' county_cd \tab character \tab County code \cr +#' country_cd \tab character \tab Country code \cr +#' land_net_ds \tab character \tab Land net location description \cr +#' map_nm \tab character \tab Name of location map \cr +#' map_scale_fc \tab character \tab Scale of location map \cr +#' alt_va \tab numeric \tab Altitude of Gage/land surface \cr +#' alt_meth_cd \tab character \tab Method altitude determined \cr +#' alt_acy_va \tab numeric \tab Altitude accuracy \cr +#' alt_datum_cd \tab character \tab Altitude datum \cr +#' huc_cd \tab character \tab Hydrologic unit code \cr +#' basin_cd \tab character \tab Drainage basin code \cr +#' topo_cd \tab character \tab Topographic setting code \cr +#' instruments_cd \tab character \tab Flags for instruments at site \cr +#' construction_dt \tab character \tab Date of first construction \cr +#' inventory_dt \tab character \tab Date site established or inventoried \cr +#' drain_area_va \tab numeric \tab Drainage area \cr +#' contrib_drain_area_va \tab numeric \tab Contributing drainage area \cr +#' tz_cd \tab character \tab Time Zone abbreviation \cr +#' local_time_fg \tab character \tab Site honors Daylight Savings Time \cr +#' reliability_cd \tab character \tab Data reliability code \cr +#' gw_file_cd \tab character \tab Data-other GW files \cr +#' nat_aqfr_cd \tab character \tab National aquifer code \cr +#' aqfr_cd \tab character \tab Local aquifer code \cr +#' aqfr_type_cd \tab character \tab Local aquifer type code \cr +#' well_depth_va \tab numeric \tab Well depth \cr +#' hole_depth_va \tab numeric \tab Hole depth \cr +#' depth_src_cd \tab character \tab Source of depth data \cr +#' project_no \tab character \tab Project number \cr #' } -#' Note that code and value are repeated for the parameters requested. The names are of the form -#' XD_P_S, where X is literal, -#' D is an option description of the parameter, -#' P is the parameter code, -#' and S is the statistic code (if applicable). #' #' There are also several useful attributes attached to the data frame: #' \tabular{lll}{ @@ -23,7 +58,6 @@ #' queryTime \tab POSIXct \tab The time the data was returned \cr #' comment \tab character \tab Header comments from the RDB file \cr #' } - #' @export #' @examples #' # These examples require an internet connection to run diff --git a/R/readNWISunit.r b/R/readNWISunit.r index 0a1a274b25033b14c127aad076f5ffb863e34456..0c9603c4889d128e7d7894c9f5eda53b450f7953 100644 --- a/R/readNWISunit.r +++ b/R/readNWISunit.r @@ -2,12 +2,15 @@ #' #' Imports data from NWIS web service. This function gets the data from here: \url{http://waterservices.usgs.gov/} #' A list of parameter codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/pmcodes/} -#' A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table} +#' A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table}. +#' More information on the web service can be found here: \url{http://waterservices.usgs.gov/rest/IV-Service.html}. #' #' @param siteNumbers character USGS site number (or multiple sites). This is usually an 8 digit number #' @param parameterCd character USGS parameter code. This is usually an 5 digit number. -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @param tz character to set timezone attribute of dateTime. Default is an empty quote, which converts the #' dateTimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column). #' Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles", @@ -63,21 +66,30 @@ readNWISuv <- function (siteNumbers,parameterCd,startDate="",endDate="", tz=""){ #' Reads peak flow data from NWISweb. #' -#' +#' Reads peak flow from NWISweb. +#' Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. #' #' @param siteNumber character USGS site number. This is usually an 8 digit number -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @return A data frame with the following columns: #' \tabular{lll}{ #' Name \tab Type \tab Description \cr #' agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr #' site_no \tab character \tab The USGS site number \cr -#' dateTime \tab POSIXct \tab The date and time of the value converted to UTC (if asDateTime = TRUE), \cr -#' \tab character \tab or raw character string (if asDateTime = FALSE) \cr -#' tz_cd \tab character \tab The time zone code for dateTime \cr -#' code \tab character \tab Any codes that qualify the corresponding value\cr -#' value \tab numeric \tab The numeric value for the parameter \cr +#' peak_dt \tab Date \tab Date of peak streamflow \cr +#' peak_tm \tab character \tab Time of peak streamflow as character \cr +#' peak_va \tab numeric \tab Annual peak streamflow value in cfs \cr +#' peak_cd \tab character \tab Peak Discharge-Qualification codes (see \code{comment} for more information) \cr +#' gage_ht \tab numeric \tab Gage height for the associated peak streamflow in feet \cr +#' gage_ht_cd \tab character \tab Gage height qualification codes \cr +#' year_last_pk \tab character \tab Peak streamflow reported is the highest since this year \cr +#' ag_dt \tab character \tab Date of maximum gage-height for water year (if not concurrent with peak) \cr +#' ag_tm \tab character \tab Time of maximum gage-height for water year (if not concurrent with peak) \cr +#' ag_gage_ht \tab character \tab maximum Gage height for water year in feet (if not concurrent with peak) \cr +#' ag_gage_ht_cd \tab character \tab maximum Gage height code \cr #' } #' #' There are also several useful attributes attached to the data frame: @@ -98,6 +110,10 @@ readNWISpeak <- function (siteNumber,startDate="",endDate=""){ url <- constructNWISURL(siteNumber,NA,startDate,endDate,"peak") data <- importRDB1(url, asDateTime=FALSE) + + data$peak_dt <- as.Date(data$peak_dt) + data$gage_ht <- as.numeric(data$gage_ht) + siteInfo <- readNWISsite(siteNumber) attr(data, "siteInfo") <- siteInfo @@ -109,7 +125,8 @@ readNWISpeak <- function (siteNumber,startDate="",endDate=""){ #' Reads the current rating table for an active USGS streamgage. #' -#' +#' Reads current rating table for an active USGS streamgage from NWISweb. +#' Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. #' #' @param siteNumber character USGS site number. This is usually an 8 digit number #' @param type character can be "base", "corr", or "exsa" @@ -155,11 +172,14 @@ readNWISrating <- function (siteNumber,type="base"){ #'Reads surface-water measurement data from NWISweb. #' -#' +#'Reads surface-water measurement data from NWISweb. Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. +#'See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. #' #' @param siteNumber character USGS site number. This is usually an 8 digit number -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @param tz character to set timezone attribute of dateTime. Default is an empty quote, which converts the #' dateTimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column). #' Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles", @@ -172,7 +192,9 @@ readNWISrating <- function (siteNumber,type="base"){ #' tz_cd \tab character \tab The time zone code for dateTime \cr #' } #' -#' See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. +#' See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water, and +#' \url{http://waterdata.usgs.gov/nwis/help?output_formats_help#streamflow_measurement_data} +#' for help on the columns and codes. #' #' There are also several useful attributes attached to the data frame: #' \tabular{lll}{ @@ -210,18 +232,24 @@ readNWISmeas <- function (siteNumber,startDate="",endDate="", tz=""){ #' #' Reads groundwater level measurements from NWISweb. Mixed date/times come back from the service #' depending on the year that the data was collected. See \url{http://waterdata.usgs.gov/usa/nwis/gw} -#' for details about groundwater -#' +#' for details about groundwater. Groundwater dates and times are returned in many different formats, therefore the +#' date/time information is returned as a character string. Users will need to convert to a date object. +#' See \url{http://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information. +#' #' @param siteNumbers character USGS site number (or multiple sites). This is usually an 8 digit number -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @return A data frame with the following columns: #' \tabular{lll}{ #' Name \tab Type \tab Description \cr #' agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr #' site_no \tab character \tab The USGS site number \cr #' dateTime \tab character \tab The date and time of the value as a character \cr -#' tz_cd \tab character \tab The time zone code for dateTime \cr +#' dateTimeAccuracyCd \tab character \tab Information on the date/time accuracy \cr +#' censorCode \tab character \tab Censoring information \cr +#' sourceCode \tab character \tab Information on source of the data \cr #' code \tab character \tab Any codes that qualify the corresponding value\cr #' value \tab numeric \tab The numeric value for the parameter \cr #' } @@ -252,6 +280,7 @@ readNWISgwl <- function (siteNumbers,startDate="",endDate=""){ url <- constructNWISURL(siteNumbers,NA,startDate,endDate,"gwlevels",format="wml1") data <- importWaterML1(url,asDateTime=FALSE) + data$tz_cd <- NULL return (data) } diff --git a/R/readWQPdata.R b/R/readWQPdata.R index 50b1a52e6a2cdfe1df4cacc4dc9c762030ab2394..66c56e0ce2515ee52fff56e86d263a8910b108c4 100644 --- a/R/readWQPdata.R +++ b/R/readWQPdata.R @@ -5,8 +5,85 @@ #' #' @param \dots see \url{www.waterqualitydata.us/webservices_documentation.jsp} for a complete list of options #' @keywords data import WQP web service -#' @return retval dataframe with first column dateTime, and at least one qualifier and value columns -#' (subsequent qualifier/value columns could follow depending on requested parameter codes) +#' @return A data frame with at least the following columns: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context.\cr +#' OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization.\cr +#' ActivityIdentifier \tab character \tab Designator that uniquely identifies an activity within an organization.\cr +#' ActivityTypeCode \tab character \tab The text describing the type of activity.\cr +#' ActivityMediaName \tab character \tab Name or code indicating the environmental medium where the sample was taken.\cr +#' ActivityMediaSubdivisionName \tab character \tab Name or code indicating the environmental matrix as a subdivision of the sample media.\cr +#' ActivityStartDate \tab character \tab The calendar date on which the field activity is started.\cr +#' ActivityStartTime/Time \tab character \tab The time of day that is reported when the field activity began, based on a 24-hour timescale.\cr +#' ActivityStartTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +#' ActivityEndDate \tab character \tab The calendar date when the field activity is completed.\cr +#' ActivityEndTime/Time \tab character \tab The time of day that is reported when the field activity ended, based on a 24-hour timescale.\cr +#' ActivityEndTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +#' ActivityDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the vertical location (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ActivityDepthAltitudeReferencePointText \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of an activity.\cr +#' ActivityTopDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the upper vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityTopDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityTopDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ActivityBottomDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the lower vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityBottomDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityBottomDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ProjectIdentifier \tab character \tab A designator used to uniquely identify a data collection project within a context of an organization.\cr +#' ActivityConductingOrganizationText \tab character \tab A name of the Organization conducting an activity.\cr +#' MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location.\cr +#' ActivityCommentText \tab character \tab General comments concerning the activity.\cr +#' SampleAquifer * \tab character \tab A code that designates the aquifer associated with groundwater samples.\cr +#' HydrologicCondition * \tab character \tab Hydrologic condition is the hydrologic condition that is represented by the sample collected (i.e. ? normal, falling, rising, peak stage).\cr +#' HydrologicEvent * \tab character \tab A hydrologic event that is represented by the sample collected (i.e. - storm, drought, snowmelt).\cr +#' SampleCollectionMethod/MethodIdentifier\tab character \tab The identification number or code assigned by the method publisher.\cr +#' SampleCollectionMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +#' SampleCollectionMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +#' SampleCollectionEquipmentName \tab character \tab The name for the equipment used in collecting the sample.\cr +#' ResultDetectionConditionText \tab character \tab The textual descriptor of a result.\cr +#' CharacteristicName \tab character \tab The object, property, or substance which is evaluated or enumerated by either a direct field measurement, a direct field observation, or by laboratory analysis of material collected in the field.\cr +#' ResultSampleFractionText \tab character \tab The text name of the portion of the sample associated with results obtained from a physically-partitioned sample.\cr +#' ResultMeasureValue \tab numeric \tab The reportable measure of the result for the chemical, microbiological or other characteristic being analyzed. Measure value is given in the units stored in ResultMeasure/MeasureUnitCode.\cr +#' MeasureQualifierCode \tab character \tab A code used to identify any qualifying issues that affect the results.\cr +#' ResultMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ResultStatusIdentifier \tab character \tab Indicates the acceptability of the result with respect to QA/QC criteria.\cr +#' StatisticalBaseCode \tab character \tab The code for the method used to calculate derived results.\cr +#' ResultValueTypeName \tab character \tab A name that qualifies the process which was used in the determination of the result value (e.g., actual, estimated, calculated).\cr +#' ResultWeightBasisText \tab character \tab The name that represents the form of the sample or portion of the sample which is associated with the result value (e.g., wet weight, dry weight, ash-free dry weight).\cr +#' ResultTimeBasisText \tab character \tab The period of time (in days) over which a measurement was made. For example, BOD can be measured as 5 day or 20 day BOD.\cr +#' ResultTemperatureBasisText \tab character \tab The name that represents the controlled temperature at which the sample was maintained during analysis, e.g. 25 deg BOD analysis.\cr +#' ResultParticleSizeBasisText \tab character \tab User defined free text describing the particle size class for which the associated result is defined.\cr +#' PrecisionValue \tab character \tab A measure of mutual agreement among individual measurements of the same property usually under prescribed similar conditions.\cr +#' ResultCommentText \tab character \tab Free text with general comments concerning the result.\cr +#' USGSPCode * \tab character \tab 5-digit number used in the US Geological Survey computerized data system, National Water Information System (NWIS), to uniquely identify a specific constituent.\cr +#' ResultDepthHeightMeasure/MeasureValue + \tab character \tab A measurement of the vertical location (measured from a reference point) at which a result occurred.\cr +#' ResultDepthHeightMeasure/MeasureUnitCode + \tab character \tab The code that represents the unit for measuring the item.\cr +#' ResultDepthAltitudeReferencePointText + \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of a result.\cr +#' SubjectTaxonomicName \tab character \tab The name of the organism from which a tissue sample was taken.\cr +#' SampleTissueAnatomyName * \tab character \tab The name of the anatomy from which a tissue sample was taken.\cr +#' ResultAnalyticalMethod/MethodIdentifier \tab character \tab The identification number or code assigned by the method publisher.\cr +#' ResultAnalyticalMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +#' ResultAnalyticalMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +#' MethodDescriptionText * \tab character \tab A brief summary that provides general information about the method.\cr +#' LaboratoryName \tab character \tab The name of Lab responsible for the result.\cr +#' AnalysisStartDate \tab character \tab The calendar date on which the analysis began.\cr +#' ResultLaboratoryCommentText \tab character \tab Remarks which further describe the laboratory procedures which produced the result.\cr +#' DetectionQuantitationLimitTypeName \tab character \tab Text describing the type of detection or quantitation level used in the analysis of a characteristic.\cr +#' DetectionQuantitationLimitMeasure/MeasureValue \tab numeric \tab Constituent concentration that, when processed through the complete method, produces a signal that is statistically different from a blank. Measure value is given in the units stored in DetectionQuantitationLimitMeasure/MeasureUnitCode.\cr +#' DetectionQuantitationLimitMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' PreparationStartDate \tab character \tab The calendar date when the preparation/extraction of the sample for analysis began.\cr +#' ActivityStartDateTime \tab POSIXct \tab Activity start date and time converted to POSIXct UTC.\cr +#' ActivityEndDateTime \tab POSIXct \tab Activity end date and time converted to POSIXct UTC.\cr +#' } +#' * = elements only in NWIS +#' + = elements only in STORET +#' +#' There are also several useful attributes attached to the data frame: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' url \tab character \tab The url used to generate the data \cr +#' siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr +#' variableInfo \tab data.frame \tab A data frame containing information on the requested parameters \cr +#' queryTime \tab POSIXct \tab The time the data was returned \cr +#' } #' @export #' @examples #' \dontrun{ diff --git a/R/readWQPqw.r b/R/readWQPqw.r index c8eba4366a956f35b0dda288ffc08446b037081f..cf87ac9f1a6503f5f492ab0fb20ef4bcad4981b6 100644 --- a/R/readWQPqw.r +++ b/R/readWQPqw.r @@ -7,26 +7,106 @@ #' either USGS, or other Water Quality Portal offered sites. It is required to use the 'full' #' site name, such as 'USGS-01234567'. #' -#' @param siteNumber character site number. This needs to include the full agency code prefix. +#' @param siteNumbers character site number. This needs to include the full agency code prefix. #' @param parameterCd vector of USGS 5-digit parameter code or characteristicNames. #' Leaving this blank will return all of the measured values during the specified time period. -#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. -#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. +#' @param startDate character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the earliest possible record. +#' @param endDate character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +#' retrieval for the latest possible record. #' @keywords data import USGS web service -#' @return retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for -#' start and end times. +#' @return A data frame with at least the following columns: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context.\cr +#' OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization.\cr +#' ActivityIdentifier \tab character \tab Designator that uniquely identifies an activity within an organization.\cr +#' ActivityTypeCode \tab character \tab The text describing the type of activity.\cr +#' ActivityMediaName \tab character \tab Name or code indicating the environmental medium where the sample was taken.\cr +#' ActivityMediaSubdivisionName \tab character \tab Name or code indicating the environmental matrix as a subdivision of the sample media.\cr +#' ActivityStartDate \tab character \tab The calendar date on which the field activity is started.\cr +#' ActivityStartTime/Time \tab character \tab The time of day that is reported when the field activity began, based on a 24-hour timescale.\cr +#' ActivityStartTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +#' ActivityEndDate \tab character \tab The calendar date when the field activity is completed.\cr +#' ActivityEndTime/Time \tab character \tab The time of day that is reported when the field activity ended, based on a 24-hour timescale.\cr +#' ActivityEndTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +#' ActivityDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the vertical location (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ActivityDepthAltitudeReferencePointText \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of an activity.\cr +#' ActivityTopDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the upper vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityTopDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityTopDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ActivityBottomDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the lower vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityBottomDepthHeightMeasure/MeasureUnitCode.\cr +#' ActivityBottomDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ProjectIdentifier \tab character \tab A designator used to uniquely identify a data collection project within a context of an organization.\cr +#' ActivityConductingOrganizationText \tab character \tab A name of the Organization conducting an activity.\cr +#' MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location.\cr +#' ActivityCommentText \tab character \tab General comments concerning the activity.\cr +#' SampleAquifer * \tab character \tab A code that designates the aquifer associated with groundwater samples.\cr +#' HydrologicCondition * \tab character \tab Hydrologic condition is the hydrologic condition that is represented by the sample collected (i.e. ? normal, falling, rising, peak stage).\cr +#' HydrologicEvent * \tab character \tab A hydrologic event that is represented by the sample collected (i.e. - storm, drought, snowmelt).\cr +#' SampleCollectionMethod/MethodIdentifier\tab character \tab The identification number or code assigned by the method publisher.\cr +#' SampleCollectionMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +#' SampleCollectionMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +#' SampleCollectionEquipmentName \tab character \tab The name for the equipment used in collecting the sample.\cr +#' ResultDetectionConditionText \tab character \tab The textual descriptor of a result.\cr +#' CharacteristicName \tab character \tab The object, property, or substance which is evaluated or enumerated by either a direct field measurement, a direct field observation, or by laboratory analysis of material collected in the field.\cr +#' ResultSampleFractionText \tab character \tab The text name of the portion of the sample associated with results obtained from a physically-partitioned sample.\cr +#' ResultMeasureValue \tab numeric \tab The reportable measure of the result for the chemical, microbiological or other characteristic being analyzed. Measure value is given in the units stored in ResultMeasure/MeasureUnitCode.\cr +#' MeasureQualifierCode \tab character \tab A code used to identify any qualifying issues that affect the results.\cr +#' ResultMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' ResultStatusIdentifier \tab character \tab Indicates the acceptability of the result with respect to QA/QC criteria.\cr +#' StatisticalBaseCode \tab character \tab The code for the method used to calculate derived results.\cr +#' ResultValueTypeName \tab character \tab A name that qualifies the process which was used in the determination of the result value (e.g., actual, estimated, calculated).\cr +#' ResultWeightBasisText \tab character \tab The name that represents the form of the sample or portion of the sample which is associated with the result value (e.g., wet weight, dry weight, ash-free dry weight).\cr +#' ResultTimeBasisText \tab character \tab The period of time (in days) over which a measurement was made. For example, BOD can be measured as 5 day or 20 day BOD.\cr +#' ResultTemperatureBasisText \tab character \tab The name that represents the controlled temperature at which the sample was maintained during analysis, e.g. 25 deg BOD analysis.\cr +#' ResultParticleSizeBasisText \tab character \tab User defined free text describing the particle size class for which the associated result is defined.\cr +#' PrecisionValue \tab character \tab A measure of mutual agreement among individual measurements of the same property usually under prescribed similar conditions.\cr +#' ResultCommentText \tab character \tab Free text with general comments concerning the result.\cr +#' USGSPCode * \tab character \tab 5-digit number used in the US Geological Survey computerized data system, National Water Information System (NWIS), to uniquely identify a specific constituent.\cr +#' ResultDepthHeightMeasure/MeasureValue + \tab character \tab A measurement of the vertical location (measured from a reference point) at which a result occurred.\cr +#' ResultDepthHeightMeasure/MeasureUnitCode + \tab character \tab The code that represents the unit for measuring the item.\cr +#' ResultDepthAltitudeReferencePointText + \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of a result.\cr +#' SubjectTaxonomicName \tab character \tab The name of the organism from which a tissue sample was taken.\cr +#' SampleTissueAnatomyName * \tab character \tab The name of the anatomy from which a tissue sample was taken.\cr +#' ResultAnalyticalMethod/MethodIdentifier \tab character \tab The identification number or code assigned by the method publisher.\cr +#' ResultAnalyticalMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +#' ResultAnalyticalMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +#' MethodDescriptionText * \tab character \tab A brief summary that provides general information about the method.\cr +#' LaboratoryName \tab character \tab The name of Lab responsible for the result.\cr +#' AnalysisStartDate \tab character \tab The calendar date on which the analysis began.\cr +#' ResultLaboratoryCommentText \tab character \tab Remarks which further describe the laboratory procedures which produced the result.\cr +#' DetectionQuantitationLimitTypeName \tab character \tab Text describing the type of detection or quantitation level used in the analysis of a characteristic.\cr +#' DetectionQuantitationLimitMeasure/MeasureValue \tab numeric \tab Constituent concentration that, when processed through the complete method, produces a signal that is statistically different from a blank. Measure value is given in the units stored in DetectionQuantitationLimitMeasure/MeasureUnitCode.\cr +#' DetectionQuantitationLimitMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +#' PreparationStartDate \tab character \tab The calendar date when the preparation/extraction of the sample for analysis began.\cr +#' ActivityStartDateTime \tab POSIXct \tab Activity start date and time converted to POSIXct UTC.\cr +#' ActivityEndDateTime \tab POSIXct \tab Activity end date and time converted to POSIXct UTC.\cr +#' } +#' * = elements only in NWIS +#' + = elements only in STORET +#' +#' There are also several useful attributes attached to the data frame: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' url \tab character \tab The url used to generate the data \cr +#' siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr +#' variableInfo \tab data.frame \tab A data frame containing information on the requested parameters \cr +#' queryTime \tab POSIXct \tab The time the data was returned \cr +#' } #' @export -#' @import RCurl #' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, #' \code{\link{readNWISqw}}, and \code{\link{importWQP}} #' @examples #' \dontrun{ #' rawPcode <- readWQPqw('USGS-01594440','01075', '', '') #' rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '') +#' rawPHsites <- readWQPqw(c('USGS-05406450', 'USGS-05427949','WIDNR_WQX-133040'), 'pH','','') +#' nwisEx <- readWQPqw('USGS-04024000',c('34247','30234','32104','34220'),'','') #' } -readWQPqw <- function(siteNumber,parameterCd,startDate="",endDate=""){ +readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){ - url <- constructWQPURL(siteNumber,parameterCd,startDate,endDate) + url <- constructWQPURL(siteNumbers,parameterCd,startDate,endDate) retval <- importWQP(url) pcodeCheck <- all(nchar(parameterCd) == 5) & all(!is.na(suppressWarnings(as.numeric(parameterCd)))) @@ -40,9 +120,11 @@ readWQPqw <- function(siteNumber,parameterCd,startDate="",endDate=""){ } if(pcodeCheck){ - siteInfo <- whatWQPsites(siteid=siteNumber, pCode=parameterCd, startDateLo=startDate, startDateHi=endDate) + siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,collapse=";"), + pCode=paste0(parameterCd,collapse=";"), startDateLo=startDate, startDateHi=endDate) } else { - siteInfo <- whatWQPsites(siteid=siteNumber, characteristicName=parameterCd, startDateLo=startDate, startDateHi=endDate) + siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,collapse=";"), + characteristicName=paste0(parameterCd,collapse=";"), startDateLo=startDate, startDateHi=endDate) } siteInfoCommon <- data.frame(station_nm=siteInfo$MonitoringLocationName, diff --git a/R/tabbedDataRetrievals.R b/R/tabbedDataRetrievals.R index 38e79cf6d415a427e639b8dd59147fd1ef4e28fd..7c63acf4dcda39ee968d316b87908b078db9d79d 100644 --- a/R/tabbedDataRetrievals.R +++ b/R/tabbedDataRetrievals.R @@ -4,7 +4,7 @@ #' Package: \tab dataRetrieval\cr #' Type: \tab Package\cr #' Version: \tab 2.0.1\cr -#' Date: \tab 2014-11-24\cr +#' Date: \tab 2014-12-02\cr #' License: \tab Unlimited for this package, dependencies have more restrictive licensing.\cr #' Copyright: \tab This software is in the public domain because it contains materials #' that originally came from the United States Geological Survey, an agency of diff --git a/R/whatNWISData.r b/R/whatNWISData.r index 933147d95c67ebb2efb707a63a527bbdbc5a57da..7d32e365e3993e9ff290394bc6335df15f62c6eb 100644 --- a/R/whatNWISData.r +++ b/R/whatNWISData.r @@ -12,9 +12,48 @@ #' @param parameterCd character vector of valid parameter codes to return. Defaults to "all" which will not perform a filter. #' @param statCd character vector of all statistic codes to return. Defaults to "all" which will not perform a filter. #' @keywords data import USGS web service -#' @return retval dataframe with all information found in the expanded site file +#' @return A data frame with the following columns: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr +#' site_no \tab character \tab The USGS site number \cr +#' station_nm \tab character \tab Site name \cr +#' site_tp_cd \tab character \tab Site type \cr +#' dec_lat_va \tab numeric \tab Decimal latitude\cr +#' dec_long_va \tab numeric \tab Decimal longitude \cr +#' coord_acy_cd \tab character \tab Latitude-longitude accuracy \cr +#' dec_coord_datum_cd \tab character \tab Decimal Latitude-longitude datum \cr +#' alt_va \tab character \tab Altitude of Gage or land surface \cr +#' alt_acy_va \tab character \tab Altitude accuracy \cr +#' alt_datum_cd \tab character \tab Altitude datum \cr +#' huc_cd \tab character \tab Hydrologic unit code \cr +#' data_type_cd \tab character \tab Data type \cr +#' parm_cd \tab character \tab Parameter code \cr +#' stat_cd \tab character \tab Statistical code \cr +#' dd_nu \tab character \tab Internal database key \cr +#' loc_web_ds \tab character \tab Additional measurement description \cr +#' medium_grp_cd \tab character \tab Medium group code \cr +#' parm_grp_cd \tab character \tab Parameter group code \cr +#' srs_id \tab character \tab SRS ID \cr +#' access_cd \tab character \tab Access code \cr +#' begin_date \tab Date \tab Begin date \cr +#' end_date \tab Date \tab End date \cr +#' count_nu \tab integer \tab Record count\cr +#' parameter_group_nm \tab character \tab Parameter group name \cr +#' parameter_nm \tab character \tab Parameter name \cr +#' casrn \tab character \tab Chemical Abstracts Service (CAS) Registry Number \cr +#' srsname \tab character \tab Substance Registry Services \cr +#' parameter_units \tab character \tab Parameter units \cr +#' } +#' +#' There are also several useful attributes attached to the data frame: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' url \tab character \tab The url used to generate the data \cr +#' comment \tab character \tab Header comments from the RDB file \cr +#' queryTime \tab POSIXct \tab The time the data was returned \cr +#' } #' @export -#' @import RCurl #' @import lubridate #' @examples #' \dontrun{ diff --git a/R/whatNWISsites.R b/R/whatNWISsites.R index 9fefc9dca1f0718da2ad66ff9e41dd727b1d23df..6870bc15e5ea22f2c05799e1d2cb12fac38a239b 100644 --- a/R/whatNWISsites.R +++ b/R/whatNWISsites.R @@ -6,7 +6,24 @@ #' #' @param \dots see \url{http://waterservices.usgs.gov/rest/Site-Service.html#Service} for a complete list of options #' @keywords data import NWIS web service -#' @return retval dataframe with agency_cd, site_no, station_nm, site_tp_cd, dec_lat_va, and dec_long_va. +#' @return A data frame with at least the following columns: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr +#' site_no \tab character \tab The USGS site number \cr +#' station_nm \tab character \tab Station name \cr +#' site_tp_cd \tab character \tab Site type code \cr +#' dec_lat_va \tab numeric \tab Decimal latitude \cr +#' dec_long_va \tab numeric \tab Decimal longitude \cr +#' queryTime \tab POSIXct \tab Query time \cr +#' } +#' +#' There are also several useful attributes attached to the data frame: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' url \tab character \tab The url used to generate the data \cr +#' queryTime \tab POSIXct \tab The time the data was returned \cr +#' } #' @export #' @import XML #' @examples diff --git a/R/whatWQPsites.R b/R/whatWQPsites.R index a027b6e23132127e822f1da611ad8cee40f62634..ecbaaa00d92c71fa36fd9e4bd828ab8aad8388b3 100644 --- a/R/whatWQPsites.R +++ b/R/whatWQPsites.R @@ -5,8 +5,48 @@ #' #' @param \dots see \url{www.waterqualitydata.us/webservices_documentation.jsp} for a complete list of options #' @keywords data import WQP web service -#' @return retval dataframe with first column dateTime, and at least one qualifier and value columns -#' (subsequent qualifier/value columns could follow depending on requested parameter codes) +#' @return A data frame with at least the following columns: +#' \tabular{lll}{ +#' Name \tab Type \tab Description \cr +#' OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context. \cr +#' OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization. \cr +#' MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location. \cr +#' MonitoringLocationName \tab character \tab The designator specified by the sampling organization for the site at which sampling or other activities are conducted. \cr +#' MonitoringLocationTypeName \tab character \tab The descriptive name for a type of monitoring location. \cr +#' MonitoringLocationDescriptionText \tab character \tab Text description of the monitoring location. \cr +#' HUCEightDigitCode \tab character \tab The 8 digit federal code used to identify the hydrologic unit of the monitoring location to the cataloging unit level of precision. \cr +#' DrainageAreaMeasure/MeasureValue * \tab character \tab The drainage basin of a lake, stream, wetland, or estuary site. Measure value is given in the units stored in DrainageAreaMeasure/MeasureUnitCode. \cr +#' DrainageAreaMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' ContributingDrainageAreaMeasure/MeasureValue * \tab character \tab The contributing drainage area of a lake, stream, wetland, or estuary site. Measure value is given in the units stored in ContributingDrainageAreaMeasure/MeasureUnitCode. \cr +#' ContributingDrainageAreaMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' LatitudeMeasure \tab numeric \tab The measure of the angular distance on a meridian north or south of the equator. \cr +#' LongitudeMeasure \tab numeric \tab The measure of the angular distance on a meridian east or west of the prime meridian. \cr +#' SourceMapScaleNumeric \tab character \tab The number that represents the proportional distance on the ground for one unit of measure on the map or photo. \cr +#' HorizontalAccuracyMeasure/MeasureValue * \tab character \tab The horizontal measure of the relative accuracy of the latitude and longitude coordinates." Measure value is given in the units stored in HorizontalAccuracyMeasure/MeasureUnitCode. \cr +#' HorizontalAccuracyMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' HorizontalCollectionMethodName \tab character \tab The name that identifies the method used to determine the latitude and longitude coordinates for a point on the earth. \cr +#' HorizontalCoordinateReferenceSystemDatumName \tab character \tab The name that describes the reference datum used in determining latitude and longitude coordinates. \cr +#' VerticalMeasure/MeasureValue \tab character \tab The measure of elevation (i.e., the altitude), above or below a reference datum. Measure value is given in the units stored in VerticalMeasure/MeasureUnitCode. \cr +#' VerticalMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item. \cr +#' VerticalAccuracyMeasure/MeasureValue * \tab character \tab The vertical measure of the relative accuracy of the latitude and longitude coordinates. Measure value is given in the units stored in VerticalAccuracyMeasure/MeasureUnitCode. \cr +#' VerticalAccuracyMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' VerticalCollectionMethodName \tab character \tab The name that identifies the method used to collect the vertical measure (i.e. the altitude) of a reference point. \cr +#' VerticalCoordinateReferenceSystemDatumName \tab character \tab The name of the reference datum used to determine the vertical measure (i.e., the altitude). \cr +#' CountryCode \tab character \tab A code designator used to identify a primary geopolitical unit of the world. \cr +#' StateCode \tab character \tab A code designator used to identify a principal administrative subdivision of the United States, Canada, or Mexico. \cr +#' CountyCode \tab character \tab A code designator used to identify a U.S. county or county equivalent. \cr +#' AquiferName * \tab character \tab Name of the aquifer in which the well is completed. \cr +#' FormationTypeText * \tab character \tab Name of the primary formation or soils unit, in which the well is completed. \cr +#' AquiferTypeName * \tab character \tab The type of aquifer, such as confined or unconfined. \cr +#' ConstructionDateText * \tab character \tab Date of construction when well was completed. May be year only. \cr +#' WellDepthMeasure/MeasureValue * \tab character \tab Depth below land surface datum (LSD) to the bottom of the hole on completion of drilling. Measure value is given in the units stored in WellDepthMeasure/MeasureUnitCode. \cr +#' WellDepthMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' WellHoleDepthMeasure/MeasureValue * \tab character \tab Depth below land surface datum (LSD) to the bottom of the hole on completion of drilling. Measure value is given in the units stored in WellHoleDepthMeasure/MeasureUnitCode. \cr +#' WellHoleDepthMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +#' queryTime \tab POSIXct \tab Query time \cr +#' } +#' * element is only in NWIS +#' #' @export #' @examples #' \dontrun{ diff --git a/inst/doc/dataRetrieval.R b/inst/doc/dataRetrieval.R index 6363b6804ed7642c1b05742cbf708e2b395037e8..670c0c6f0b94640261a0c7c24071a4e8319ff8bc 100644 --- a/inst/doc/dataRetrieval.R +++ b/inst/doc/dataRetrieval.R @@ -178,10 +178,10 @@ siteInfo <- attr(temperatureAndFlow, "siteInfo") par(mar=c(5,5,5,5)) #sets the size of the plot window -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Wtemp_Max, +plot(temperatureAndFlow$Date, temperatureAndFlow$Wtemp_Max, ylab=variableInfo$parameter_desc[1],xlab="" ) par(new=TRUE) -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Flow, +plot(temperatureAndFlow$Date, temperatureAndFlow$Flow, col="red",type="l",xaxt="n",yaxt="n",xlab="",ylab="",axes=FALSE ) axis(4,col="red",col.axis="red") diff --git a/inst/doc/dataRetrieval.Rnw b/inst/doc/dataRetrieval.Rnw index c73b1725a638e4dbc17aaa8ddb3997b87fb7aafb..9217883b755135a0ad613a6c786b03cd23c01b98 100644 --- a/inst/doc/dataRetrieval.Rnw +++ b/inst/doc/dataRetrieval.Rnw @@ -532,10 +532,10 @@ siteInfo <- attr(temperatureAndFlow, "siteInfo") par(mar=c(5,5,5,5)) #sets the size of the plot window -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Wtemp_Max, +plot(temperatureAndFlow$Date, temperatureAndFlow$Wtemp_Max, ylab=variableInfo$parameter_desc[1],xlab="" ) par(new=TRUE) -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Flow, +plot(temperatureAndFlow$Date, temperatureAndFlow$Flow, col="red",type="l",xaxt="n",yaxt="n",xlab="",ylab="",axes=FALSE ) axis(4,col="red",col.axis="red") diff --git a/inst/doc/dataRetrieval.pdf b/inst/doc/dataRetrieval.pdf index f0a880e77aaa60d3902122a04571c1c05935d22c..44fc4372d3c5fc365fe3015378f6ffeafd342034 100644 Binary files a/inst/doc/dataRetrieval.pdf and b/inst/doc/dataRetrieval.pdf differ diff --git a/man/constructNWISURL.Rd b/man/constructNWISURL.Rd index aa476f3a36533cd1cb4e9999b4503252696e35ee..8f39fcb721a8f221bd45bf64e7a2b75f04baa904 100644 --- a/man/constructNWISURL.Rd +++ b/man/constructNWISURL.Rd @@ -12,9 +12,11 @@ constructNWISURL(siteNumber, parameterCd = "00060", startDate = "", \item{parameterCd}{string or vector of USGS parameter code. This is usually an 5 digit number.} -\item{startDate}{string starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{string ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} \item{service}{string USGS service to call. Possible values are "dv" (daily values), "uv" (unit/instantaneous values), "qw" (water quality data), "gwlevels" (groundwater),and "rating" (rating curve), "peak", "meas" (discrete streamflow measurements).} diff --git a/man/constructWQPURL.Rd b/man/constructWQPURL.Rd index 235ae77640290164cf54badbe40c2a2227dbf53b..507d2fa1bc56c4c78a5a22bb3623a36dd12199cf 100644 --- a/man/constructWQPURL.Rd +++ b/man/constructWQPURL.Rd @@ -10,9 +10,11 @@ constructWQPURL(siteNumber, parameterCd, startDate, endDate) \item{parameterCd}{string or vector of USGS parameter code. This is usually an 5 digit number.} -\item{startDate}{string starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{string ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} } \value{ url string diff --git a/man/importWQP.Rd b/man/importWQP.Rd index aaa844df5ea1ee2cb83d02dde41918fe3022ccdb..c5880afd4462a43961eb699b7ffb9fa7535d89f7 100644 --- a/man/importWQP.Rd +++ b/man/importWQP.Rd @@ -17,7 +17,7 @@ Possible values to provide are "America/New_York","America/Chicago", "America/De } \value{ retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for -start and end times. +start and end times, and converted to UTC. See \url{http://www.waterqualitydata.us/portal_userguide.jsp} for more information. } \description{ Imports data from the Water Quality Portal based on a specified url. diff --git a/man/readNWISdv.Rd b/man/readNWISdv.Rd index a3d718bcc38df6ae64f8f63971466d029426f95c..fa2e63659908fbdbd0c5f872589286392aa2d9c0 100644 --- a/man/readNWISdv.Rd +++ b/man/readNWISdv.Rd @@ -11,9 +11,11 @@ readNWISdv(siteNumber, parameterCd, startDate = "", endDate = "", \item{parameterCd}{character of USGS parameter code(s). This is usually an 5 digit number.} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} \item{statCd}{character USGS statistic code. This is usually 5 digits. Daily mean (00003) is the default.} } @@ -23,7 +25,7 @@ A data frame with the following columns: Name \tab Type \tab Description \cr agency \tab character \tab The NWIS code for the agency reporting the data\cr site \tab character \tab The USGS site number \cr -datetime \tab Date \tab The date of the value \cr +Date \tab Date \tab The date of the value \cr code \tab character \tab Any codes that qualify the corresponding value\cr value \tab numeric \tab The numeric value for the parameter \cr } diff --git a/man/readNWISgwl.Rd b/man/readNWISgwl.Rd index cb2fac55e6eba02e804bd6ce33088d561b72f7e4..b44e9e1be4a7e02dc271649814fefc2b661a81f0 100644 --- a/man/readNWISgwl.Rd +++ b/man/readNWISgwl.Rd @@ -8,9 +8,11 @@ readNWISgwl(siteNumbers, startDate = "", endDate = "") \arguments{ \item{siteNumbers}{character USGS site number (or multiple sites). This is usually an 8 digit number} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} } \value{ A data frame with the following columns: @@ -19,7 +21,9 @@ Name \tab Type \tab Description \cr agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr site_no \tab character \tab The USGS site number \cr dateTime \tab character \tab The date and time of the value as a character \cr -tz_cd \tab character \tab The time zone code for dateTime \cr +dateTimeAccuracyCd \tab character \tab Information on the date/time accuracy \cr +censorCode \tab character \tab Censoring information \cr +sourceCode \tab character \tab Information on source of the data \cr code \tab character \tab Any codes that qualify the corresponding value\cr value \tab numeric \tab The numeric value for the parameter \cr } @@ -42,7 +46,9 @@ queryTime \tab POSIXct \tab The time the data was returned \cr \description{ Reads groundwater level measurements from NWISweb. Mixed date/times come back from the service depending on the year that the data was collected. See \url{http://waterdata.usgs.gov/usa/nwis/gw} -for details about groundwater +for details about groundwater. Groundwater dates and times are returned in many different formats, therefore the +date/time information is returned as a character string. Users will need to convert to a date object. +See \url{http://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information. } \examples{ siteNumber <- "434400121275801" diff --git a/man/readNWISmeas.Rd b/man/readNWISmeas.Rd index 688300e50ada1ed98782c419f0677da8adfebe10..7cb0b8b1fd6f4c3f5bb87d657800f739cafb3e12 100644 --- a/man/readNWISmeas.Rd +++ b/man/readNWISmeas.Rd @@ -8,9 +8,11 @@ readNWISmeas(siteNumber, startDate = "", endDate = "", tz = "") \arguments{ \item{siteNumber}{character USGS site number. This is usually an 8 digit number} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} \item{tz}{character to set timezone attribute of dateTime. Default is an empty quote, which converts the dateTimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column). @@ -26,7 +28,9 @@ site_no \tab character \tab The USGS site number \cr tz_cd \tab character \tab The time zone code for dateTime \cr } -See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. +See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water, and +\url{http://waterdata.usgs.gov/nwis/help?output_formats_help#streamflow_measurement_data} +for help on the columns and codes. There are also several useful attributes attached to the data frame: \tabular{lll}{ @@ -38,7 +42,8 @@ siteInfo \tab data.frame \tab A data frame containing information on the request } } \description{ -Reads surface-water measurement data from NWISweb. +Reads surface-water measurement data from NWISweb. Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. +See \url{http://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. } \examples{ siteNumber <- '01594440' diff --git a/man/readNWISpeak.Rd b/man/readNWISpeak.Rd index 8f8cf938f3e17dbc8f2090746a22e758d4589f1a..de3d4d82058caba21435f54e5d5aafee6eacf7e4 100644 --- a/man/readNWISpeak.Rd +++ b/man/readNWISpeak.Rd @@ -8,9 +8,11 @@ readNWISpeak(siteNumber, startDate = "", endDate = "") \arguments{ \item{siteNumber}{character USGS site number. This is usually an 8 digit number} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} } \value{ A data frame with the following columns: @@ -18,11 +20,17 @@ A data frame with the following columns: Name \tab Type \tab Description \cr agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr site_no \tab character \tab The USGS site number \cr -dateTime \tab POSIXct \tab The date and time of the value converted to UTC (if asDateTime = TRUE), \cr -\tab character \tab or raw character string (if asDateTime = FALSE) \cr -tz_cd \tab character \tab The time zone code for dateTime \cr -code \tab character \tab Any codes that qualify the corresponding value\cr -value \tab numeric \tab The numeric value for the parameter \cr +peak_dt \tab Date \tab Date of peak streamflow \cr +peak_tm \tab character \tab Time of peak streamflow as character \cr +peak_va \tab numeric \tab Annual peak streamflow value in cfs \cr +peak_cd \tab character \tab Peak Discharge-Qualification codes (see \code{comment} for more information) \cr +gage_ht \tab numeric \tab Gage height for the associated peak streamflow in feet \cr +gage_ht_cd \tab character \tab Gage height qualification codes \cr +year_last_pk \tab character \tab Peak streamflow reported is the highest since this year \cr +ag_dt \tab character \tab Date of maximum gage-height for water year (if not concurrent with peak) \cr +ag_tm \tab character \tab Time of maximum gage-height for water year (if not concurrent with peak) \cr +ag_gage_ht \tab character \tab maximum Gage height for water year in feet (if not concurrent with peak) \cr +ag_gage_ht_cd \tab character \tab maximum Gage height code \cr } There are also several useful attributes attached to the data frame: @@ -35,7 +43,8 @@ siteInfo \tab data.frame \tab A data frame containing information on the request } } \description{ -Reads peak flow data from NWISweb. +Reads peak flow from NWISweb. +Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. } \examples{ siteNumber <- '01594440' diff --git a/man/readNWISqw.Rd b/man/readNWISqw.Rd index d5cd2d317091838a96a2f21a1f4fa93c898d6924..1893caf7a14575c1cd34d3f6e447bc9241961b4c 100644 --- a/man/readNWISqw.Rd +++ b/man/readNWISqw.Rd @@ -3,17 +3,19 @@ \alias{readNWISqw} \title{Raw Data Import for USGS NWIS QW Data} \usage{ -readNWISqw(siteNumber, pCodes, startDate = "", endDate = "", +readNWISqw(siteNumbers, pCodes, startDate = "", endDate = "", expanded = TRUE, reshape = FALSE, tz = "") } \arguments{ -\item{siteNumber}{character of USGS site numbers. This is usually an 8 digit number} +\item{siteNumbers}{character of USGS site numbers. This is usually an 8 digit number} \item{pCodes}{character of USGS parameter code(s). This is usually an 5 digit number.} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} \item{expanded}{logical defaults to TRUE. If TRUE, retrieves additional information. Expanded data includes remark_cd (remark code), result_va (result value), val_qual_tx (result value qualifier code), meth_cd (method code), @@ -53,16 +55,14 @@ A list of parameter codes can be found here: \url{http://nwis.waterdata.usgs.gov A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table} } \examples{ -siteNumber <- c('04024430','04024000') +siteNumbers <- c('04024430','04024000') startDate <- '2010-01-01' endDate <- '' pCodes <- c('34247','30234','32104','34220') -rawNWISqwData <- readNWISqw(siteNumber,pCodes,startDate,endDate) -rawNWISqwDataExpandReshaped <- readNWISqw(siteNumber,pCodes, - startDate,endDate,expanded=TRUE) -rawNWISqwDataExpand <- readNWISqw(siteNumber,pCodes, - startDate,endDate,expanded=TRUE,reshape=FALSE) +rawNWISqwData <- readNWISqw(siteNumbers,pCodes,startDate,endDate) +rawNWISqwDataReshaped <- readNWISqw(siteNumbers,pCodes, + startDate,endDate,reshape=TRUE) } \seealso{ \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, diff --git a/man/readNWISrating.Rd b/man/readNWISrating.Rd index fe2e306e38e81c7f0824e883c6d0ec65f8a0c3d6..6a7a9608b7e6ca2e33e60e80f163037e55ad968c 100644 --- a/man/readNWISrating.Rd +++ b/man/readNWISrating.Rd @@ -23,7 +23,8 @@ If \code{type} is "base," then the data frame has an attribute called "RATING" that describes the rating curve is included. } \description{ -Reads the current rating table for an active USGS streamgage. +Reads current rating table for an active USGS streamgage from NWISweb. +Data is retrieved from \url{http://waterdata.usgs.gov/nwis}. } \note{ Not all active USGS streamgages have traditional rating curves that diff --git a/man/readNWISsite.Rd b/man/readNWISsite.Rd index fffc3dcbb55d8fe9d4fbbf97d12dab0b9a94bd46..e740573e6ba7fc41f473c77037dc5ff425e011a4 100644 --- a/man/readNWISsite.Rd +++ b/man/readNWISsite.Rd @@ -14,12 +14,47 @@ A data frame with at least the following columns: Name \tab Type \tab Description \cr agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr site_no \tab character \tab The USGS site number \cr + station_nm \tab character \tab Site name \cr + site_tp_cd \tab character \tab Site type \cr + lat_va \tab numeric \tab DMS latitude \cr + long_va \tab numeric \tab DMS longitude \cr + dec_lat_va \tab numeric \tab Decimal latitude \cr + dec_long_va \tab numeric \tab Decimal longitude \cr + coord_meth_cd \tab character \tab Latitude-longitude method \cr + coord_acy_cd \tab character \tab Latitude-longitude accuracy \cr + coord_datum_cd \tab character \tab Latitude-longitude datum \cr + dec_coord_datum_cd \tab character \tab Decimal Latitude-longitude datum \cr + district_cd \tab character \tab District code \cr + state_cd \tab character \tab State code \cr + county_cd \tab character \tab County code \cr + country_cd \tab character \tab Country code \cr + land_net_ds \tab character \tab Land net location description \cr + map_nm \tab character \tab Name of location map \cr + map_scale_fc \tab character \tab Scale of location map \cr + alt_va \tab numeric \tab Altitude of Gage/land surface \cr + alt_meth_cd \tab character \tab Method altitude determined \cr + alt_acy_va \tab numeric \tab Altitude accuracy \cr + alt_datum_cd \tab character \tab Altitude datum \cr + huc_cd \tab character \tab Hydrologic unit code \cr + basin_cd \tab character \tab Drainage basin code \cr + topo_cd \tab character \tab Topographic setting code \cr + instruments_cd \tab character \tab Flags for instruments at site \cr + construction_dt \tab character \tab Date of first construction \cr + inventory_dt \tab character \tab Date site established or inventoried \cr + drain_area_va \tab numeric \tab Drainage area \cr + contrib_drain_area_va \tab numeric \tab Contributing drainage area \cr + tz_cd \tab character \tab Time Zone abbreviation \cr + local_time_fg \tab character \tab Site honors Daylight Savings Time \cr + reliability_cd \tab character \tab Data reliability code \cr + gw_file_cd \tab character \tab Data-other GW files \cr + nat_aqfr_cd \tab character \tab National aquifer code \cr + aqfr_cd \tab character \tab Local aquifer code \cr + aqfr_type_cd \tab character \tab Local aquifer type code \cr + well_depth_va \tab numeric \tab Well depth \cr + hole_depth_va \tab numeric \tab Hole depth \cr + depth_src_cd \tab character \tab Source of depth data \cr + project_no \tab character \tab Project number \cr } -Note that code and value are repeated for the parameters requested. The names are of the form -XD_P_S, where X is literal, -D is an option description of the parameter, -P is the parameter code, -and S is the statistic code (if applicable). There are also several useful attributes attached to the data frame: \tabular{lll}{ diff --git a/man/readNWISuv.Rd b/man/readNWISuv.Rd index 900ebb0ebd730a674ff87dfbc1b4ace5a9088ee2..b8fbdcfd9a52d66298d458f9b1d3e80f44668a77 100644 --- a/man/readNWISuv.Rd +++ b/man/readNWISuv.Rd @@ -11,9 +11,11 @@ readNWISuv(siteNumbers, parameterCd, startDate = "", endDate = "", \item{parameterCd}{character USGS parameter code. This is usually an 5 digit number.} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} \item{tz}{character to set timezone attribute of dateTime. Default is an empty quote, which converts the dateTimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column). @@ -50,7 +52,8 @@ queryTime \tab POSIXct \tab The time the data was returned \cr \description{ Imports data from NWIS web service. This function gets the data from here: \url{http://waterservices.usgs.gov/} A list of parameter codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/pmcodes/} -A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table} +A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table}. +More information on the web service can be found here: \url{http://waterservices.usgs.gov/rest/IV-Service.html}. } \examples{ siteNumber <- '05114000' diff --git a/man/readWQPdata.Rd b/man/readWQPdata.Rd index 1896c1bda8ddf10c0607893d75d0c0ee7e25039a..4231bff4daf8c512a00b99bb46a3de563e09d657 100644 --- a/man/readWQPdata.Rd +++ b/man/readWQPdata.Rd @@ -9,8 +9,85 @@ readWQPdata(...) \item{\dots}{see \url{www.waterqualitydata.us/webservices_documentation.jsp} for a complete list of options} } \value{ -retval dataframe with first column dateTime, and at least one qualifier and value columns -(subsequent qualifier/value columns could follow depending on requested parameter codes) +A data frame with at least the following columns: +\tabular{lll}{ +Name \tab Type \tab Description \cr +OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context.\cr +OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization.\cr +ActivityIdentifier \tab character \tab Designator that uniquely identifies an activity within an organization.\cr +ActivityTypeCode \tab character \tab The text describing the type of activity.\cr +ActivityMediaName \tab character \tab Name or code indicating the environmental medium where the sample was taken.\cr +ActivityMediaSubdivisionName \tab character \tab Name or code indicating the environmental matrix as a subdivision of the sample media.\cr +ActivityStartDate \tab character \tab The calendar date on which the field activity is started.\cr +ActivityStartTime/Time \tab character \tab The time of day that is reported when the field activity began, based on a 24-hour timescale.\cr +ActivityStartTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +ActivityEndDate \tab character \tab The calendar date when the field activity is completed.\cr +ActivityEndTime/Time \tab character \tab The time of day that is reported when the field activity ended, based on a 24-hour timescale.\cr +ActivityEndTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +ActivityDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the vertical location (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityDepthHeightMeasure/MeasureUnitCode.\cr +ActivityDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ActivityDepthAltitudeReferencePointText \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of an activity.\cr +ActivityTopDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the upper vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityTopDepthHeightMeasure/MeasureUnitCode.\cr +ActivityTopDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ActivityBottomDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the lower vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityBottomDepthHeightMeasure/MeasureUnitCode.\cr +ActivityBottomDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ProjectIdentifier \tab character \tab A designator used to uniquely identify a data collection project within a context of an organization.\cr +ActivityConductingOrganizationText \tab character \tab A name of the Organization conducting an activity.\cr +MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location.\cr +ActivityCommentText \tab character \tab General comments concerning the activity.\cr +SampleAquifer * \tab character \tab A code that designates the aquifer associated with groundwater samples.\cr +HydrologicCondition * \tab character \tab Hydrologic condition is the hydrologic condition that is represented by the sample collected (i.e. ? normal, falling, rising, peak stage).\cr +HydrologicEvent * \tab character \tab A hydrologic event that is represented by the sample collected (i.e. - storm, drought, snowmelt).\cr +SampleCollectionMethod/MethodIdentifier\tab character \tab The identification number or code assigned by the method publisher.\cr +SampleCollectionMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +SampleCollectionMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +SampleCollectionEquipmentName \tab character \tab The name for the equipment used in collecting the sample.\cr +ResultDetectionConditionText \tab character \tab The textual descriptor of a result.\cr +CharacteristicName \tab character \tab The object, property, or substance which is evaluated or enumerated by either a direct field measurement, a direct field observation, or by laboratory analysis of material collected in the field.\cr +ResultSampleFractionText \tab character \tab The text name of the portion of the sample associated with results obtained from a physically-partitioned sample.\cr +ResultMeasureValue \tab numeric \tab The reportable measure of the result for the chemical, microbiological or other characteristic being analyzed. Measure value is given in the units stored in ResultMeasure/MeasureUnitCode.\cr +MeasureQualifierCode \tab character \tab A code used to identify any qualifying issues that affect the results.\cr +ResultMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ResultStatusIdentifier \tab character \tab Indicates the acceptability of the result with respect to QA/QC criteria.\cr +StatisticalBaseCode \tab character \tab The code for the method used to calculate derived results.\cr +ResultValueTypeName \tab character \tab A name that qualifies the process which was used in the determination of the result value (e.g., actual, estimated, calculated).\cr +ResultWeightBasisText \tab character \tab The name that represents the form of the sample or portion of the sample which is associated with the result value (e.g., wet weight, dry weight, ash-free dry weight).\cr +ResultTimeBasisText \tab character \tab The period of time (in days) over which a measurement was made. For example, BOD can be measured as 5 day or 20 day BOD.\cr +ResultTemperatureBasisText \tab character \tab The name that represents the controlled temperature at which the sample was maintained during analysis, e.g. 25 deg BOD analysis.\cr +ResultParticleSizeBasisText \tab character \tab User defined free text describing the particle size class for which the associated result is defined.\cr +PrecisionValue \tab character \tab A measure of mutual agreement among individual measurements of the same property usually under prescribed similar conditions.\cr +ResultCommentText \tab character \tab Free text with general comments concerning the result.\cr +USGSPCode * \tab character \tab 5-digit number used in the US Geological Survey computerized data system, National Water Information System (NWIS), to uniquely identify a specific constituent.\cr +ResultDepthHeightMeasure/MeasureValue + \tab character \tab A measurement of the vertical location (measured from a reference point) at which a result occurred.\cr +ResultDepthHeightMeasure/MeasureUnitCode + \tab character \tab The code that represents the unit for measuring the item.\cr +ResultDepthAltitudeReferencePointText + \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of a result.\cr +SubjectTaxonomicName \tab character \tab The name of the organism from which a tissue sample was taken.\cr +SampleTissueAnatomyName * \tab character \tab The name of the anatomy from which a tissue sample was taken.\cr +ResultAnalyticalMethod/MethodIdentifier \tab character \tab The identification number or code assigned by the method publisher.\cr +ResultAnalyticalMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +ResultAnalyticalMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +MethodDescriptionText * \tab character \tab A brief summary that provides general information about the method.\cr +LaboratoryName \tab character \tab The name of Lab responsible for the result.\cr +AnalysisStartDate \tab character \tab The calendar date on which the analysis began.\cr +ResultLaboratoryCommentText \tab character \tab Remarks which further describe the laboratory procedures which produced the result.\cr +DetectionQuantitationLimitTypeName \tab character \tab Text describing the type of detection or quantitation level used in the analysis of a characteristic.\cr +DetectionQuantitationLimitMeasure/MeasureValue \tab numeric \tab Constituent concentration that, when processed through the complete method, produces a signal that is statistically different from a blank. Measure value is given in the units stored in DetectionQuantitationLimitMeasure/MeasureUnitCode.\cr +DetectionQuantitationLimitMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +PreparationStartDate \tab character \tab The calendar date when the preparation/extraction of the sample for analysis began.\cr +ActivityStartDateTime \tab POSIXct \tab Activity start date and time converted to POSIXct UTC.\cr +ActivityEndDateTime \tab POSIXct \tab Activity end date and time converted to POSIXct UTC.\cr +} +* = elements only in NWIS ++ = elements only in STORET + +There are also several useful attributes attached to the data frame: +\tabular{lll}{ +Name \tab Type \tab Description \cr +url \tab character \tab The url used to generate the data \cr +siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr +variableInfo \tab data.frame \tab A data frame containing information on the requested parameters \cr +queryTime \tab POSIXct \tab The time the data was returned \cr +} } \description{ Imports data from Water Quality Portal web service. This function gets the data from here: \url{http://www.waterqualitydata.us}. diff --git a/man/readWQPqw.Rd b/man/readWQPqw.Rd index fcf45a26dc95e8b998018025f1b039d5ba9a4854..43355e432b9898cd4619365e1458c1eccc6314db 100644 --- a/man/readWQPqw.Rd +++ b/man/readWQPqw.Rd @@ -3,21 +3,100 @@ \alias{readWQPqw} \title{Raw Data Import for Water Quality Portal} \usage{ -readWQPqw(siteNumber, parameterCd, startDate = "", endDate = "") +readWQPqw(siteNumbers, parameterCd, startDate = "", endDate = "") } \arguments{ -\item{siteNumber}{character site number. This needs to include the full agency code prefix.} - \item{parameterCd}{vector of USGS 5-digit parameter code or characteristicNames. Leaving this blank will return all of the measured values during the specified time period.} -\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD.} +\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the earliest possible record.} -\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD.} +\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates +retrieval for the latest possible record.} + +\item{siteNumber}{character site number. This needs to include the full agency code prefix.} } \value{ -retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for -start and end times. +A data frame with at least the following columns: +\tabular{lll}{ +Name \tab Type \tab Description \cr +OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context.\cr +OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization.\cr +ActivityIdentifier \tab character \tab Designator that uniquely identifies an activity within an organization.\cr +ActivityTypeCode \tab character \tab The text describing the type of activity.\cr +ActivityMediaName \tab character \tab Name or code indicating the environmental medium where the sample was taken.\cr +ActivityMediaSubdivisionName \tab character \tab Name or code indicating the environmental matrix as a subdivision of the sample media.\cr +ActivityStartDate \tab character \tab The calendar date on which the field activity is started.\cr +ActivityStartTime/Time \tab character \tab The time of day that is reported when the field activity began, based on a 24-hour timescale.\cr +ActivityStartTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +ActivityEndDate \tab character \tab The calendar date when the field activity is completed.\cr +ActivityEndTime/Time \tab character \tab The time of day that is reported when the field activity ended, based on a 24-hour timescale.\cr +ActivityEndTime/TimeZoneCode \tab character \tab The time zone for which the time of day is reported. Any of the longitudinal divisions of the earth's surface in which a standard time is kept.\cr +ActivityDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the vertical location (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityDepthHeightMeasure/MeasureUnitCode.\cr +ActivityDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ActivityDepthAltitudeReferencePointText \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of an activity.\cr +ActivityTopDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the upper vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityTopDepthHeightMeasure/MeasureUnitCode.\cr +ActivityTopDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ActivityBottomDepthHeightMeasure/MeasureValue \tab character \tab A measurement of the lower vertical location of a vertical location range (measured from a reference point) at which an activity occurred. Measure value is given in the units stored in ActivityBottomDepthHeightMeasure/MeasureUnitCode.\cr +ActivityBottomDepthHeightMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ProjectIdentifier \tab character \tab A designator used to uniquely identify a data collection project within a context of an organization.\cr +ActivityConductingOrganizationText \tab character \tab A name of the Organization conducting an activity.\cr +MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location.\cr +ActivityCommentText \tab character \tab General comments concerning the activity.\cr +SampleAquifer * \tab character \tab A code that designates the aquifer associated with groundwater samples.\cr +HydrologicCondition * \tab character \tab Hydrologic condition is the hydrologic condition that is represented by the sample collected (i.e. ? normal, falling, rising, peak stage).\cr +HydrologicEvent * \tab character \tab A hydrologic event that is represented by the sample collected (i.e. - storm, drought, snowmelt).\cr +SampleCollectionMethod/MethodIdentifier\tab character \tab The identification number or code assigned by the method publisher.\cr +SampleCollectionMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +SampleCollectionMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +SampleCollectionEquipmentName \tab character \tab The name for the equipment used in collecting the sample.\cr +ResultDetectionConditionText \tab character \tab The textual descriptor of a result.\cr +CharacteristicName \tab character \tab The object, property, or substance which is evaluated or enumerated by either a direct field measurement, a direct field observation, or by laboratory analysis of material collected in the field.\cr +ResultSampleFractionText \tab character \tab The text name of the portion of the sample associated with results obtained from a physically-partitioned sample.\cr +ResultMeasureValue \tab numeric \tab The reportable measure of the result for the chemical, microbiological or other characteristic being analyzed. Measure value is given in the units stored in ResultMeasure/MeasureUnitCode.\cr +MeasureQualifierCode \tab character \tab A code used to identify any qualifying issues that affect the results.\cr +ResultMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +ResultStatusIdentifier \tab character \tab Indicates the acceptability of the result with respect to QA/QC criteria.\cr +StatisticalBaseCode \tab character \tab The code for the method used to calculate derived results.\cr +ResultValueTypeName \tab character \tab A name that qualifies the process which was used in the determination of the result value (e.g., actual, estimated, calculated).\cr +ResultWeightBasisText \tab character \tab The name that represents the form of the sample or portion of the sample which is associated with the result value (e.g., wet weight, dry weight, ash-free dry weight).\cr +ResultTimeBasisText \tab character \tab The period of time (in days) over which a measurement was made. For example, BOD can be measured as 5 day or 20 day BOD.\cr +ResultTemperatureBasisText \tab character \tab The name that represents the controlled temperature at which the sample was maintained during analysis, e.g. 25 deg BOD analysis.\cr +ResultParticleSizeBasisText \tab character \tab User defined free text describing the particle size class for which the associated result is defined.\cr +PrecisionValue \tab character \tab A measure of mutual agreement among individual measurements of the same property usually under prescribed similar conditions.\cr +ResultCommentText \tab character \tab Free text with general comments concerning the result.\cr +USGSPCode * \tab character \tab 5-digit number used in the US Geological Survey computerized data system, National Water Information System (NWIS), to uniquely identify a specific constituent.\cr +ResultDepthHeightMeasure/MeasureValue + \tab character \tab A measurement of the vertical location (measured from a reference point) at which a result occurred.\cr +ResultDepthHeightMeasure/MeasureUnitCode + \tab character \tab The code that represents the unit for measuring the item.\cr +ResultDepthAltitudeReferencePointText + \tab character \tab The reference used to indicate the datum or reference used to establish the depth/altitude of a result.\cr +SubjectTaxonomicName \tab character \tab The name of the organism from which a tissue sample was taken.\cr +SampleTissueAnatomyName * \tab character \tab The name of the anatomy from which a tissue sample was taken.\cr +ResultAnalyticalMethod/MethodIdentifier \tab character \tab The identification number or code assigned by the method publisher.\cr +ResultAnalyticalMethod/MethodIdentifierContext \tab character \tab Identifies the source or data system that created or defined the identifier.\cr +ResultAnalyticalMethod/MethodName \tab character \tab The title that appears on the method from the method publisher.\cr +MethodDescriptionText * \tab character \tab A brief summary that provides general information about the method.\cr +LaboratoryName \tab character \tab The name of Lab responsible for the result.\cr +AnalysisStartDate \tab character \tab The calendar date on which the analysis began.\cr +ResultLaboratoryCommentText \tab character \tab Remarks which further describe the laboratory procedures which produced the result.\cr +DetectionQuantitationLimitTypeName \tab character \tab Text describing the type of detection or quantitation level used in the analysis of a characteristic.\cr +DetectionQuantitationLimitMeasure/MeasureValue \tab numeric \tab Constituent concentration that, when processed through the complete method, produces a signal that is statistically different from a blank. Measure value is given in the units stored in DetectionQuantitationLimitMeasure/MeasureUnitCode.\cr +DetectionQuantitationLimitMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item.\cr +PreparationStartDate \tab character \tab The calendar date when the preparation/extraction of the sample for analysis began.\cr +ActivityStartDateTime \tab POSIXct \tab Activity start date and time converted to POSIXct UTC.\cr +ActivityEndDateTime \tab POSIXct \tab Activity end date and time converted to POSIXct UTC.\cr +} +* = elements only in NWIS ++ = elements only in STORET + +There are also several useful attributes attached to the data frame: +\tabular{lll}{ +Name \tab Type \tab Description \cr +url \tab character \tab The url used to generate the data \cr +siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr +variableInfo \tab data.frame \tab A data frame containing information on the requested parameters \cr +queryTime \tab POSIXct \tab The time the data was returned \cr +} } \description{ Imports data from the Water Quality Portal. @@ -31,6 +110,8 @@ site name, such as 'USGS-01234567'. \dontrun{ rawPcode <- readWQPqw('USGS-01594440','01075', '', '') rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '') +rawPHsites <- readWQPqw(c('USGS-05406450', 'USGS-05427949','WIDNR_WQX-133040'), 'pH','','') +nwisEx <- readWQPqw('USGS-04024000',c('34247','30234','32104','34220'),'','') } } \seealso{ diff --git a/man/whatNWISData.Rd b/man/whatNWISData.Rd index 4675f19b375ccb9714c70fbb2e71d14e1b3e34ad..608b883b54de5d8f23671027e1c8f0df12eeff96 100644 --- a/man/whatNWISData.Rd +++ b/man/whatNWISData.Rd @@ -20,7 +20,47 @@ instantaneous values)} \item{statCd}{character vector of all statistic codes to return. Defaults to "all" which will not perform a filter.} } \value{ -retval dataframe with all information found in the expanded site file +A data frame with the following columns: +\tabular{lll}{ +Name \tab Type \tab Description \cr +agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr +site_no \tab character \tab The USGS site number \cr +station_nm \tab character \tab Site name \cr +site_tp_cd \tab character \tab Site type \cr +dec_lat_va \tab numeric \tab Decimal latitude\cr +dec_long_va \tab numeric \tab Decimal longitude \cr +coord_acy_cd \tab character \tab Latitude-longitude accuracy \cr +dec_coord_datum_cd \tab character \tab Decimal Latitude-longitude datum \cr +alt_va \tab character \tab Altitude of Gage or land surface \cr +alt_acy_va \tab character \tab Altitude accuracy \cr +alt_datum_cd \tab character \tab Altitude datum \cr +huc_cd \tab character \tab Hydrologic unit code \cr +data_type_cd \tab character \tab Data type \cr +parm_cd \tab character \tab Parameter code \cr +stat_cd \tab character \tab Statistical code \cr +dd_nu \tab character \tab Internal database key \cr +loc_web_ds \tab character \tab Additional measurement description \cr +medium_grp_cd \tab character \tab Medium group code \cr +parm_grp_cd \tab character \tab Parameter group code \cr +srs_id \tab character \tab SRS ID \cr +access_cd \tab character \tab Access code \cr +begin_date \tab Date \tab Begin date \cr +end_date \tab Date \tab End date \cr +count_nu \tab integer \tab Record count\cr +parameter_group_nm \tab character \tab Parameter group name \cr +parameter_nm \tab character \tab Parameter name \cr +casrn \tab character \tab Chemical Abstracts Service (CAS) Registry Number \cr +srsname \tab character \tab Substance Registry Services \cr +parameter_units \tab character \tab Parameter units \cr +} + +There are also several useful attributes attached to the data frame: +\tabular{lll}{ +Name \tab Type \tab Description \cr +url \tab character \tab The url used to generate the data \cr +comment \tab character \tab Header comments from the RDB file \cr +queryTime \tab POSIXct \tab The time the data was returned \cr +} } \description{ Imports a table of available parameters, period of record, and count. See \url{http://waterservices.usgs.gov/rest/Site-Service.html} diff --git a/man/whatNWISsites.Rd b/man/whatNWISsites.Rd index 6f94628446bf3bc006aebced597ae0fde9a3cf5b..eae6a384bb7042afa34fa09ab4e9cbe5c74df55e 100644 --- a/man/whatNWISsites.Rd +++ b/man/whatNWISsites.Rd @@ -9,7 +9,24 @@ whatNWISsites(...) \item{\dots}{see \url{http://waterservices.usgs.gov/rest/Site-Service.html#Service} for a complete list of options} } \value{ -retval dataframe with agency_cd, site_no, station_nm, site_tp_cd, dec_lat_va, and dec_long_va. +A data frame with at least the following columns: +\tabular{lll}{ +Name \tab Type \tab Description \cr +agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr +site_no \tab character \tab The USGS site number \cr +station_nm \tab character \tab Station name \cr +site_tp_cd \tab character \tab Site type code \cr +dec_lat_va \tab numeric \tab Decimal latitude \cr +dec_long_va \tab numeric \tab Decimal longitude \cr +queryTime \tab POSIXct \tab Query time \cr +} + +There are also several useful attributes attached to the data frame: +\tabular{lll}{ +Name \tab Type \tab Description \cr +url \tab character \tab The url used to generate the data \cr +queryTime \tab POSIXct \tab The time the data was returned \cr +} } \description{ Returns a list of sites from the NWIS web service. This function gets the data from: \url{http://waterservices.usgs.gov/rest/Site-Test-Tool.html}. diff --git a/man/whatWQPsites.Rd b/man/whatWQPsites.Rd index 9875d419d2af453b6710267b5b8a3340b21932ce..743b2f17f8e490f1afb3e9a5fba54c83493ca91b 100644 --- a/man/whatWQPsites.Rd +++ b/man/whatWQPsites.Rd @@ -9,8 +9,47 @@ whatWQPsites(...) \item{\dots}{see \url{www.waterqualitydata.us/webservices_documentation.jsp} for a complete list of options} } \value{ -retval dataframe with first column dateTime, and at least one qualifier and value columns -(subsequent qualifier/value columns could follow depending on requested parameter codes) +A data frame with at least the following columns: +\tabular{lll}{ +Name \tab Type \tab Description \cr +OrganizationIdentifier \tab character \tab A designator used to uniquely identify a unique business establishment within a context. \cr +OrganizationFormalName \tab character \tab The legal designator (i.e. formal name) of an organization. \cr +MonitoringLocationIdentifier \tab character \tab A designator used to describe the unique name, number, or code assigned to identify the monitoring location. \cr +MonitoringLocationName \tab character \tab The designator specified by the sampling organization for the site at which sampling or other activities are conducted. \cr +MonitoringLocationTypeName \tab character \tab The descriptive name for a type of monitoring location. \cr +MonitoringLocationDescriptionText \tab character \tab Text description of the monitoring location. \cr +HUCEightDigitCode \tab character \tab The 8 digit federal code used to identify the hydrologic unit of the monitoring location to the cataloging unit level of precision. \cr +DrainageAreaMeasure/MeasureValue * \tab character \tab The drainage basin of a lake, stream, wetland, or estuary site. Measure value is given in the units stored in DrainageAreaMeasure/MeasureUnitCode. \cr +DrainageAreaMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +ContributingDrainageAreaMeasure/MeasureValue * \tab character \tab The contributing drainage area of a lake, stream, wetland, or estuary site. Measure value is given in the units stored in ContributingDrainageAreaMeasure/MeasureUnitCode. \cr +ContributingDrainageAreaMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +LatitudeMeasure \tab numeric \tab The measure of the angular distance on a meridian north or south of the equator. \cr +LongitudeMeasure \tab numeric \tab The measure of the angular distance on a meridian east or west of the prime meridian. \cr +SourceMapScaleNumeric \tab character \tab The number that represents the proportional distance on the ground for one unit of measure on the map or photo. \cr +HorizontalAccuracyMeasure/MeasureValue * \tab character \tab The horizontal measure of the relative accuracy of the latitude and longitude coordinates." Measure value is given in the units stored in HorizontalAccuracyMeasure/MeasureUnitCode. \cr +HorizontalAccuracyMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +HorizontalCollectionMethodName \tab character \tab The name that identifies the method used to determine the latitude and longitude coordinates for a point on the earth. \cr +HorizontalCoordinateReferenceSystemDatumName \tab character \tab The name that describes the reference datum used in determining latitude and longitude coordinates. \cr +VerticalMeasure/MeasureValue \tab character \tab The measure of elevation (i.e., the altitude), above or below a reference datum. Measure value is given in the units stored in VerticalMeasure/MeasureUnitCode. \cr +VerticalMeasure/MeasureUnitCode \tab character \tab The code that represents the unit for measuring the item. \cr +VerticalAccuracyMeasure/MeasureValue * \tab character \tab The vertical measure of the relative accuracy of the latitude and longitude coordinates. Measure value is given in the units stored in VerticalAccuracyMeasure/MeasureUnitCode. \cr +VerticalAccuracyMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +VerticalCollectionMethodName \tab character \tab The name that identifies the method used to collect the vertical measure (i.e. the altitude) of a reference point. \cr +VerticalCoordinateReferenceSystemDatumName \tab character \tab The name of the reference datum used to determine the vertical measure (i.e., the altitude). \cr +CountryCode \tab character \tab A code designator used to identify a primary geopolitical unit of the world. \cr +StateCode \tab character \tab A code designator used to identify a principal administrative subdivision of the United States, Canada, or Mexico. \cr +CountyCode \tab character \tab A code designator used to identify a U.S. county or county equivalent. \cr +AquiferName * \tab character \tab Name of the aquifer in which the well is completed. \cr +FormationTypeText * \tab character \tab Name of the primary formation or soils unit, in which the well is completed. \cr +AquiferTypeName * \tab character \tab The type of aquifer, such as confined or unconfined. \cr +ConstructionDateText * \tab character \tab Date of construction when well was completed. May be year only. \cr +WellDepthMeasure/MeasureValue * \tab character \tab Depth below land surface datum (LSD) to the bottom of the hole on completion of drilling. Measure value is given in the units stored in WellDepthMeasure/MeasureUnitCode. \cr +WellDepthMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +WellHoleDepthMeasure/MeasureValue * \tab character \tab Depth below land surface datum (LSD) to the bottom of the hole on completion of drilling. Measure value is given in the units stored in WellHoleDepthMeasure/MeasureUnitCode. \cr +WellHoleDepthMeasure/MeasureUnitCode * \tab character \tab The code that represents the unit for measuring the item. \cr +queryTime \tab POSIXct \tab Query time \cr +} +* element is only in NWIS } \description{ Returns a list of sites from the Water Quality Portal web service. This function gets the data from: \url{http://www.waterqualitydata.us}. diff --git a/vignettes/dataRetrieval.Rnw b/vignettes/dataRetrieval.Rnw index c73b1725a638e4dbc17aaa8ddb3997b87fb7aafb..9217883b755135a0ad613a6c786b03cd23c01b98 100644 --- a/vignettes/dataRetrieval.Rnw +++ b/vignettes/dataRetrieval.Rnw @@ -532,10 +532,10 @@ siteInfo <- attr(temperatureAndFlow, "siteInfo") par(mar=c(5,5,5,5)) #sets the size of the plot window -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Wtemp_Max, +plot(temperatureAndFlow$Date, temperatureAndFlow$Wtemp_Max, ylab=variableInfo$parameter_desc[1],xlab="" ) par(new=TRUE) -plot(temperatureAndFlow$dateTime, temperatureAndFlow$Flow, +plot(temperatureAndFlow$Date, temperatureAndFlow$Flow, col="red",type="l",xaxt="n",yaxt="n",xlab="",ylab="",axes=FALSE ) axis(4,col="red",col.axis="red") diff --git a/vignettes/figure/getNWIStemperaturePlot-1.pdf b/vignettes/figure/getNWIStemperaturePlot-1.pdf index b787b6f6e41f7be1a10cf01a0192f6978cb2fcae..244727c9836ea42132cd61e3528c143ef18e2e15 100644 Binary files a/vignettes/figure/getNWIStemperaturePlot-1.pdf and b/vignettes/figure/getNWIStemperaturePlot-1.pdf differ