This service provides endpoints for access to computations on the historical record regarding water conditions. For more information regarding the calculation of statistics and other details, please visit the Statistics documentation page.
Note: The /statistics API is under active beta development and subject to change. Improved handling of significant figures will be addressed in a future release.
read_waterdata_stats_por Returns day-of-year and month-of-year
statistics matching your query.
read_waterdata_stats_daterange Returns monthly and annual statistics matching
your query.
Usage
read_waterdata_stats_por(
approval_status = NA,
computation_type = NA_character_,
country_code = NA_character_,
state_code = NA_character_,
county_code = NA_character_,
start_date = NA_character_,
end_date = NA_character_,
monitoring_location_id = NA_character_,
parent_time_series_id = NA_character_,
site_type_code = NA_character_,
site_type_name = NA_character_,
parameter_code = NA_character_,
page_size = NA
)
read_waterdata_stats_daterange(
approval_status = NA,
computation_type = NA_character_,
country_code = NA_character_,
state_code = NA_character_,
county_code = NA_character_,
start_date = NA_character_,
end_date = NA_character_,
monitoring_location_id = NA_character_,
parent_time_series_id = NA_character_,
site_type_code = NA_character_,
site_type_name = NA_character_,
parameter_code = NA_character_,
page_size = NA
)Arguments
- approval_status
Whether to include approved and/or provisional observations. At this time, only approved observations are returned.
- computation_type
Desired statistical computation method. Available values: "arithmetic_mean", "maximum", "median", "minimum", "percentile".
- country_code
Country Query Parameter. Accepts multiple values (see examples). If one of country, county, or state code is supplied then the other two arguments do not need to be specified.
- state_code
State Query Parameter. Accepts multiple values in a character vector.
- county_code
County Query Parameter. Accepts multiple values in a character vector.
- start_date
Start Date Query Parameter. The logic is inclusive i.e., it will also return records that match the date. If an end date is supplied, but no start date is supplied, then statistics will be supplied for the entire period of record ending with the end date. If an end date is not supplied, but a start date is supplied then statistics will be supplied for the period of record following the start date. If no start or end date are supplied then statistics will be supplied for the entire period of record.
- end_date
End Date Query Parameter. The logic is inclusive i.e., it will also return records that match the date.
- monitoring_location_id
Each monitoring location has been assigned a unique station number that places them in downstream order. Accepts multiple values in a character vector.
- parent_time_series_id
The parent_time_series_id returns statistics tied to a particular database entry. Accepts multiple values in a character vector. If no parent time series identifier is supplied, then all records matching the rest of the provided criteria will be returned.
- site_type_code
Site Type Code Query Parameter. Accepts multiple values in a character vector. If no Site Type code is specified, statistics of all site types with the matching Monitoring Location Identifier will be returned.
- site_type_name
Site Type Name Query Parameter. If no Site Type name is specified, statistics of all site types with the matching Monitoring Location Identifier will be returned.
- parameter_code
USGS Parameter Code Query Parameter. Accepts multiple values in a character vector. If no USGS parameter code is specified, but a Monitoring Location Identifier is supplied, then all statistics and their parameter codes with a matching monitoring location identifier will be returned. All statistics within the period of record will be returned if no parameter code or monitoring location identifier are specified.
- page_size
Return a defined number of results (default: 1000).
Examples
# \donttest{
# All day-of-year and month-of-year statistics for two sites
x1 <- read_waterdata_stats_por(
monitoring_location_id = c("USGS-02319394", "USGS-02171500")
)
#> Requesting:
#> https://api.waterdata.usgs.gov/statistics/v0/observationNormals?monitoring_location_id=USGS-02319394&monitoring_location_id=USGS-02171500
#> Remaining requests this hour:
# Request temperature percentiles for specific month-day range
# Returns:
# - Day-of-year temperature percentiles for each day between June 1 through June 15.
# - Month-of-year percentiles for June, computed using
# all June data (not just June 1 through June 15).
# Note: the month-of-year percentiles are returned only when the month-day range includes
# the beginning of the month (e.g., "06-01")
x2 <- read_waterdata_stats_por(
monitoring_location_id = c("USGS-02319394", "USGS-02171500"),
parameter_code = "00010",
start_date = "06-01", end_date = "06-15",
computation_type = "percentile"
)
#> Requesting:
#> https://api.waterdata.usgs.gov/statistics/v0/observationNormals?computation_type=percentile&start_date=06-01&end_date=06-15&monitoring_location_id=USGS-02319394&monitoring_location_id=USGS-02171500¶meter_code=00010
#> Remaining requests this hour:
# All calendar month, calendar year, and water year statistics for two sites
x3 <- read_waterdata_stats_daterange(
monitoring_location_id = c("USGS-02319394", "USGS-02171500")
)
#> Requesting:
#> https://api.waterdata.usgs.gov/statistics/v0/observationIntervals?monitoring_location_id=USGS-02319394&monitoring_location_id=USGS-02171500
#> Remaining requests this hour:
# Request specific gage height and discharge summaries for a limited date range
# Returns:
# - calendar month summaries for each month between January, 2010 through December, 2011
# - calendar year summaries for 2010 and 2011
# - water year summaries for WY2010, WY2011, and WY2012
x4 <- read_waterdata_stats_daterange(
monitoring_location_id = c("USGS-02319394", "USGS-02171500"),
parameter_code = c("00065", "00060"),
start_date = "2010-01-01", end_date = "2011-12-31",
computation_type = c("minimum", "median", "maximum")
)
#> Requesting:
#> https://api.waterdata.usgs.gov/statistics/v0/observationIntervals?computation_type=minimum&computation_type=median&computation_type=maximum&start_date=2010-01-01&end_date=2011-12-31&monitoring_location_id=USGS-02319394&monitoring_location_id=USGS-02171500¶meter_code=00065¶meter_code=00060
#> Remaining requests this hour:
# }
