View source: R/read_waterdata_daily.R
| read_waterdata_daily | R Documentation |
Daily data provide one data value to represent water conditions for the day. Throughout much of the history of the USGS, the primary water data available was daily data collected manually at the monitoring location once each day. With improved availability of computer storage and automated transmission of data, the daily data published today are generally a statistical summary or metric of the continuous data collected each day, such as the daily mean, minimum, or maximum value. Daily data are automatically calculated from the continuous data of the same parameter code and are described by parameter code and a statistic code. These data have also been referred to as “daily values” or “DV”.
read_waterdata_daily(
monitoring_location_id = NA_character_,
parameter_code = NA_character_,
statistic_id = 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_,
skipGeometry = NA,
time = NA_character_,
bbox = NA,
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. |
statistic_id |
A code corresponding to the statistic an observation represents. Example codes include 00001 (max), 00002 (min), and 00003 (mean). A complete list of codes and their descriptions can be found at https://api.waterdata.usgs.gov/ogcapi/v0/collections/statistic-codes/items. Multiple statistic_ids can be requested as a character vector. |
properties |
A vector of requested columns to be returned from the query.
Available options are:
geometry, daily_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. |
skipGeometry |
This option can be used to skip response geometries for each feature. The returning object will be a data frame with no spatial 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. |
bbox |
Only features that have a geometry that intersects the bounding box are selected.The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (height or depth). Coordinates are assumed to be in crs 4326. The expected format is a numeric vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude). |
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-02238500"
dv_data_sf <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
time = c("2021-01-01", "2022-01-01"))
dv_data_last_modified <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
last_modified = "P7D")
dv_data_trim <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
properties = c("value",
"time"),
time = c("2021-01-01", "2022-01-01"))
dv_data <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
skipGeometry = TRUE)
dv_data_period <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
time = "P7D")
multi_site <- read_waterdata_daily(monitoring_location_id = c("USGS-01491000",
"USGS-01645000"),
parameter_code = c("00060", "00010"),
time = c("2023-01-01", "2024-01-01"))
dv_data_quick <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
no_paging = TRUE)
dv_post <- read_waterdata_daily(monitoring_location_id = site,
approval_status = c("Approved", "Provisional"))
# Don't attach "request" attribute:
options("dataRetrieval.attach_request" = FALSE)
dv_data_no_request <- read_waterdata_daily(monitoring_location_id = site,
parameter_code = "00060",
time = c("2021-01-01", "2022-01-01"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.