Observations Module

The obs module provides access to real-time and recent observation data from AEMet, including station measurements, radar, satellite, radiation, lightning, and atmospheric chemistry.

Station observations

met_masts is a tuple of ~700 (id, name) pairs for observation stations.

Hourly data (last 24h)

get_last_24h() returns hourly meteorological data:

from aemetxfb.obs import get_last_24h

df = get_last_24h("3129")  # Madrid Aeropuerto
print(df.head())

Columns include: date/time, temperature, wind speed/direction, humidity, pressure, precipitation, and other standard meteorological variables.

Daily summary

get_daily_summary() returns today’s summary:

from aemetxfb.obs import get_daily_summary

df = get_daily_summary("3129")

Includes max/min temperatures, wind, precipitation, and the time each extreme occurred.

Historical daily summaries

get_previous_daily_summaries() returns historical daily data:

from aemetxfb.obs import get_previous_daily_summaries

df = get_previous_daily_summaries("3129")

Radiation, UV Index and Ozone

Station lists:

  • rad_stations — 26 stations with full radiation data

  • ir_stations — 19 stations with IR radiation

  • ozone_stations — 7 stations with ozone data

  • ozone_sounding_stations — 2 stations with ozone sounding

Radiation images

from aemetxfb.obs import get_radiation_rad, get_radiation_ir

path = get_radiation_rad("output.png", "Madrid-CRN")  # Solar radiation
path = get_radiation_ir("output.png", "Madrid-CRN")   # IR radiation

UV Index

from aemetxfb.obs import get_UVI_previous_day, get_UVI_previous_day_img

# DataFrame with hourly UVI values
df = get_UVI_previous_day()

# Download image
path = get_UVI_previous_day_img("uvi.png", "Madrid-CRN")

Ozone

from aemetxfb.obs import get_ozone_previous_day, get_ozone_sounding

# DataFrame with ozone values (DU)
df = get_ozone_previous_day()

# Download sounding profile image
path = get_ozone_sounding("ozone.png", "BarajasMad")

Radar

regional_radars — 17 regional radar identifiers (e.g. "CCD", "GLD").

from aemetxfb.obs import (
    get_radar_regional_reflectivity_4h,
    get_radar_regional_echotop_4h,
    get_radar_regional_accumprec1_24h,
    get_radar_regional_accumprec6_36h,
    get_radar_PI_IB_refl_4h,
    get_radar_PI_IB_refl_24h,
    get_radar_regional_latest,
)

# Regional reflectivity (last 4h, 10-min intervals)
result = get_radar_regional_reflectivity_4h("CCD", "radar/")
# result = {"png": [...], "json": [...]}

# Regional echotop (last 4h)
result = get_radar_regional_echotop_4h("CCD", "radar/")

# Accumulated precipitation 1h (last 24h, hourly)
result = get_radar_regional_accumprec1_24h("CCD", "radar/")

# Accumulated precipitation 6h (last 36h, 6h intervals)
result = get_radar_regional_accumprec6_36h("CCD", "radar/")

# Iberian Peninsula composite (last 4h, tar.gz)
get_radar_PI_IB_refl_4h("radar.tar.gz")

# Iberian Peninsula composite (last 24h, 10-min intervals)
result = get_radar_PI_IB_refl_24h("radar_24h/")

# Latest regional radar (tar.gz)
get_radar_regional_latest("radar_latest.tar.gz")

All regional functions return {"png": [paths], "json": [paths]}.

Satellite

from aemetxfb.obs import (
    get_satellite_IR_24h,
    get_satellite_VIS_24h,
    get_satellite_global_24h,
    get_satellite_globe_0_24h,
    get_satellite_globe_415_24h,
    get_satellite_airmasses_24h,
    get_satellite_NDVI,
    get_satellite_SST,
)

# IR satellite (hourly, last 24h)
paths = get_satellite_IR_24h("satellite/")
print(f"Downloaded {len(paths)} images")

# Visible satellite (hourly, last 24h, skips night)
paths = get_satellite_VIS_24h("satellite/")

# Global Meteosat/GOES/Himawari (3h intervals, last 24h)
paths = get_satellite_global_24h("satellite/")

# Earth from Meteosat at 0\xbaE and 41.5\xbaE
paths = get_satellite_globe_0_24h("satellite/")
paths = get_satellite_globe_415_24h("satellite/")

# RGB air mass composites
paths = get_satellite_airmasses_24h("satellite/")

# NDVI vegetation index (updated every 16 days)
path = get_satellite_NDVI("ndvi.gif")

# Sea surface temperature (daily)
path = get_satellite_SST("sst.gif")

Lightning

from aemetxfb.obs import get_lightning_latest

# Download cloud-to-ground discharges (last 24h, tar.gz with Geotiff)
get_lightning_latest("lightning.tar.gz")

Atmospheric chemistry

from aemetxfb.obs import get_chem_today, get_chem_previous_day, get_chem_previous_month

# Today's chemical data (ozone, NOx, SO2, solar radiation)
path = get_chem_today("chem.gif", "Lleida", "o")

# Previous day
path = get_chem_previous_day("chem.gif", "Lleida", "o")

# Previous month evolution (ozone + NO2 only)
path = get_chem_previous_month("chem.gif", "Lleida")

API reference

See aemetxfb.obs for the full API reference.