Spain Fetcher

Fetcher for Spanish river gauge data from ROAN.

class rivretrieve.spain.SpainFetcher[source]

Bases: RiverDataFetcher

Fetches river gauge data from Spain’s National Hydrological Data System (ROAN).

Data Source: MITECO (https://www.miteco.gob.es/es/agua/temas/evaluacion-de-los-recursos-hidricos/sistema-informacion-anuario-aforos/default.aspx)

Supported Variables:
  • 'discharge_daily_mean' (m³/s)

static get_available_variables() tuple[str, ...][source]

Returns a tuple of supported variables.

static get_cached_metadata() DataFrame[source]

Retrieves a DataFrame of available Spanish gauge IDs and metadata.

This method loads the metadata from a cached CSV file located in the rivretrieve/cached_site_data/ directory.

Returns:

A DataFrame indexed by gauge_id, containing site metadata.

Return type:

pd.DataFrame

get_data(gauge_id: str, variable: str, start_date: str | None = None, end_date: str | None = None) DataFrame[source]

Fetches and parses time series data for a specific gauge and variable.

Parameters:
  • gauge_id – The site-specific identifier for the gauge.

  • variable – The variable to fetch.

  • start_date – Optional start date in ‘YYYY-MM-DD’ format.

  • end_date – Optional end date in ‘YYYY-MM-DD’ format.

Returns:

A pandas DataFrame indexed by time.

Return type:

pd.DataFrame

get_metadata() DataFrame[source]

Downloads and returns ROAN station metadata from MITECO.

Columns are translated from Spanish to English based on the mapping provided in issue #28.

Returns:

A DataFrame indexed by gauge_id, containing site metadata.

Return type:

pd.DataFrame