aemetxfb — AEMet Data Access Library

aemetxfb is a Python library to access weather and climate data from AEMet (Agencia Estatal de Meteorología de España) without requiring an API key.

It provides a clean, type-annotated interface over AEMet’s public HTTP endpoints, returning pandas.DataFrame objects, file paths, or structured dictionaries depending on the data source.

Quick start

pip install aemetxfb
from aemetxfb.clim import get_normals

df = get_normals("3129")  # Madrid Aeropuerto
print(df.loc["Year", "T"])  # Annual mean temperature (\u00b0C)

Features

  • No API key required — all data comes from public AEMet endpoints.

  • Pandas integration — returns pandas.DataFrame for tabular data.

  • Type-annotated — full type hints with pyright strict checking.

  • Minimal dependencies — only pandas and numpy at runtime; stdlib otherwise.

  • Configurable timeouts — central AEMetConfig for HTTP request timeouts.

  • Optional disk cache — SQLite-backed cache with TTL for climate data that changes rarely.

  • Hourly forecasts — 3-day forecast for ~8,000 Spanish municipalities with name and coordinate lookup.

API Reference