Annual peak flow values are the maximum instantaneous streamflow values recorded at a particular site for the entire water year from October 1 to September 30. Note that the annual peak flow value may not occur at the same time the maximum water level occurs due to conditions such as backwater, tidal fluctuations, etc.
Usage
read_waterdata_peaks(
monitoring_location_id = NA_character_,
parameter_code = NA_character_,
properties = NA_character_,
time_series_id = NA_character_,
unit_of_measure = NA_character_,
value = NA,
last_modified = NA_character_,
water_year = NA_character_,
year = NA_character_,
month = NA_character_,
day = NA_character_,
time_of_day = NA_character_,
peak_since = NA_character_,
skipGeometry = NA,
time = NA_character_,
bbox = NA,
...,
convertType = getOption("dataRetrieval.convertType"),
no_paging = getOption("dataRetrieval.no_paging"),
chunk_size = getOption("dataRetrieval.site_chunk_size_meta"),
limit = getOption("dataRetrieval.limit"),
attach_request = getOption("dataRetrieval.attach_request")
)Arguments
- monitoring_location_id
A unique identifier representing a single monitoring location. This corresponds to the
idfield in themonitoring-locationsendpoint. Monitoring location IDs are created by combining the agency code of the agency responsible for the monitoring location (e.g. USGS) with the ID number of the monitoring location (e.g. 02238500), separated by a hyphen (e.g. USGS-02238500).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, time_series_id, monitoring_location_id, parameter_code, peak_id, unit_of_measure, value, last_modified, time, water_year, year, month, day, time_of_day, peak_since. The default (
NA) will return all columns of the data.- time_series_id
A unique identifier representing a single time series. This corresponds to the
idfield in thetime-series-metadataendpoint.- unit_of_measure
A human-readable description of the units of measurement associated with an observation.
- 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:
A date-time: "2018-02-12T23:20:50Z"
A bounded interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"
Half-bounded intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z"
Duration objects: "P1M" for data from the past month or "PT36H" for the last 36 hours
Only features that have a
last_modifiedthat intersects the value of datetime are selected.See also Details below for more information.
- water_year
The water year (running from October 1st to September 30th) a peak occurred.
- year
The calendar year a peak occurred.
- month
The calendar month a peak occurred. If null, the month a peak occurred is unknown.
- day
The day of the month a peak occurred. If null, the day a peak occurred is unknown.
- time_of_day
The time of day a peak occurred. If null, the time of day a peak occurred is unknown.
- peak_since
If not null, this record represents the peak value for the parameter code since the year contained in "peak_since".
- skipGeometry
This parameter can be used to skip response geometries for each feature. The returning object will be a data frame with no spatial information. The default
NAwill not specify the argument in the request.- 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:
A date-time: "2018-02-12T23:20:50Z"
A bounded interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"
Half-bounded intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z"
Duration objects: "P1M" for data from the past month or "PT36H" for the last 36 hours
Only features that have a
timethat intersects the value of datetime are selected. If a feature has multiple temporal properties, it is the decision of the server whether only a single temporal property is used to determine the extent or all relevant temporal properties.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).
- ...
Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.
- convertType
logical, defaults to TRUE. If
TRUE, the function will convert the data to dates, any qualifiers to string vector and reorder the returned data frame.- no_paging
logical, defaults to FALSE. If
TRUE, the data will be requested from a native csv format. This can be dangerous because the data will cut off at 50,000 rows without indication that more data is available. UseTRUEwith caution.- chunk_size
Number of monitoring_location_ids to chunk requests into. The default for functions that don't generally return long-term data records is 250, while the default for time series functions is 10. Setting to
NAwill eliminate site chunking, giving users full control.- limit
numeric, 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 50,000. It may be beneficial to set this number lower if your internet connection is spotty. The default (
NA) will set the limit to the maximum allowable limit for the service.- attach_request
logical, defaults to TRUE. If set to
TRUE, the full request sent to the Water Data API is attached as an attribute to the data set.
Details
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.
Examples
# \donttest{
wi_peaks <- read_waterdata_combined_meta(
state_name = "Wisconsin",
data_type = "Peaks",
parameter_code = "00060")
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/combined-metadata/items?f=json&lang=en-US¶meter_code=00060&data_type=Peaks&state_name=Wisconsin&limit=50000
#> Remaining requests this hour:2308
dv_data_sf <- read_waterdata_peaks(
monitoring_location_id = wi_peaks$monitoring_location_id[1],
parameter_code = "00060")
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/peaks/items?f=json&lang=en-US&monitoring_location_id=USGS-04073458¶meter_code=00060&limit=50000
#> Remaining requests this hour:2308
# }
