View source: R/read_waterdata_continuous.R
| read_waterdata_continuous | R Documentation |
Continuous data are collected via automated sensors installed at a monitoring location. They are collected at a high frequency and often at a fixed 15-minute interval. Depending on the specific monitoring location, the data may be transmitted automatically via telemetry and be available on WDFN within minutes of collection, while other times the delivery of data may be delayed if the monitoring location does not have the capacity to automatically transmit data. Continuous data are described by parameter name and parameter code (pcode). These data might also be referred to as "instantaneous values" or "IV".
Currently, the services only allow up to 3 years of data to be requested with a single request. If no "time" is specified, the service will return the last single year of data. If this is a bottleneck, please check back for new direct download functions that are expected to be available sometime in 2026.
Geometry output is not supported in the continuous data API endpoint.
read_waterdata_continuous(
monitoring_location_id = NA_character_,
parameter_code = NA_character_,
properties = NA_character_,
time_series_id = NA_character_,
approval_status = NA_character_,
unit_of_measure = NA_character_,
qualifier = NA_character_,
value = NA,
last_modified = NA_character_,
time = NA_character_,
limit = NA,
convertType = TRUE,
no_paging = FALSE
)
monitoring_location_id |
A unique identifier representing a single monitoring location. This corresponds to the Multiple monitoring_location_ids can be requested as a character vector. |
parameter_code |
Parameter codes are 5-digit codes used to identify the constituent measured and the units of measure. A complete list of parameter codes and associated groupings can be found at https://api.waterdata.usgs.gov/ogcapi/v0/collections/parameter-codes/items. Multiple parameter_codes can be requested as a character vector. |
properties |
A vector of requested columns to be returned from the query.
Available options are:
geometry, continuous_id, time_series_id, monitoring_location_id, parameter_code, statistic_id, time, value, unit_of_measure, approval_status, qualifier, last_modified.
The default ( |
time_series_id |
A unique identifier representing a single time series. This corresponds to the Multiple time_series_ids can be requested as a character vector. |
approval_status |
Some of the data that you have obtained from this U.S. Geological Survey database may not have received Director's approval. Any such data values are qualified as provisional and are subject to revision. Provisional data are released on the condition that neither the USGS nor the United States Government may be held liable for any damages resulting from its use. This field reflects the approval status of each record, and is either "Approved", meaining processing review has been completed and the data is approved for publication, or "Provisional" and subject to revision. For more information about provisional data, go to https://waterdata.usgs.gov/provisional-data-statement/. |
unit_of_measure |
A human-readable description of the units of measurement associated with an observation. |
qualifier |
This field indicates any qualifiers associated with an observation, for instance if a sensor may have been impacted by ice or if values were estimated. |
value |
The value of the observation. Values are transmitted as strings in the JSON response format in order to preserve precision. |
last_modified |
The last time a record was refreshed in our database. This may happen due to regular operational processes and does not necessarily indicate anything about the measurement has changed. You can query this field using date-times or intervals, adhering to RFC 3339, or using ISO 8601 duration objects. Intervals may be bounded or half-bounded (double-dots at start or end). Examples:
Only features that have a See also Details below for more information. |
time |
The date an observation represents. You can query this field using date-times or intervals, adhering to RFC 3339, or using ISO 8601 duration objects. Intervals may be bounded or half-bounded (double-dots at start or end). Examples:
Only features that have a See also Details below for more information. |
limit |
The optional limit parameter is used to control the subset of the
selected features that should be returned in each page. The maximum allowable
limit is 50000. It may be beneficial to set this number lower if your internet
connection is spotty. The default ( |
convertType |
logical, defaults to |
no_paging |
logical, defaults to |
You can also use a vector of length 2 for any time queries (such as time
or last_modified). The first value is the starting date (or datetime),
the second value is the ending date(or datetime).
NA's within the vector indicate a half-bound date.
For example, time = c("2024-01-01", NA) will return all data starting
at 2024-01-01.
time = c(NA, "2024-01-01") will return all data from the beginning of
the timeseries until 2024-01-01.
By default, time is assumed UTC, although time zone attributes
will be accommodated. As an example, setting time = as.POSIXct(c("2021-01-01 12:00:00",
"2021-01-01 14:00"), tz = "America/New_York") will request data that between
noon and 2pm eastern time on 2021-01-01.
All time values RETURNED from the service are UTC with the exception of
daily data, which returns time values in local dates.
site <- "USGS-451605097071701"
pcode <- "72019"
uv_data_trim <- read_waterdata_continuous(monitoring_location_id = site,
parameter_code = pcode,
properties = c("value", "time"),
time = as.POSIXct(c("2026-02-07 12:00",
"2026-02-08 12:00"),
tz = "America/Chicago"))
uv_data <- read_waterdata_continuous(monitoring_location_id = site,
parameter_code = pcode,
time = "P2D")
# Only return data that has been modified in last 7 days
multi_site2 <- read_waterdata_continuous(monitoring_location_id = c("USGS-451605097071701",
"USGS-14181500"),
parameter_code = c("00060", "72019"),
last_modified = "P7D")
# how to split up request into roughly 3 year chunks
site <- "USGS-0208458892"
pcode <- "00095" # Specific conductance
start <- as.Date("2013-01-01")
end <- as.Date("2025-12-31")
n_days <- difftime(end, start, units = "days")
# create a vector of dates that are about 3 years apart:
time_chunks <- seq(from = start,
to = end,
length.out = ceiling(n_days/(3*365.25)) + 1)
# create a list where each element starts at the beginning
# of a chunk, and ends the day before the next chunk:
time_df <- data.frame(start = time_chunks[-length(time_chunks)],
end = time_chunks[-1]-1)
#all_data <- data.frame()
#for(i in seq_along(time_df$start)){
# sub_df <- read_waterdata_continuous(monitoring_location_id = site,
# parameter_code = pcode,
# time = c(time_df$start[i],
# time_df$end[i]))
# all_data <- rbind(all_data, sub_df)
# }
# Set the time to Eastern:
# all_data$time <- lubridate::force_tz(all_data$time, "America/New_York")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.