get_stations | R Documentation |
Get station metadata from the USDA National Water and Climate Center Air and Water Database REST API. This includes their spatial coordinates.
get_stations(aoi = NULL, elements, awdb_options = set_options())
aoi |
|
elements |
character vector, abbreviations or codes for variables of interest (e.g., "SMS" for "Soil Moisture Percent"). See Details for available elements and codes. |
awdb_options |
an |
This endpoint will accept the following query parameters via set_options()
:
station_names
dco_codes
county_names
hucs
return_forecast_metadata
return_reservoir_metadata
return_element_metadata
active_only
You may also specify networks
. The networks
parameter is used internally
to build unique station triplet identifiers of the form
station:state:network
, so it serves to filter stations to just those
networks.
See set_options()
for more details.
Elements are specified as triplets of the form
elementCode:heightDepth:ordinal
. Any part of the element triplet can
contain the *
wildcard character. Both heightDepth
and ordinal
are
optional. The unit of heightDepth
is inches. If ordinal
is not specified,
it is assumed to be 1. Here are some examples:
"WTEQ"
- return all snow water equivalent values.
"SMS:-8"
- return soil moisture values observed 8 inches below the surface.
"SMS:*"
- return soil moisture values for all measured depths.
an sf
table with station metadata.
# get all stations in aoi
get_stations(
bear_lake,
elements = "*"
)
# get all stations in aoi that measure WTEQ
get_stations(
bear_lake,
elements = "WTEQ"
)
# get all stations in aoi that are part of SNTL network
get_stations(
bear_lake,
elements = "*",
awdb_options = set_options(networks = "SNTL")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.