| Title: | Hydrologic Station Catalogs and Time Series from Public APIs |
|---|---|
| Description: | Provides a unified, extensible interface for discovering hydrological stations and downloading hydrological daily time series (e.g., water discharge, water level, water temperature) and discrete water-quality observations from national and regional public APIs. Water-quality observations are retained at their original sampling timestamps. Includes a provider registry, S3 generics 'stations' and 'timeseries', licensing metadata, date-range and 'complete history' modes, rate limiting and retries, optional authentication via environment variables, tidy outputs, UTF-8 to ASCII transliteration, and WGS84 coordinates. Designed for reproducible workflows and straightforward addition of new providers. Background and use cases are described in Farber et al. (2025) <doi:10.5194/essd-17-4613-2025> and Farber et al. (2023) <doi:10.57757/IUGG23-2838>. |
| Authors: | Henning Plessow [aut, cre], Global Runoff Data Centre [ctb] |
| Maintainer: | Henning Plessow <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.5 |
| Built: | 2026-10-14 11:21:30 UTC |
| Source: | https://github.com/bafg-bund/hydrodownloadr |
The catalogue includes all physicochemical parameters, nutrients,
micropollutants and the few hydrological parameters stored in NAWA. The
parameter column shows how each provider parameter is handled by
timeseries(). All entries classified as water_quality are returned
together when parameter = "water_quality" is requested.
bafu_nawa_parameters(x, ...)bafu_nawa_parameters(x, ...)
x |
A |
... |
Unused. |
A tibble containing the provider's parameter catalogue.
Catchment area and altitude for Finnish SYKE runoff stations.
Area may be NA for a few stations; altitude may still be present.
Used to compute discharge from runoff time series:
discharge_m3s = (value_lps_per_km2 * area_km2) / 1000.
data(fi_syke_runoff_meta)data(fi_syke_runoff_meta)
A tibble with:
Character. SYKE Paikka_Id.
Numeric (km^2). May be NA.
Numeric (m). May be NA.
Finnish Environment Institute (SYKE).
Preloaded metadata for Hub'Eau stations, built offline from the Hub'Eau
referentials plus scraped site/station fiches (area, site altitude,
gauge-zero altitude, vertical datum at site). Used to speed up
stations() for the FR_HUBEAU provider.
A data frame/tibble with columns:
Character. Hub'Eau site code.
Character. Hub'Eau station code.
Numeric (km). Catchment area from site fiche; may be NA.
Numeric (m). API referential altitude (hydrometry in mm to m; temperature in m).
Numeric (m). Site altitude parsed from the site fiche; may be NA.
Numeric (m). "Cote du zero d'echelle" from station fiche; may be NA.
Character. Site-level vertical datum label; may be NA.
POSIXct (UTC). Timestamp when the row was scraped.
Built by data-raw/fr_hubeau_meta_build.R. The file
data/fr_hubeau_meta.rda is shipped with the package and may be refreshed
out-of-band. A build-date string is also stored in the object attribute
metadata_date.
Hub'Eau APIs and https://www.hydro.eaufrance.fr/ site/station fiches.
Create a hydro service object
hydro_service(provider_id, ...)hydro_service(provider_id, ...)
provider_id |
ID as listed by |
... |
Reserved for future use. |
An object of class "hydro_service" (a list) containing the provider
configuration used by stations() and timeseries() (e.g. provider_id,
provider_name, country, base_url, and other adapter-specific settings).
List available providers
hydro_services()hydro_services()
A tibble with columns: provider_id, provider_name, country, base_url, license, license_link, access_class, reuse_class, is_open_data
A processed station metadata table used internally by the JP MLIT adapter. Coordinates from the official MLIT station pages are preferred when available. Coordinates from the supplied metadata CSV are used as a fallback.
data(jp_mlit_meta)data(jp_mlit_meta)
A tibble/data.frame with one row per station:
MLIT station identifier (character).
English station name (character).
English river-system name (character).
Selected latitude in WGS84 decimal degrees (double).
Selected longitude in WGS84 decimal degrees (double).
Drainage area in square kilometres, if available (double).
Gauge-zero elevation in metres, if available (double).
Original Japanese station name (character).
Latitude obtained from the official MLIT station page (double).
Longitude obtained from the official MLIT station page (double).
Source used for lat and lon. Either
"MLIT website" or "MLIT metadata CSV" (character).
Japan Ministry of Land, Infrastructure, Transport and Tourism (MLIT).
List available countries
list_countries()list_countries()
A character vector of country codes (e.g. ISO 3166-1 alpha-2) for which at least one provider is available.
List stations for a provider
stations(x, ...)stations(x, ...)
x |
A |
... |
Passed to provider-specific methods. |
A tibble with station metadata.
# Offline: enumerate providers (no network) s <- hydro_services() head(names(s)) # Online (opt-in): fetch stations x <- hydro_service("SE_SMHI") st <- stations(x) head(st)# Offline: enumerate providers (no network) s <- hydro_services() head(names(s)) # Online (opt-in): fetch stations x <- hydro_service("SE_SMHI") st <- stations(x) head(st)
Loads the cached ANA station catalogue (if present) or rebuilds it from a
locally downloaded SNIRH inventory (InventarioDD_MM_YYYY.zip / .mdb)
when update = TRUE.
## S3 method for class 'hydro_service_BR_ANA' stations(x, ...)## S3 method for class 'hydro_service_BR_ANA' stations(x, ...)
x |
A |
... |
Named arguments:
|
A tibble with ANA station metadata.
Retrieve time series for a provider
timeseries( x, parameter, stations = NULL, start_date = NULL, end_date = NULL, mode = c("range", "complete"), ... )timeseries( x, parameter, stations = NULL, start_date = NULL, end_date = NULL, mode = c("range", "complete"), ... )
x |
A |
parameter |
One of "water_discharge","water_level","water_temperature","water_velocity". |
stations |
Optional character vector of station IDs. |
start_date, end_date
|
|
mode |
Either |
... |
Passed to provider-specific methods. |
A tibble with columns: country, provider_id, provider_name, station_id, parameter, timestamp, value, unit, quality_code, source_url.
# Offline: construct a service object (no network) x <- hydro_service("SE_SMHI") # Online (opt-in): one station for a short range st <- head(stations(x)$station_id, 1) ts <- timeseries(x, parameter = "water_discharge", stations = st, start_date = "2020-01-01", end_date = "2020-01-10") head(ts)# Offline: construct a service object (no network) x <- hydro_service("SE_SMHI") # Online (opt-in): one station for a short range st <- head(stations(x)$station_id, 1) ts <- timeseries(x, parameter = "water_discharge", stations = st, start_date = "2020-01-01", end_date = "2020-01-10") head(ts)
List supported parameters/units for a provider
timeseries_parameters(x, ...)timeseries_parameters(x, ...)
x |
A |
... |
Reserved for future use. |
A tibble with columns: parameter, code, unit.