API Reference

Documentation for DataRetrieval.jl's public functions.

Index

DataRetrieval.NWISModule
module NWIS

Provides functions for retrieving legacy data from the National Water Information System (NWIS). Includes functions to retrieve daily values (dv), instantaneous values (iv), and site metadata.

Note: Legacy NWIS services are being decommissioned by the USGS. Users are encouraged to migrate to the modernized DataRetrieval.WaterData functions (e.g., WaterData.daily, WaterData.continuous, WaterData.samples) which use the new Water Data APIs.

DataRetrieval.WQPModule
module WQP

Provides functions for retrieving data from the Water Quality Portal (WQP). Includes functions to retrieve results, sites, organizations, projects, activities, detection limits, habitat metrics, project weights, and activity metrics.

DataRetrieval.WaterDataModule
module WaterData

Provides functions for retrieving data from the modernized USGS Water Data API and Samples API. Includes functions for generic OGC API retrieval, daily values (daily), continuous values (continuous), monitoring locations, field measurements, series metadata, and chemical sample results (samples, results).

DataRetrieval.NLDIModule
module NLDI

Provides functions for retrieving data from the Network Linked Data Index (NLDI) API. Includes functions to navigate flowlines (flowlines), find upstream/downstream basin boundaries (basin), and discover linked features (features and search).

Note: If you wish to receive spatial features as genuine GeoDataFrames instead of standard Julia DataFrames containing raw GeoJSON geometries, you must add and load GeoDataFrames.jl in your environment (using GeoDataFrames).

NWIS Functions

Functions that are related to the National Water Information System (NWIS).

DataRetrieval.NWIS.urlFunction
url(site_numbers; kwargs...)

Function to construct a Nwis URL based on the different available parameters.

DataRetrieval.NWIS.dvFunction
dv(site_numbers, parameter_cd; start_date="", end_date="", stat_cd="00003", format="rdb")

Function to obtain daily value data from the Nwis web service.

DataRetrieval.NWIS.pcodeFunction
pcode(pcodes)

Function to obtain parameter code information from the Nwis web service.

DataRetrieval.NWIS.siteFunction
site(site_numbers)

Function to obtain site information from the Nwis web service.

DataRetrieval.NWIS.unitFunction
iv(site_numbers, parameter_cd; start_date="", end_date="", format="rdb")

Function to obtain instantaneous value data from the Nwis web service.

DataRetrieval.NWIS.uvFunction
iv(site_numbers, parameter_cd; start_date="", end_date="", format="rdb")

Function to obtain instantaneous value data from the Nwis web service.

DataRetrieval.NWIS.ivFunction
iv(site_numbers, parameter_cd; start_date="", end_date="", format="rdb")

Function to obtain instantaneous value data from the Nwis web service.

WQP Functions

Functions that are related to the Water Quality Portal.

DataRetrieval.WQP.urlFunction
url(service; legacy=true)

Function to construct the URL for the Wqp service.

WaterData Functions

Functions that are related to the USGS Water Data APIs.

DataRetrieval.WaterData.samplesFunction
samples(; ssl_check=true, service="results", profile="fullphyschem", kwargs...)

Flexible query of the USGS Samples database.

DataRetrieval.WaterData.dataFunction

data(service; cql=nothing, ssl_check=true, kwargs...)

Generalized USGS Waterdata OGC retrieval for any supported collection.

DataRetrieval.WaterData.ogc_requestsFunction

checkogcrequests(; endpoint="daily", requesttype="queryables", sslcheck=true)

Request OGC collection metadata (queryables or schema) for a Waterdata collection.

DataRetrieval.WaterData.ogc_paramsFunction

ogcparams(service; sslcheck=true)

Get parameter descriptions for a Waterdata OGC collection using the collection schema endpoint.

DataRetrieval.WaterData.dailyFunction
daily(; ssl_check=true, kwargs...)

Get daily observations from the USGS Waterdata OGC API (daily collection).

DataRetrieval.WaterData.continuousFunction
continuous(; ssl_check=true, kwargs...)

Get continuous observations from the USGS Waterdata OGC API (continuous collection).

DataRetrieval.WaterData.stats_porFunction
stats_por(; ssl_check=true, expand_percentiles=true, kwargs...)

Query period-of-record statistics from the Waterdata statistics API.

NLDI Functions

Functions that are related to the USGS NLDI API.

DataRetrieval.NLDI.flowlinesFunction
flowlines(navigation_mode; comid=nothing, distance=5, feature_source=nothing, feature_id=nothing, stop_comid=nothing, trim_start=false, as_json=false)
DataRetrieval.NLDI.basinFunction
basin(feature_source, feature_id; simplified=true, split_catchment=false, as_json=false)
DataRetrieval.NLDI.featuresFunction
features(; data_source=nothing, navigation_mode=nothing, distance=50, feature_source=nothing, feature_id=nothing, comid=nothing, lat=nothing, long=nothing, as_json=false)
DataRetrieval.NLDI.searchFunction
search(; feature_source=nothing, feature_id=nothing, navigation_mode=nothing, data_source=nothing, find="features", comid=nothing, lat=nothing, long=nothing, distance=50, as_json=false)
DataRetrieval.set_token!Function
set_token!(token::AbstractString)

Set a USGS WaterData API token for this Julia session. The token is attached to requests as the X-Api-Key header and takes precedence over the API_USGS_PAT environment variable.

DataRetrieval.clear_token!Function
clear_token!()

Clear the session token set by set_token!. If API_USGS_PAT is present in the environment, requests will continue to use that value.