aemetxfb.clim
Climate data module.
Climate module for AEMet data.
This module provides access to climate-related data including meteorological station information.
- aemetxfb.clim.get_normals(loc)[source]
Get climate normals for a given station.
Fetches climatological normal values from AEMet for the specified station identifier.
- Parameters:
loc (str) – Station identifier, must be one of the keys in STATIONS dictionary (e.g., ‘B893’ for Menorca Aeropuerto).
- Returns:
Climate normals data with month names in English as index and the following columns:
Code
Name
Description
T
Temperatura
Average monthly/annual temperature (°C)
TM
Maxima
Monthly/yearly mean of daily maximum temperatures (°C)
Tm
Minima
Monthly/yearly mean of daily minimum temperatures (°C)
R
Precipitacion
Mean monthly/annual precipitation (mm)
H
Humedad
Mean relative humidity (%)
DR
Dias_prec
Monthly/yearly mean number of days with precipitation >= 1mm
DN
Dias_nieve
Monthly/yearly mean number of days with snow
DT
Dias_tormenta
Monthly/yearly mean number of days with thunderstorms
DF
Dias_niebla
Monthly/yearly mean number of days with fog
DH
Dias_helada
Monthly/yearly mean number of days with frost
DD
Dias_despej
Monthly/yearly mean number of clear days
I
Horas_sol
Monthly/yearly mean number of sunshine hours
- Return type:
- Raises:
ValueError – If loc is not a valid station identifier.
ValueError – If the CSV format is unexpected.
Exception – If the fetch fails.
Notes
For more information about climate normals data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/valoresclimatologicos/ayuda
Examples
Get climate normals for Menorca Aeropuerto:
>>> from aemetxfb.clim import get_normals >>> df = get_normals('B893') >>> df.loc['January', 'T'] 10.8
Get annual summary:
>>> df.loc['Year', ['T', 'R', 'H']] T 17.2 R 546.0 H 72.0 Name: Year, dtype: float64
Get average annual temperature for Madrid Aeropuerto:
>>> madrid = get_normals('3129') >>> madrid.loc['Year', 'T'] 14.5
- aemetxfb.clim.get_normals_map(output_path)[source]
Download climate normals maps from AEMet.
Downloads a tar.gz file containing climate normals maps for Spain (peninsular Spain, Balearic Islands, and Canary Islands) for the period 1981-2010.
The maps correspond to those contained in the publication “Mapas climáticos de España (1981-2010) y ETo (1996-2016)”.
The downloaded tar.gz file includes the following climate variables:
Precipitación máxima diaria media (mm): Average of daily maximum precipitations for each of the thirty years in the 1981-2010 period. Gives an idea of the maximum daily precipitation intensity.
Precipitación acumulada (mm): Mean annual and monthly accumulated precipitation in the 1981-2010 period.
Precipitación acumulada estacional (mm): Mean accumulated precipitation for each season in the 1981-2010 period.
Núm. med. días con precipitación ≥ 0,1 mm: Mean annual number of days with precipitation ≥ 0.1 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 1 mm: Mean annual number of days with precipitation ≥ 1 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 10 mm: Mean annual number of days with precipitation ≥ 10 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 30 mm: Mean annual number of days with precipitation ≥ 30 mm in the 1981-2010 period.
Temperatura media (°C): Mean annual and monthly temperature in the 1981-2010 period.
Temperatura mínima media (°C): Mean of annual and monthly minimum temperatures in the 1981-2010 period.
Temperatura máxima media (°C): Mean of annual and monthly maximum temperatures in the 1981-2010 period.
Clasificación climática de Köppen: Köppen-Geiger climate classification for the 1981-2010 period.
Núm. med. días de nieve: Mean annual number of snow days in the 1981-2010 period.
Insolación: Mean annual number of sunshine hours in the 1981-2010 period.
Maps can be generated for the entire year, for a month, or for a climatological season.
For more information about climate normals data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/valoresclimatologicos/ayuda
- Parameters:
output_path (str | pathlib.Path) – Path where the tar.gz file will be downloaded. Must have a
.tar.gzextension.- Returns:
Path to the downloaded tar.gz file.
- Return type:
- Raises:
ValueError – If
output_pathis empty, None, or doesn’t have a.tar.gzextension.Exception – If the download fails.
Examples
Download climate normals maps:
>>> from aemetxfb.clim import get_normals_map >>> path = get_normals_map("clima.tar.gz") >>> print(path) 'clima.tar.gz'
Download to a specific location:
>>> from pathlib import Path >>> output = Path("/tmp/clima_maps.tar.gz") >>> result = get_normals_map(output)
- aemetxfb.clim.get_clim_extremes(loc, when='year')[source]
Get absolute climate extremes for a given station.
Fetches absolute extreme climate values (maximum or minimum values recorded since 1920) from AEMet for the specified station identifier. Values are calculated per month or annually.
Available variables (index names without accents):
Max. num. de dias de lluvia en el mes
Max. num. de dias de nieve en el mes
Max. num. de dias de tormenta en el mes
Prec. max. en un dia (l/m2)
Prec. mensual mas alta (l/m2)
Prec. mensual mas baja (l/m2)
Racha max. viento (velocidad, km/h)
Racha max. viento (direccion)
Tem. max. absoluta (ºC)
Tem. media de las max. mas alta (ºC)
Tem. media de las min. mas baja (ºC)
Tem. media mas alta (ºC)
Tem. media mas baja (ºC)
Tem. min. absoluta (ºC)
- Parameters:
loc (str) – Station identifier, must be one of the keys in CLIM_EXTREMES_STATIONS dictionary (e.g., ‘1387’ for A Coruña).
when (str, optional) – Period for which to fetch extremes. Valid values are: ‘january’, ‘february’, ‘march’, ‘may’, ‘june’, ‘july’, ‘august’, ‘september’, ‘october’, ‘november’, ‘december’, ‘year’. Default is ‘year’.
- Returns:
Climate extremes data with variable names (without accents) as index and the following columns:
value: Numeric value of the extreme
timestamp: Date string when the extreme was recorded in format: - “YYYY” for year only (e.g., “1935”) - “YYYY/MM” for month and year (e.g., “2010/02”) - “YYYY/MM/DD” for day, month and year (e.g., “2012/08/12”) - “YYYY/MM/DD HH:MM” with time (e.g., “2020/05/10 03:00”)
The DataFrame also has a
nameattribute with the station name.- Return type:
- Raises:
ValueError – If
locis not a valid station identifier or ifwhenis invalid.Exception – If the fetch fails.
Notes
For more information about climate extremes data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos
Timestamps are returned as strings in order to avoid ambiguities as some data have different temporal resolution.
Examples
Get climate extremes for A Coruña:
>>> from aemetxfb.clim import get_clim_extremes >>> df = get_clim_extremes('1387') >>> df.loc['Tem. max. absoluta (ºC)', 'value'] 39.6
Get extremes for a specific month:
>>> df = get_clim_extremes('1387', when='january')
Get extremes for Madrid Aeropuerto:
>>> madrid = get_clim_extremes('3129') >>> madrid.loc['Tem. min. absoluta (ºC)', 'timestamp'] '1963/12/29'
- aemetxfb.clim.get_clim_threshold_day(date_input, param)[source]
Get climate threshold data for a specific day and parameter.
Fetches information about stations where the maximum precipitation intensity or maximum wind gust has exceeded certain thresholds commonly used in relation to insurance coverage.
The information has been obtained from provisional data and may be subject to modifications after the underlying data has been validated. Also indicates that data from some stations are not updated daily. Available data are from the current month and the previous three months.
- Parameters:
date_input (date | datetime) – The date for which to fetch threshold data. Must be within the current month or the previous three months. For example, if today is April 11, valid dates are from January 1 to April 11.
param (str) –
Threshold parameter to fetch. Valid values are:
’pptSup40’: Precipitation above 40 mm
’vtoSup70’: Wind above 70 km/h
’vtoSup80’: Wind above 80 km/h
’vtoSup90’: Wind above 90 km/h
’vtoSup96’: Wind above 96 km/h
- Returns:
DataFrame containing threshold data with the following columns:
All properties from the GeoJSON (e.g., ‘nombre_est’, ‘i_c’, ‘altitud’, and the parameter value column like ‘pptSup40’):
nombre_est: name of the station
i_c: id of the station
altitud: altitude of the station
pptSup40|vtoSup70|vtoSup80|vtoSup90|vtoSup96: threshold exceeded (1.0) or not (0.0)
’lon’: Longitude (first coordinate value)
’lat’: Latitude (second coordinate value)
The parameter value column (same name as
param) contains: - 1.0 for ‘si’ (threshold exceeded) - 0.0 for ‘no’ (threshold not exceeded) - NaN for any other value- Return type:
- Raises:
ValueError – If
date_inputis outside the valid range (more than 3 months in the past or in the future) or ifparamis not valid.Exception – If the fetch fails.
Notes
For more information about climate thresholds data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/superacion_umbrales/ayuda
The API provides data in GeoJSON format with station locations and threshold exceedance information.
Examples
Get precipitation threshold data:
>>> from aemetxfb.clim import get_clim_threshold_day >>> from datetime import date >>> result = get_clim_threshold_day(date(2024, 1, 15), 'pptSup40') >>> result.columns Index(['nombre_est', 'i_c', 'altitud', 'pptSup40', 'lon', 'lat'], dtype='object')
Get wind threshold data:
>>> result = get_clim_threshold_day(date(2024, 1, 15), 'vtoSup96')
- aemetxfb.clim.get_clim_threshold_month(date_input)[source]
Get monthly climate threshold data.
Fetches information about stations where the maximum precipitation intensity or maximum wind gust has exceeded certain thresholds commonly used in relation to insurance coverage.
The information has been obtained from provisional data and may be subject to modifications after the underlying data has been validated. Also indicates that data from some stations are not updated daily. Available data are from the current month and the previous three months.
- Parameters:
date_input (date | datetime) – The date for which to fetch monthly threshold data. Must be within the current month or the previous three months. For example, if today is April 11, valid dates are from January 1 to April 11.
- Returns:
DataFrame containing threshold data with columns from the JSON response:
’nombre_est’: name of the station
’i_c’: id of the station
’pptSup40’: Days of the month with Precipitation above 40 mm
’vtoSup70’: Days of the month with Wind above 70 km/h
’vtoSup80’: Days of the month with Wind above 80 km/h
’vtoSup90’: Days of the month with Wind above 90 km/h
’vtoSup96’: Days of the month with Wind above 96 km/h
- Return type:
- Raises:
ValueError – If
date_inputis outside the valid range (more than 3 months in the past or in the future).Exception – If the fetch fails.
Notes
For more information about climate thresholds data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/superacion_umbrales/ayuda
The API provides data in JSON format with station information and threshold exceedance values.
Examples
Get monthly threshold data:
>>> from aemetxfb.clim import get_clim_threshold_month >>> from datetime import date >>> result = get_clim_threshold_month(date(2024, 1, 15)) >>> result.columns Index(['nombre_est', 'i_c', 'altitud', 'vtoSup96'], dtype='object')
- aemetxfb.clim.get_clim_ephem(day=0, month=0, year=0, keyword='')[source]
Get climate ephemerides and commemorations.
Fetches information about relevant meteorological events, both historical/anecdotic and climatological. Events are divided into ephemerides and commemorations.
- Parameters:
day (int, optional) – Day of the month. Default is 0 (not used). Valid range is 1-31, but limited by the month value (28, 29, 30, or 31).
month (int, optional) – Month of the year. Default is 0 (not used). Valid range is 1-12. This parameter limits the maximum valid value for
day.year (int, optional) – Year. Default is 0 (not used). Valid range is 1 to current year.
keyword (str, optional) –
Search keyword to filter events. Default is “” (not used).
At least one parameter must be provided (non-default value).
- Returns:
Dictionary with the following structure:
’search_params’: String describing the search parameters
’Efemérides’: List of tuples (date_string, description)
’Conmemoraciones’: List of tuples (date_string, description)
- Return type:
- Raises:
ValueError – If parameters are invalid: - day outside valid range for the given month - month outside 1-12 - year outside valid range (0, negative, or future) - no parameters provided (at least one non-default is required)
Exception – If the fetch fails.
Notes
For more information about climate ephemerides, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/efemerides_sucesos
The API returns CSV data that is parsed into structured format.
Examples
Get ephemerides for January 1st:
>>> from aemetxfb.clim import get_clim_ephem >>> result = get_clim_ephem(day=1, month=1) >>> 'Efemérides' in result True
Search for events with keyword:
>>> result = get_clim_ephem(keyword="mallorca")
Search for events in a specific year:
>>> result = get_clim_ephem(year=2020)
Combine parameters:
>>> result = get_clim_ephem(day=15, month=6, year=2020, keyword="tormenta")
Submodules
aemetxfb.clim.clim_ephem
Climate ephemerides data from AEMet.
This module provides access to relevant meteorological events, both historical/anecdotic and climatological, divided into ephemerides and commemorations.
- aemetxfb.clim.clim_ephem.get_clim_ephem(day=0, month=0, year=0, keyword='')[source]
Get climate ephemerides and commemorations.
Fetches information about relevant meteorological events, both historical/anecdotic and climatological. Events are divided into ephemerides and commemorations.
- Parameters:
day (int, optional) – Day of the month. Default is 0 (not used). Valid range is 1-31, but limited by the month value (28, 29, 30, or 31).
month (int, optional) – Month of the year. Default is 0 (not used). Valid range is 1-12. This parameter limits the maximum valid value for
day.year (int, optional) – Year. Default is 0 (not used). Valid range is 1 to current year.
keyword (str, optional) –
Search keyword to filter events. Default is “” (not used).
At least one parameter must be provided (non-default value).
- Returns:
Dictionary with the following structure:
’search_params’: String describing the search parameters
’Efemérides’: List of tuples (date_string, description)
’Conmemoraciones’: List of tuples (date_string, description)
- Return type:
- Raises:
ValueError – If parameters are invalid: - day outside valid range for the given month - month outside 1-12 - year outside valid range (0, negative, or future) - no parameters provided (at least one non-default is required)
Exception – If the fetch fails.
Notes
For more information about climate ephemerides, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/efemerides_sucesos
The API returns CSV data that is parsed into structured format.
Examples
Get ephemerides for January 1st:
>>> from aemetxfb.clim import get_clim_ephem >>> result = get_clim_ephem(day=1, month=1) >>> 'Efemérides' in result True
Search for events with keyword:
>>> result = get_clim_ephem(keyword="mallorca")
Search for events in a specific year:
>>> result = get_clim_ephem(year=2020)
Combine parameters:
>>> result = get_clim_ephem(day=15, month=6, year=2020, keyword="tormenta")
aemetxfb.clim.clim_extremes
Climate extremes data from AEMet.
This module provides access to absolute extreme climate values for Spanish meteorological stations.
- aemetxfb.clim.clim_extremes.get_clim_extremes(loc, when='year')[source]
Get absolute climate extremes for a given station.
Fetches absolute extreme climate values (maximum or minimum values recorded since 1920) from AEMet for the specified station identifier. Values are calculated per month or annually.
Available variables (index names without accents):
Max. num. de dias de lluvia en el mes
Max. num. de dias de nieve en el mes
Max. num. de dias de tormenta en el mes
Prec. max. en un dia (l/m2)
Prec. mensual mas alta (l/m2)
Prec. mensual mas baja (l/m2)
Racha max. viento (velocidad, km/h)
Racha max. viento (direccion)
Tem. max. absoluta (ºC)
Tem. media de las max. mas alta (ºC)
Tem. media de las min. mas baja (ºC)
Tem. media mas alta (ºC)
Tem. media mas baja (ºC)
Tem. min. absoluta (ºC)
- Parameters:
loc (str) – Station identifier, must be one of the keys in CLIM_EXTREMES_STATIONS dictionary (e.g., ‘1387’ for A Coruña).
when (str, optional) – Period for which to fetch extremes. Valid values are: ‘january’, ‘february’, ‘march’, ‘may’, ‘june’, ‘july’, ‘august’, ‘september’, ‘october’, ‘november’, ‘december’, ‘year’. Default is ‘year’.
- Returns:
Climate extremes data with variable names (without accents) as index and the following columns:
value: Numeric value of the extreme
timestamp: Date string when the extreme was recorded in format: - “YYYY” for year only (e.g., “1935”) - “YYYY/MM” for month and year (e.g., “2010/02”) - “YYYY/MM/DD” for day, month and year (e.g., “2012/08/12”) - “YYYY/MM/DD HH:MM” with time (e.g., “2020/05/10 03:00”)
The DataFrame also has a
nameattribute with the station name.- Return type:
- Raises:
ValueError – If
locis not a valid station identifier or ifwhenis invalid.Exception – If the fetch fails.
Notes
For more information about climate extremes data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos
Timestamps are returned as strings in order to avoid ambiguities as some data have different temporal resolution.
Examples
Get climate extremes for A Coruña:
>>> from aemetxfb.clim import get_clim_extremes >>> df = get_clim_extremes('1387') >>> df.loc['Tem. max. absoluta (ºC)', 'value'] 39.6
Get extremes for a specific month:
>>> df = get_clim_extremes('1387', when='january')
Get extremes for Madrid Aeropuerto:
>>> madrid = get_clim_extremes('3129') >>> madrid.loc['Tem. min. absoluta (ºC)', 'timestamp'] '1963/12/29'
aemetxfb.clim.clim_normals
Climate normals data from AEMet.
This module provides access to climatological normal values for Spanish meteorological stations.
- aemetxfb.clim.clim_normals.get_normals(loc)[source]
Get climate normals for a given station.
Fetches climatological normal values from AEMet for the specified station identifier.
- Parameters:
loc (str) – Station identifier, must be one of the keys in STATIONS dictionary (e.g., ‘B893’ for Menorca Aeropuerto).
- Returns:
Climate normals data with month names in English as index and the following columns:
Code
Name
Description
T
Temperatura
Average monthly/annual temperature (°C)
TM
Maxima
Monthly/yearly mean of daily maximum temperatures (°C)
Tm
Minima
Monthly/yearly mean of daily minimum temperatures (°C)
R
Precipitacion
Mean monthly/annual precipitation (mm)
H
Humedad
Mean relative humidity (%)
DR
Dias_prec
Monthly/yearly mean number of days with precipitation >= 1mm
DN
Dias_nieve
Monthly/yearly mean number of days with snow
DT
Dias_tormenta
Monthly/yearly mean number of days with thunderstorms
DF
Dias_niebla
Monthly/yearly mean number of days with fog
DH
Dias_helada
Monthly/yearly mean number of days with frost
DD
Dias_despej
Monthly/yearly mean number of clear days
I
Horas_sol
Monthly/yearly mean number of sunshine hours
- Return type:
- Raises:
ValueError – If loc is not a valid station identifier.
ValueError – If the CSV format is unexpected.
Exception – If the fetch fails.
Notes
For more information about climate normals data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/valoresclimatologicos/ayuda
Examples
Get climate normals for Menorca Aeropuerto:
>>> from aemetxfb.clim import get_normals >>> df = get_normals('B893') >>> df.loc['January', 'T'] 10.8
Get annual summary:
>>> df.loc['Year', ['T', 'R', 'H']] T 17.2 R 546.0 H 72.0 Name: Year, dtype: float64
Get average annual temperature for Madrid Aeropuerto:
>>> madrid = get_normals('3129') >>> madrid.loc['Year', 'T'] 14.5
- aemetxfb.clim.clim_normals.get_normals_map(output_path)[source]
Download climate normals maps from AEMet.
Downloads a tar.gz file containing climate normals maps for Spain (peninsular Spain, Balearic Islands, and Canary Islands) for the period 1981-2010.
The maps correspond to those contained in the publication “Mapas climáticos de España (1981-2010) y ETo (1996-2016)”.
The downloaded tar.gz file includes the following climate variables:
Precipitación máxima diaria media (mm): Average of daily maximum precipitations for each of the thirty years in the 1981-2010 period. Gives an idea of the maximum daily precipitation intensity.
Precipitación acumulada (mm): Mean annual and monthly accumulated precipitation in the 1981-2010 period.
Precipitación acumulada estacional (mm): Mean accumulated precipitation for each season in the 1981-2010 period.
Núm. med. días con precipitación ≥ 0,1 mm: Mean annual number of days with precipitation ≥ 0.1 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 1 mm: Mean annual number of days with precipitation ≥ 1 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 10 mm: Mean annual number of days with precipitation ≥ 10 mm in the 1981-2010 period.
Núm. med. días con precipitación ≥ 30 mm: Mean annual number of days with precipitation ≥ 30 mm in the 1981-2010 period.
Temperatura media (°C): Mean annual and monthly temperature in the 1981-2010 period.
Temperatura mínima media (°C): Mean of annual and monthly minimum temperatures in the 1981-2010 period.
Temperatura máxima media (°C): Mean of annual and monthly maximum temperatures in the 1981-2010 period.
Clasificación climática de Köppen: Köppen-Geiger climate classification for the 1981-2010 period.
Núm. med. días de nieve: Mean annual number of snow days in the 1981-2010 period.
Insolación: Mean annual number of sunshine hours in the 1981-2010 period.
Maps can be generated for the entire year, for a month, or for a climatological season.
For more information about climate normals data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/valoresclimatologicos/ayuda
- Parameters:
output_path (str | pathlib.Path) – Path where the tar.gz file will be downloaded. Must have a
.tar.gzextension.- Returns:
Path to the downloaded tar.gz file.
- Return type:
- Raises:
ValueError – If
output_pathis empty, None, or doesn’t have a.tar.gzextension.Exception – If the download fails.
Examples
Download climate normals maps:
>>> from aemetxfb.clim import get_normals_map >>> path = get_normals_map("clima.tar.gz") >>> print(path) 'clima.tar.gz'
Download to a specific location:
>>> from pathlib import Path >>> output = Path("/tmp/clima_maps.tar.gz") >>> result = get_normals_map(output)
aemetxfb.clim.clim_thresholds
Climate thresholds data from AEMet.
This module provides access to threshold data for Spanish meteorological stations, including stations where maximum precipitation intensity or maximum wind gusts have exceeded certain thresholds commonly used in insurance coverage.
- aemetxfb.clim.clim_thresholds.get_clim_threshold_day(date_input, param)[source]
Get climate threshold data for a specific day and parameter.
Fetches information about stations where the maximum precipitation intensity or maximum wind gust has exceeded certain thresholds commonly used in relation to insurance coverage.
The information has been obtained from provisional data and may be subject to modifications after the underlying data has been validated. Also indicates that data from some stations are not updated daily. Available data are from the current month and the previous three months.
- Parameters:
date_input (date | datetime) – The date for which to fetch threshold data. Must be within the current month or the previous three months. For example, if today is April 11, valid dates are from January 1 to April 11.
param (str) –
Threshold parameter to fetch. Valid values are:
’pptSup40’: Precipitation above 40 mm
’vtoSup70’: Wind above 70 km/h
’vtoSup80’: Wind above 80 km/h
’vtoSup90’: Wind above 90 km/h
’vtoSup96’: Wind above 96 km/h
- Returns:
DataFrame containing threshold data with the following columns:
All properties from the GeoJSON (e.g., ‘nombre_est’, ‘i_c’, ‘altitud’, and the parameter value column like ‘pptSup40’):
nombre_est: name of the station
i_c: id of the station
altitud: altitude of the station
pptSup40|vtoSup70|vtoSup80|vtoSup90|vtoSup96: threshold exceeded (1.0) or not (0.0)
’lon’: Longitude (first coordinate value)
’lat’: Latitude (second coordinate value)
The parameter value column (same name as
param) contains: - 1.0 for ‘si’ (threshold exceeded) - 0.0 for ‘no’ (threshold not exceeded) - NaN for any other value- Return type:
- Raises:
ValueError – If
date_inputis outside the valid range (more than 3 months in the past or in the future) or ifparamis not valid.Exception – If the fetch fails.
Notes
For more information about climate thresholds data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/superacion_umbrales/ayuda
The API provides data in GeoJSON format with station locations and threshold exceedance information.
Examples
Get precipitation threshold data:
>>> from aemetxfb.clim import get_clim_threshold_day >>> from datetime import date >>> result = get_clim_threshold_day(date(2024, 1, 15), 'pptSup40') >>> result.columns Index(['nombre_est', 'i_c', 'altitud', 'pptSup40', 'lon', 'lat'], dtype='object')
Get wind threshold data:
>>> result = get_clim_threshold_day(date(2024, 1, 15), 'vtoSup96')
- aemetxfb.clim.clim_thresholds.get_clim_threshold_month(date_input)[source]
Get monthly climate threshold data.
Fetches information about stations where the maximum precipitation intensity or maximum wind gust has exceeded certain thresholds commonly used in relation to insurance coverage.
The information has been obtained from provisional data and may be subject to modifications after the underlying data has been validated. Also indicates that data from some stations are not updated daily. Available data are from the current month and the previous three months.
- Parameters:
date_input (date | datetime) – The date for which to fetch monthly threshold data. Must be within the current month or the previous three months. For example, if today is April 11, valid dates are from January 1 to April 11.
- Returns:
DataFrame containing threshold data with columns from the JSON response:
’nombre_est’: name of the station
’i_c’: id of the station
’pptSup40’: Days of the month with Precipitation above 40 mm
’vtoSup70’: Days of the month with Wind above 70 km/h
’vtoSup80’: Days of the month with Wind above 80 km/h
’vtoSup90’: Days of the month with Wind above 90 km/h
’vtoSup96’: Days of the month with Wind above 96 km/h
- Return type:
- Raises:
ValueError – If
date_inputis outside the valid range (more than 3 months in the past or in the future).Exception – If the fetch fails.
Notes
For more information about climate thresholds data, visit: https://www.aemet.es/es/serviciosclimaticos/datosclimatologicos/superacion_umbrales/ayuda
The API provides data in JSON format with station information and threshold exceedance values.
Examples
Get monthly threshold data:
>>> from aemetxfb.clim import get_clim_threshold_month >>> from datetime import date >>> result = get_clim_threshold_month(date(2024, 1, 15)) >>> result.columns Index(['nombre_est', 'i_c', 'altitud', 'vtoSup96'], dtype='object')