Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance scheduled for Thursday, May 26th at 15:00 MST. Expected downtime <1 hour.
Open sidebar
Water
dataRetrieval
Commits
b4964fb8
Commit
b4964fb8
authored
Sep 07, 2021
by
Laura A DeCicco
Browse files
Check status
parent
4bc24ebd
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/readNWISdata.r
View file @
b4964fb8
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#' @examples
#' @examples
#' \donttest{
#' \donttest{
#' # Examples not run for time considerations
#' # Examples not run for time considerations
#' if(!httr::http_error("https://waterservices.usgs.gov")){
#' dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010", service="dv")
#' dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010", service="dv")
#' instFlow <- readNWISdata(sites="05114000", service="iv",
#' instFlow <- readNWISdata(sites="05114000", service="iv",
#' parameterCd="00060",
#' parameterCd="00060",
...
@@ -76,32 +77,35 @@
...
@@ -76,32 +77,35 @@
#'
#'
#' startDate <- as.Date("2013-10-01")
#' startDate <- as.Date("2013-10-01")
#' endDate <- as.Date("2014-09-30")
#' endDate <- as.Date("2014-09-30")
#' waterYear <- readNWISdata(bBox=c(-83,36.5,-8
1,38.
5), parameterCd="00010",
#' waterYear <- readNWISdata(bBox=c(-83,36.5,-8
2.5,36.7
5), parameterCd="00010",
#' service="dv", startDate=startDate, endDate=endDate)
#' service="dv", startDate=startDate, endDate=endDate)
#' siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",
#' siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",
#' hasDataTypeCd="iv", service="site")
#' hasDataTypeCd="iv", service="site")
#' temp <- readNWISdata(bBox=c(-83,36.5,-8
1,38.
5), parameterCd="00010", service="site",
#' temp <- readNWISdata(bBox=c(-83,36.5,-8
2.5,36.7
5), parameterCd="00010", service="site",
#' seriesCatalogOutput=TRUE)
#' seriesCatalogOutput=TRUE)
#' wiGWL <- readNWISdata(stateCd="WI",service="gwlevels")
#' wiGWL <- readNWISdata(stateCd = "WI", service = "gwlevels")
#' meas <- readNWISdata(state_cd="WI",service="measurements",format="rdb_expanded")
#' meas <- readNWISdata(state_cd = "WI", service = "measurements",
#' format = "rdb_expanded")
#'
#'
#' waterYearStat <- readNWISdata(site=c("01646500"),service="stat",statReportType="annual",
#' waterYearStat <- readNWISdata(site = c("01646500"),
#' statYearType="water", missingData="on")
#' service = "stat",
#' statReportType="annual",
#' statYearType = "water",
#' missingData = "on")
#' monthlyStat <- readNWISdata(site=c("01646500"),
#' monthlyStat <- readNWISdata(site=c("01646500"),
#' service="stat",
#' service="stat",
#' statReportType="monthly")
#' statReportType="monthly")
#' dailyStat <- readNWISdata(site=c("01646500"),
#'
#' service="stat",
#' dailyStat <- readNWISdata(site = c("01646500"),
#' statReportType="daily",
#' service = "stat",
#' statType=c("p25","p50","p75","min","max"),
#' statReportType = "daily",
#' parameterCd="00060")
#' statType = c("p25","p50","p75","min","max"),
#' parameterCd = "00060")
#'
#'
#' dailyRI <- readNWISdata(stateCd = "Rhode Island", parameterCd = "00060")
#' arg.list <- list(site = "03111548",
#'
#' statReportType = "daily",
#' arg.list <- list(site="03111548",
#' statType = c("p25","p50","p75","min","max"),
#' statReportType="daily",
#' parameterCd = "00060")
#' statType=c("p25","p50","p75","min","max"),
#' parameterCd="00060")
#' allDailyStats_2 <- readNWISdata(arg.list, service="stat")
#' allDailyStats_2 <- readNWISdata(arg.list, service="stat")
#'
#'
#' #' # use county names to get data
#' #' # use county names to get data
...
@@ -113,21 +117,23 @@
...
@@ -113,21 +117,23 @@
#' va_counties <- c("51001","51003","51005","51007","51009","51011","51013","51015")
#' va_counties <- c("51001","51003","51005","51007","51009","51011","51013","51015")
#' va_counties_data <- readNWISdata(startDate = "2015-01-01", endDate = "2015-12-31",
#' va_counties_data <- readNWISdata(startDate = "2015-01-01", endDate = "2015-12-31",
#' parameterCd = "00060", countycode = va_counties)
#' parameterCd = "00060", countycode = va_counties)
#' }
#'
#'
#' if(!httr::http_error("https://nwis.waterdata.usgs.gov")){
#' site_id <- '01594440'
#' site_id <- '01594440'
#' rating_curve <- readNWISdata(service = "rating", site_no = site_id, file_type="base")
#' rating_curve <- readNWISdata(service = "rating", site_no = site_id, file_type="base")
#' all_sites_base <- readNWISdata(service = "rating", file_type="base")
#' all_sites_base <- readNWISdata(service = "rating", file_type="base")
#' all_sites_core <- readNWISdata(service = "rating", file_type="corr")
#' all_sites_core <- readNWISdata(service = "rating", file_type="corr")
#' all_sites_exsa <- readNWISdata(service = "rating", file_type="exsa")
#' all_sites_exsa <- readNWISdata(service = "rating", file_type="exsa")
#' all_sites_24hrs <- readNWISdata(service = "rating", file_type="exsa", period = 24)
#' all_sites_24hrs <- readNWISdata(service = "rating", file_type="exsa", period = 24)
#'
#' today <- readNWISdata(service="iv", startDate = Sys.Date(),
#' parameterCd = "00060", siteNumber = "05114000")
#'
#'
#' peak_data <- readNWISdata(service = "peak",
#' peak_data <- readNWISdata(service = "peak",
#' site_no = c("01594440","040851325"),
#' site_no = c("01594440","040851325"),
#' range_selection = "data_range")
#' range_selection = "data_range")
#'
#'
#' }
#' }
#' }
readNWISdata
<-
function
(
...
,
asDateTime
=
TRUE
,
convertType
=
TRUE
,
tz
=
"UTC"
){
readNWISdata
<-
function
(
...
,
asDateTime
=
TRUE
,
convertType
=
TRUE
,
tz
=
"UTC"
){
tz
<-
match.arg
(
tz
,
OlsonNames
())
tz
<-
match.arg
(
tz
,
OlsonNames
())
...
...
man/readNWISdata.Rd
View file @
b4964fb8
...
@@ -67,6 +67,7 @@ See examples below for ideas of constructing queries.
...
@@ -67,6 +67,7 @@ See examples below for ideas of constructing queries.
\examples{
\examples{
\donttest{
\donttest{
# Examples not run for time considerations
# Examples not run for time considerations
if(!httr::http_error("https://waterservices.usgs.gov")){
dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010", service="dv")
dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010", service="dv")
instFlow <- readNWISdata(sites="05114000", service="iv",
instFlow <- readNWISdata(sites="05114000", service="iv",
parameterCd="00060",
parameterCd="00060",
...
@@ -87,32 +88,35 @@ bBoxEx <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010")
...
@@ -87,32 +88,35 @@ bBoxEx <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010")
startDate <- as.Date("2013-10-01")
startDate <- as.Date("2013-10-01")
endDate <- as.Date("2014-09-30")
endDate <- as.Date("2014-09-30")
waterYear <- readNWISdata(bBox=c(-83,36.5,-8
1,38.
5), parameterCd="00010",
waterYear <- readNWISdata(bBox=c(-83,36.5,-8
2.5,36.7
5), parameterCd="00010",
service="dv", startDate=startDate, endDate=endDate)
service="dv", startDate=startDate, endDate=endDate)
siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",
siteInfo <- readNWISdata(stateCd="WI", parameterCd="00010",
hasDataTypeCd="iv", service="site")
hasDataTypeCd="iv", service="site")
temp <- readNWISdata(bBox=c(-83,36.5,-8
1,38.
5), parameterCd="00010", service="site",
temp <- readNWISdata(bBox=c(-83,36.5,-8
2.5,36.7
5), parameterCd="00010", service="site",
seriesCatalogOutput=TRUE)
seriesCatalogOutput=TRUE)
wiGWL <- readNWISdata(stateCd="WI",service="gwlevels")
wiGWL <- readNWISdata(stateCd = "WI", service = "gwlevels")
meas <- readNWISdata(state_cd="WI",service="measurements",format="rdb_expanded")
meas <- readNWISdata(state_cd = "WI", service = "measurements",
format = "rdb_expanded")
waterYearStat <- readNWISdata(site=c("01646500"),service="stat",statReportType="annual",
waterYearStat <- readNWISdata(site = c("01646500"),
statYearType="water", missingData="on")
service = "stat",
statReportType="annual",
statYearType = "water",
missingData = "on")
monthlyStat <- readNWISdata(site=c("01646500"),
monthlyStat <- readNWISdata(site=c("01646500"),
service="stat",
service="stat",
statReportType="monthly")
statReportType="monthly")
dailyStat <- readNWISdata(site=c("01646500"),
service="stat",
dailyStat <- readNWISdata(site = c("01646500"),
statReportType="daily",
service = "stat",
statType=c("p25","p50","p75","min","max"),
statReportType = "daily",
parameterCd="00060")
statType = c("p25","p50","p75","min","max"),
parameterCd = "00060")
dailyRI <- readNWISdata(stateCd = "Rhode Island", parameterCd = "00060")
arg.list <- list(site = "03111548",
statReportType = "daily",
arg.list <- list(site="03111548",
statType = c("p25","p50","p75","min","max"),
statReportType="daily",
parameterCd = "00060")
statType=c("p25","p50","p75","min","max"),
parameterCd="00060")
allDailyStats_2 <- readNWISdata(arg.list, service="stat")
allDailyStats_2 <- readNWISdata(arg.list, service="stat")
#' # use county names to get data
#' # use county names to get data
...
@@ -124,20 +128,22 @@ dailyStaffordVA <- readNWISdata(stateCd = "Virginia",
...
@@ -124,20 +128,22 @@ dailyStaffordVA <- readNWISdata(stateCd = "Virginia",
va_counties <- c("51001","51003","51005","51007","51009","51011","51013","51015")
va_counties <- c("51001","51003","51005","51007","51009","51011","51013","51015")
va_counties_data <- readNWISdata(startDate = "2015-01-01", endDate = "2015-12-31",
va_counties_data <- readNWISdata(startDate = "2015-01-01", endDate = "2015-12-31",
parameterCd = "00060", countycode = va_counties)
parameterCd = "00060", countycode = va_counties)
}
if(!httr::http_error("https://nwis.waterdata.usgs.gov")){
site_id <- '01594440'
site_id <- '01594440'
rating_curve <- readNWISdata(service = "rating", site_no = site_id, file_type="base")
rating_curve <- readNWISdata(service = "rating", site_no = site_id, file_type="base")
all_sites_base <- readNWISdata(service = "rating", file_type="base")
all_sites_base <- readNWISdata(service = "rating", file_type="base")
all_sites_core <- readNWISdata(service = "rating", file_type="corr")
all_sites_core <- readNWISdata(service = "rating", file_type="corr")
all_sites_exsa <- readNWISdata(service = "rating", file_type="exsa")
all_sites_exsa <- readNWISdata(service = "rating", file_type="exsa")
all_sites_24hrs <- readNWISdata(service = "rating", file_type="exsa", period = 24)
all_sites_24hrs <- readNWISdata(service = "rating", file_type="exsa", period = 24)
today <- readNWISdata(service="iv", startDate = Sys.Date(),
parameterCd = "00060", siteNumber = "05114000")
peak_data <- readNWISdata(service = "peak",
peak_data <- readNWISdata(service = "peak",
site_no = c("01594440","040851325"),
site_no = c("01594440","040851325"),
range_selection = "data_range")
range_selection = "data_range")
}
}
}
}
}
\seealso{
\seealso{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment