| Title: | Hydrologic Station Catalogs and Time Series from Public APIs |
|---|---|
| Description: | Provides a unified, extensible interface to discover hydrologic stations and download daily time series (e.g., water discharge, water level, water temperature, and several other water quality parameter) from national and regional public APIs. 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.3 |
| Built: | 2026-06-05 06:23:25 UTC |
| Source: | https://github.com/bafg-bund/hydrodownloadr |
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 tibble used by the JP MLIT adapter to speed up station discovery.
data(jp_mlit_meta)data(jp_mlit_meta)
A tibble/data.frame with one row per station and typical columns:
MLIT station identifier (character)
Station name (character)
River name, if available (character)
Latitude in WGS84 (double)
Longitude in WGS84 (double)
Drainage area in km^2, if available (double)
Altitude in meters, if available (double)
ISO country code (character)
Adapter provider id, e.g. "JP_MLIT" (character)
Provider name (character)
MLIT; see package README for licensing.
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.