aemetxfb.obs

Observations module.

aemetxfb.obs.get_chem_previous_day(output_path, loc, prod)[source]

Download a chemical observation image from AEMet for the previous day.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

The data corresponds to the previous day’s measurements.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

  • prod (str) –

    Product type. Valid values:

    • 'o': Ozono superficial (Ozone surface)

    • 'n': Dióxido y monóxido de nitrógeno (Nitrogen oxides)

    • 's': Dióxido de azufre (Sulfur dioxide)

    • 'r': Radiación solar (Solar radiation)

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc or prod are invalid.

  • RuntimeError – If the download fails.

See also

get_chem_today

Download current chemical observation.

get_chem_previous_month

Download chemical observation for the previous month.

External

Examples

>>> get_chem_previous_day("kaka/test.gif", "Lleida", "o")
'kaka/test.gif'
aemetxfb.obs.get_chem_previous_month(output_path, loc)[source]

Download a chemical observation image from AEMet for the previous month.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

The data corresponds to the previous month’s measurements and shows the evolution of ozone and nitrogen dioxide.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc is invalid.

  • RuntimeError – If the download fails.

See also

get_chem_today

Download current chemical observation.

get_chem_previous_day

Download chemical observation for the previous day.

External

Examples

>>> get_chem_previous_month("kaka/test.gif", "Lleida")
'kaka/test.gif'
aemetxfb.obs.get_chem_today(output_path, loc, prod)[source]

Download a chemical observation image from AEMet.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

  • prod (str) –

    Product type. Valid values:

    • 'o': Ozono superficial (Ozone surface)

    • 'n': Dióxido y monóxido de nitrógeno (Nitrogen oxides)

    • 's': Dióxido de azufre (Sulfur dioxide)

    • 'r': Radiación solar (Solar radiation)

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc or prod are invalid.

  • RuntimeError – If the download fails.

See also

get_chem_previous_day

Download chemical observation for the previous day.

get_chem_previous_month

Download chemical observation for the previous month.

External

Examples

>>> get_chem_today("kaka/test.gif", "Lleida", "o")
'kaka/test.gif'
>>> get_chem_today("kaka/test.gif", "Invalid", "o")
Traceback (most recent call last):
    ...
ValueError: Invalid location: Invalid...
aemetxfb.obs.get_daily_summary(station_id)[source]

Fetch daily summary data for a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "C619Y" for La Aldea).

Returns:

Daily summary data for the current day. Columns are converted to appropriate types:

  • "Estación" and "Provincia": str

  • Numeric columns (Temperatura máxima, Racha, etc.): float64

  • "Datos hasta": datetime.time

  • Time-related columns: datetime.time

Return type:

pd.DataFrame

Raises:

See also

get_previous_daily_summaries

Fetch previous days’ summaries.

get_last_24h

Fetch hourly data for the last 24 hours.

External

aemetxfb.obs.get_last_24h(station_id)[source]

Fetch hourly weather data for the last 24 hours from a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "B662X" for Binissalem).

Returns:

Weather data for the last 24 hours. Columns are converted to appropriate types:

  • "Fecha y hora oficial": datetime64[ns]

  • Numeric columns (Temperatura, Velocidad del viento, etc.): float64

  • "Dirección del viento" and "Dirección de racha": str

Return type:

pd.DataFrame

Raises:

See also

get_daily_summary

Fetch daily summary data for a station.

get_previous_daily_summaries

Fetch previous daily summary data.

External

aemetxfb.obs.get_lightning_latest(output_path)[source]

Download latest lightning data from AEMet.

Downloads the latest lightning data (cloud-to-ground discharges) from AEMet. The data is provided in Geotiff format compressed in a .tar.gz file.

The lightning maps display:

  • Blue dots for negative discharges

  • Red dots for positive discharges

The data covers the last 24 hours and excludes discharges over French and Portuguese terrestrial zones. Time zones:

  • Peninsular Spain and Balearic Islands: UTC+1 (winter) / UTC+2 (summer)

  • Canary Islands: UTC (winter) / UTC+1 (summer)

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

External

Examples

>>> get_lightning_latest("kaka/lightning_data.tar.gz")
aemetxfb.obs.get_previous_daily_summaries(station_id)[source]

Fetch previous daily summary data for a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "C619Y" for La Aldea).

Returns:

Previous daily summary data. Columns are converted to appropriate types:

  • "Fecha y hora oficial": datetime64[ns]

  • Numeric columns (Temperatura máxima, Racha, etc.): float64

  • Time-related columns: datetime.time

Return type:

pd.DataFrame

Raises:

See also

get_daily_summary

Fetch current day summary data.

get_last_24h

Fetch hourly data for the last 24 hours.

External

aemetxfb.obs.get_radar_PI_IB_refl_24h(output_path, period=0, prefix='')[source]

Download radar reflectivity images (composite for Iberian Peninsula and Balearic islands).

Downloads the latest 10 minutes composite of radar reflectivity images from AEMet for the last 24h depending on the selected period. The available image format is PNG. The images correspond to the lowest radar elevation scan (0.5° above horizontal). Reflectivity values are displayed in decibels (dBZ) with the color scale:

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 24. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_PI_IB_refl_4h

Download composite reflectivity (last 4h).

get_radar_regional_reflectivity_4h

Download regional reflectivity.

External

aemetxfb.obs.get_radar_PI_IB_refl_4h(output_path)[source]

Download radar reflectivity images (composite for Iberian Peninsula and Balearic islands).

Downloads the latest 10 minutes composite of radar reflectivity images from AEMet for the last 4h. The available image format is geotiff. The images correspond to the lowest radar elevation scan (0.5° above horizontal).

Reflectivity values are displayed in decibels (dBZ) with the color scale:

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz or is empty/None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

External

aemetxfb.obs.get_radar_regional_accumprec1_24h(radar, output_path, period=0, prefix='')[source]

Download regional radar accumulated precipitation 1h images (RN1.1HR_CAPPI product) for the last 24 hours.

Downloads regional radar accumulated precipitation images from AEMet for the last 24 hours depending on the selected period. The available image format is PNG. The images correspond to the accumulated precipitation in 1h in mm.

Values are displayed in millimeters (mm) with the color scale:

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

The timestamp corresponds to hourly data (hours in point).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 24. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 24, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_reflectivity_4h

Download reflectivity images.

get_radar_regional_accumprec6_36h

Download 6h precipitation accumulation.

External

aemetxfb.obs.get_radar_regional_accumprec6_36h(radar, output_path, period=0, prefix='')[source]

Download regional radar accumulated precipitation 6h images (RNN.6HR_CAPPI product) for the last 36 hours.

Downloads regional radar accumulated precipitation images from AEMet for the last 36 hours depending on the selected period. The available image format is PNG. The images correspond to the accumulated precipitation in 6h in mm.

Values are displayed in millimeters (mm) with the color scale:

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

The timestamp corresponds to data every 6 hours (hours in point: 00, 06, 12, 18).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 36. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 36, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

get_radar_regional_reflectivity_4h

Download reflectivity images.

External

aemetxfb.obs.get_radar_regional_echotop_4h(radar, output_path, period=0, prefix='')[source]

Download regional radar echotop images (TOP.12DBZ_240) for the last 4 hours.

Downloads regional radar echotop images from AEMet for the last 4 hours depending on the selected period. The available image format is PNG. Images correspond to the echotop height for a reflectivity > 12 dBZ.

Echotop values are displayed in kilometers (km) above ground. The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

Color

Range(km)

#0000fc

1-2

#0082ff

2-3

#00beff

3-4

#00ffff

4-5

#438323

5-6

#96c800

6-7

#00fa00

7-8

#ffff00

8-10

#ffaa00

10-12

#ff6b00

12-14

#fc0000

14-16

#c80050

16-20

#820a6e

>20

Also retrieves radar bounds (bounding box coordinates) in JSON format and saves them with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 4. Default is 0 (latest available image only).

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}".

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 4, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_reflectivity_4h

Download reflectivity images.

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

External

aemetxfb.obs.get_radar_regional_latest(output_path)[source]

Download the latest regional radar images.

Downloads the latest 10 minutes regional radar data available. The available image format is geotiff. This information could be outdated if the radar is not working.

PPI.Z images correspond to the lowest radar elevation scan (0.5° above horizontal). Reflectivity values are displayed in decibels (dBZ).

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

TOP.12DBZ images correspond to the echotop height for reflectivity > 12 dBZ, displayed in kilometers (km).

Color

Range(km)

#0000fc

1-2

#0082ff

2-3

#00beff

3-4

#00ffff

4-5

#438323

5-6

#96c800

6-7

#00fa00

7-8

#ffff00

8-10

#ffaa00

10-12

#ff6b00

12-14

#fc0000

14-16

#c80050

16-20

#820a6e

>20

RN1.1HR and RNN.6HR images show accumulated precipitation in 1h and 6h respectively, displayed in millimeters (mm).

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz or is empty/None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

get_radar_regional_reflectivity_4h

Download regional reflectivity images.

get_radar_regional_echotop_4h

Download regional echotop images.

External

aemetxfb.obs.get_radar_regional_reflectivity_4h(radar, output_path, period=0, prefix='')[source]

Download regional radar reflectivity images (PPI.Z_005_240) for the last 4 hours.

Downloads regional radar reflectivity images from AEMet for the last 4 hours depending on the selected period. The available image format is PNG. Images correspond to the lowest radar elevation scan (0.5° above horizontal).

Reflectivity values are displayed in decibels (dBZ). The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

Also retrieves radar bounds (bounding box coordinates) in JSON format and saves them with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 4. Default is 0 (latest available image only).

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}".

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 4, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_echotop_4h

Download echotop images.

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

External

aemetxfb.obs.get_UVI_previous_day()[source]

Download UVI (Ultraviolet Index) data for the previous day from AEMet.

Fetches UVI observation data from the AEMet website, parsing the HTML table that contains hourly UVI values for multiple stations.

Returns:

DataFrame with:

  • Station names as rows (index)

  • Hours 07-22 as columns

  • MAX column with maximum UVI for each station

Return type:

pd.DataFrame

Raises:

RuntimeError – If the data cannot be fetched or parsed.

See also

get_UVI_previous_day_img

Download UVI observation image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> df = get_UVI_previous_day()
>>> print(df.head())
            07  08  09  10  ...  21  22   MAX
A Coruña     0   0   0   1  ...   0   0   5.0
Almería      0   0   0   1  ...   0   0   6.0
aemetxfb.obs.get_UVI_previous_day_img(output_path, loc)[source]

Download UVI (Ultraviolet Index) observation image from AEMet.

Downloads the UVI observation image for the previous day from AEMet observation stations. The image shows the UVI values graphically.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – UVI location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_UVI_previous_day

Download UVI data table for the previous day.

get_UVI_running_year_img

Download UVI running year image.

get_radiation_rad

Download solar radiation images.

External

Examples

>>> get_UVI_previous_day_img("data/uvi/madrid.png", "Madrid-CRN")
'data/uvi/madrid.png'
aemetxfb.obs.get_UVI_running_year_img(output_path, loc)[source]

Download UVI (Ultraviolet Index) running year image from AEMet.

Downloads the UVI running year image from AEMet observation stations. The image shows the UVI values graphically for the current year.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – UVI location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_UVI_previous_day_img

Download UVI observation image.

get_UVI_previous_day

Download UVI data table.

External

Examples

>>> get_UVI_running_year_img("data/uvi/anual_madrid.png", "Madrid-CRN")
'data/uvi/anual_madrid.png'
aemetxfb.obs.get_ozone_previous_day()[source]

Download ozone data for the previous day from AEMet.

Fetches ozone observation data from the AEMet website, parsing the HTML table that contains ozone values for multiple stations.

Returns:

DataFrame with:

  • Station names as rows (index)

  • "Ozono (UD)" column with ozone values

Return type:

pd.DataFrame

Raises:

RuntimeError – If the data cannot be fetched or parsed.

See also

get_ozone_running_year

Download ozone running year image.

get_ozone_sounding

Download ozone sounding image.

get_UVI_previous_day

Download UVI data table.

External

Examples

>>> df = get_ozone_previous_day()
>>> print(df.head())
               Ozono (UD)
A Coruña           45.0
Madrid             52.0
aemetxfb.obs.get_ozone_running_year(output_path, loc)[source]

Download ozone running year image from AEMet.

Downloads the ozone running year image from AEMet observation stations. The image shows the ozone values graphically for the current year.

Parameters:
  • output_path (str | pathlib.Path) – Path where the image will be saved (must have .png extension).

  • loc (str) – Ozone location. Valid values: Coruna, Izana, Madrid-CRN, Arenosillo, Murcia, Tenerife, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:

ValueError – If loc is not a valid location name or output_path doesn’t have .png extension.

See also

get_ozone_sounding

Download ozone sounding image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> get_ozone_running_year("kaka/output.png", "Madrid-CRN")
'kaka/output.png'
>>> get_ozone_running_year("kaka/output.txt", "Madrid-CRN")
Traceback (most recent call last):
    ...
ValueError: output_path must have .png extension...
aemetxfb.obs.get_ozone_sounding(output_path, loc)[source]

Download ozone sounding image from AEMet.

Downloads the ozone sounding image from AEMet observation stations. The image shows the ozone sounding data graphically.

Parameters:
  • output_path (str | pathlib.Path) – Path where the image will be saved (must have .png extension).

  • loc (str) – Ozone sounding location. Valid values: BarajasMad, BotanicoTfe.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:

ValueError – If loc is not a valid location name or output_path doesn’t have .png extension.

See also

get_ozone_running_year

Download ozone running year image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> get_ozone_sounding("kaka/output.png", "BarajasMad")
'kaka/output.png'
aemetxfb.obs.get_radiation_ir(output_path, loc)[source]

Download infrared radiation observation images from AEMet.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – Radiation location. Valid values: Coruna, Badajoz, Caceres, Cordoba, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_radiation_rad

Download solar radiation images.

get_UVI_previous_day_img

Download UVI observation images.

External

Examples

>>> get_radiation_ir("data/ir/madrid.png", "Madrid-CRN")
'data/ir/madrid.png'
aemetxfb.obs.get_radiation_rad(output_path, loc)[source]

Download solar radiation observation images from AEMet.

Downloads solar radiation images (global, direct, diffuse) from AEMet observation stations.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – Radiation location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_radiation_ir

Download infrared radiation images.

get_UVI_previous_day_img

Download UVI observation images.

External

Examples

>>> get_radiation_rad("data/rad/madrid.png", "Madrid-CRN")
'data/rad/madrid.png'
>>> get_radiation_rad("data/rad/madrid.txt", "Madrid-CRN")
Traceback (most recent call last):
    ...
ValueError: output_path must have .png extension...
>>> get_radiation_rad("data/rad/madrid.png", "Invalid")
Traceback (most recent call last):
    ...
ValueError: Invalid location 'Invalid'...
aemetxfb.obs.get_satellite_IR_24h(output_path, period=0, prefix='')[source]

Download processed Meteosat infrared satellite images.

The images are downloaded in GIF format from AEMet’s website.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and the N previous hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}".

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_VIS_24h

Download visible channel images.

get_satellite_global_24h

Download global satellite images.

External

Examples

>>> get_satellite_IR_24h("kaka", period=0)
['kaka/satellite_IR_...gif']
>>> get_satellite_IR_24h("kaka", period=25)
Traceback (most recent call last):
    ...
ValueError: period must be between 0 and 24
aemetxfb.obs.get_satellite_VIS_24h(output_path, period=0, prefix='')[source]

Download Meteosat visible channel satellite images.

The images are downloaded in JPEG format from AEMet’s website. Note that during nighttime hours, images may not be available (HTTP 404).

Parameters:
  • output_path (str | Path) – Directory path where the downloaded JPEG images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and the N previous hours, skipping unavailable nighttime images. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_global_24h

Download global satellite images.

External

aemetxfb.obs.get_satellite_global_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images from Meteosat, GOES, and Himawari.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_VIS_24h

Download visible channel images.

External

aemetxfb.obs.get_satellite_globe_0_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images of the Earth visible from Meteosat at 0° longitude.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_globe_415_24h

Download images from Meteosat at 41.5° longitude.

External

aemetxfb.obs.get_satellite_globe_415_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images of the Earth visible from Meteosat at 41.5° longitude.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_globe_0_24h

Download images from Meteosat at 0° longitude.

External

aemetxfb.obs.get_satellite_airmasses_24h(output_path, period=0, prefix='')[source]

Download RGB composite satellite images showing air mass characteristics.

The images are downloaded in JPEG format from AEMet’s website. These RGB composites combine multiple Meteosat operational channels at 0°N 0°W to provide information about air mass properties and cloud characteristics.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded JPEG images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 1 hour. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_global_24h

Download global satellite images.

External

aemetxfb.obs.get_satellite_NDVI(output_path)[source]

Download NDVI (Normalized Difference Vegetation Index) satellite image.

The image is downloaded in GIF format from AEMet’s website. This NDVI image is derived from NASA’s MOD13A1 product, using MODIS data from the Terra and Aqua satellites. It shows vegetation development with a resolution of 500 m, updated every 16 days.

Parameters:

output_path (str | Path) – Full path where the downloaded GIF image will be saved. Must have a .gif extension. Parent directories will be created if they do not exist.

Returns:

Path to downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path is empty or None, or if it does not have a .gif extension.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_SST

Download sea surface temperature image.

External

Examples

>>> get_satellite_NDVI("data/ndvi_image.gif")
'data/ndvi_image.gif'
aemetxfb.obs.get_satellite_SST(output_path)[source]

Download Sea Surface Temperature (SST) satellite image.

The image is downloaded in GIF format from AEMet’s website. This SST image is generated based on the “Global Metop Sea Surface Temperature” product developed by OSI SAF (Ocean and Sea Ice Satellite Application Facility) of EUMETSAT, the center dedicated to satellite ocean and sea ice applications. The image has a resolution of 0.05° and is updated daily, showing temperature values with a maximum age of 48 hours.

Parameters:

output_path (str | Path) – Full path where the downloaded GIF image will be saved. Must have a .gif extension. Parent directories will be created if they do not exist.

Returns:

Path to downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path is empty or None, or if it does not have a .gif extension.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_NDVI

Download NDVI vegetation index image.

External

Examples

>>> get_satellite_SST("data/sst_image.gif")
'data/sst_image.gif'

Submodules

aemetxfb.obs.chem

Chemical observation module for AEMet data.

This module provides functions to download chemical composition data from the Spanish national weather service (AEMet). The data comes from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

Data is updated hourly. The available products correspond to:

  • 'o': Ozono superficial (Ozone surface)

  • 'n': Dióxido y monóxido de nitrógeno (Nitrogen oxides)

  • 's': Dióxido de azufre (Sulfur dioxide)

  • 'r': Radiación solar (Solar radiation)

Locations and their corresponding monitoring stations:

  • "Badajoz": Barcarrota (Badajoz)

  • "Girona": Cabo de Creus (Girona)

  • "Guadalajara": Campisábalos (Guadalajara)

  • "Huelva": Doñana (Huelva)

  • "Lleida": Els Torms (Lleida)

  • "Mahon": Mahón (Illes Balears)

  • "Asturias": Niembro-Llanes (Asturias)

  • "Coruna": Noia (A Coruña)

  • "Lugo": O Saviñao (Lugo)

  • "Zamora": Peñausende (Zamora)

  • "Toledo": San Pablo de los Montes (Toledo)

  • "Granada": Víznar (Granada)

  • "Valencia": Zarra (Valencia)

See also: https://www.aemet.es/es/eltiempo/observacion/contaminacionfondo/ayuda

aemetxfb.obs.chem.get_chem_today(output_path, loc, prod)[source]

Download a chemical observation image from AEMet.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

  • prod (str) –

    Product type. Valid values:

    • 'o': Ozono superficial (Ozone surface)

    • 'n': Dióxido y monóxido de nitrógeno (Nitrogen oxides)

    • 's': Dióxido de azufre (Sulfur dioxide)

    • 'r': Radiación solar (Solar radiation)

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc or prod are invalid.

  • RuntimeError – If the download fails.

See also

get_chem_previous_day

Download chemical observation for the previous day.

get_chem_previous_month

Download chemical observation for the previous month.

External

Examples

>>> get_chem_today("kaka/test.gif", "Lleida", "o")
'kaka/test.gif'
>>> get_chem_today("kaka/test.gif", "Invalid", "o")
Traceback (most recent call last):
    ...
ValueError: Invalid location: Invalid...
aemetxfb.obs.chem.get_chem_previous_day(output_path, loc, prod)[source]

Download a chemical observation image from AEMet for the previous day.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

The data corresponds to the previous day’s measurements.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

  • prod (str) –

    Product type. Valid values:

    • 'o': Ozono superficial (Ozone surface)

    • 'n': Dióxido y monóxido de nitrógeno (Nitrogen oxides)

    • 's': Dióxido de azufre (Sulfur dioxide)

    • 'r': Radiación solar (Solar radiation)

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc or prod are invalid.

  • RuntimeError – If the download fails.

See also

get_chem_today

Download current chemical observation.

get_chem_previous_month

Download chemical observation for the previous month.

External

Examples

>>> get_chem_previous_day("kaka/test.gif", "Lleida", "o")
'kaka/test.gif'
aemetxfb.obs.chem.get_chem_previous_month(output_path, loc)[source]

Download a chemical observation image from AEMet for the previous month.

Downloads a GIF image showing chemical composition data from the Spanish EMEP/VAG/CAMP network dedicated to the observation of atmospheric chemical composition at regional scale, away from contaminant sources.

The data corresponds to the previous month’s measurements and shows the evolution of ozone and nitrogen dioxide.

Parameters:
  • output_path (str | pathlib.Path) – Path where the GIF file will be saved. Must have .gif extension.

  • loc (str) – Location name. Valid values: Badajoz, Girona, Guadalajara, Huelva, Lleida, Mahon, Asturias, Coruna, Lugo, Zamora, Toledo, Granada, Valencia.

Returns:

Path to the downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path doesn’t have .gif extension, or if loc is invalid.

  • RuntimeError – If the download fails.

See also

get_chem_today

Download current chemical observation.

get_chem_previous_day

Download chemical observation for the previous day.

External

Examples

>>> get_chem_previous_month("kaka/test.gif", "Lleida")
'kaka/test.gif'

aemetxfb.obs.lightning

Module to get lightning data from AEMet API.

See also: https://www.aemet.es/es/eltiempo/observacion/rayos/ayuda

aemetxfb.obs.lightning.get_lightning_latest(output_path)[source]

Download latest lightning data from AEMet.

Downloads the latest lightning data (cloud-to-ground discharges) from AEMet. The data is provided in Geotiff format compressed in a .tar.gz file.

The lightning maps display:

  • Blue dots for negative discharges

  • Red dots for positive discharges

The data covers the last 24 hours and excludes discharges over French and Portuguese terrestrial zones. Time zones:

  • Peninsular Spain and Balearic Islands: UTC+1 (winter) / UTC+2 (summer)

  • Canary Islands: UTC (winter) / UTC+1 (summer)

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

External

Examples

>>> get_lightning_latest("kaka/lightning_data.tar.gz")

aemetxfb.obs.masts

Module to get observation data from AEMet API masts/stations.

See also: https://www.aemet.es/es/eltiempo/observacion/ultimosdatos/ayuda

aemetxfb.obs.masts.get_last_24h(station_id)[source]

Fetch hourly weather data for the last 24 hours from a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "B662X" for Binissalem).

Returns:

Weather data for the last 24 hours. Columns are converted to appropriate types:

  • "Fecha y hora oficial": datetime64[ns]

  • Numeric columns (Temperatura, Velocidad del viento, etc.): float64

  • "Dirección del viento" and "Dirección de racha": str

Return type:

pd.DataFrame

Raises:

See also

get_daily_summary

Fetch daily summary data for a station.

get_previous_daily_summaries

Fetch previous daily summary data.

External

aemetxfb.obs.masts.get_daily_summary(station_id)[source]

Fetch daily summary data for a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "C619Y" for La Aldea).

Returns:

Daily summary data for the current day. Columns are converted to appropriate types:

  • "Estación" and "Provincia": str

  • Numeric columns (Temperatura máxima, Racha, etc.): float64

  • "Datos hasta": datetime.time

  • Time-related columns: datetime.time

Return type:

pd.DataFrame

Raises:

See also

get_previous_daily_summaries

Fetch previous days’ summaries.

get_last_24h

Fetch hourly data for the last 24 hours.

External

aemetxfb.obs.masts.get_previous_daily_summaries(station_id)[source]

Fetch previous daily summary data for a given station.

Parameters:

station_id (str) – Meteorological station ID (e.g., "C619Y" for La Aldea).

Returns:

Previous daily summary data. Columns are converted to appropriate types:

  • "Fecha y hora oficial": datetime64[ns]

  • Numeric columns (Temperatura máxima, Racha, etc.): float64

  • Time-related columns: datetime.time

Return type:

pd.DataFrame

Raises:

See also

get_daily_summary

Fetch current day summary data.

get_last_24h

Fetch hourly data for the last 24 hours.

External

aemetxfb.obs.radar

Module to get radar data from AEMet API.

This module provides functions to download regional and composite radar images from AEMet, including reflectivity, echotop, and precipitation accumulation data.

Regional radars are located across Spain and the Balearic Islands, providing high-resolution radar coverage. Available products include:

  • PPI.Z_005_240: Reflectivity at lowest elevation (0.5°)

  • TOP.12DBZ_240: Echotop height for reflectivity > 12 dBZ

  • RN1.1HR_CAPPI: Accumulated precipitation in 1 hour

  • RNN.6HR_CAPPI: Accumulated precipitation in 6 hours

See also: https://www.aemet.es/es/eltiempo/observacion/radar/ayuda

aemetxfb.obs.radar.get_radar_PI_IB_refl_4h(output_path)[source]

Download radar reflectivity images (composite for Iberian Peninsula and Balearic islands).

Downloads the latest 10 minutes composite of radar reflectivity images from AEMet for the last 4h. The available image format is geotiff. The images correspond to the lowest radar elevation scan (0.5° above horizontal).

Reflectivity values are displayed in decibels (dBZ) with the color scale:

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz or is empty/None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

External

aemetxfb.obs.radar.get_radar_regional_latest(output_path)[source]

Download the latest regional radar images.

Downloads the latest 10 minutes regional radar data available. The available image format is geotiff. This information could be outdated if the radar is not working.

PPI.Z images correspond to the lowest radar elevation scan (0.5° above horizontal). Reflectivity values are displayed in decibels (dBZ).

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

TOP.12DBZ images correspond to the echotop height for reflectivity > 12 dBZ, displayed in kilometers (km).

Color

Range(km)

#0000fc

1-2

#0082ff

2-3

#00beff

3-4

#00ffff

4-5

#438323

5-6

#96c800

6-7

#00fa00

7-8

#ffff00

8-10

#ffaa00

10-12

#ff6b00

12-14

#fc0000

14-16

#c80050

16-20

#820a6e

>20

RN1.1HR and RNN.6HR images show accumulated precipitation in 1h and 6h respectively, displayed in millimeters (mm).

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

Parameters:

output_path (str | pathlib.Path) – Full path to the output .tar.gz file. Parent directories will be created if needed.

Raises:
  • ValueError – If output_path does not end with .tar.gz or is empty/None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

Return type:

None

See also

get_radar_regional_reflectivity_4h

Download regional reflectivity images.

get_radar_regional_echotop_4h

Download regional echotop images.

External

aemetxfb.obs.radar.get_radar_regional_reflectivity_4h(radar, output_path, period=0, prefix='')[source]

Download regional radar reflectivity images (PPI.Z_005_240) for the last 4 hours.

Downloads regional radar reflectivity images from AEMet for the last 4 hours depending on the selected period. The available image format is PNG. Images correspond to the lowest radar elevation scan (0.5° above horizontal).

Reflectivity values are displayed in decibels (dBZ). The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

Also retrieves radar bounds (bounding box coordinates) in JSON format and saves them with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 4. Default is 0 (latest available image only).

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}".

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 4, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_echotop_4h

Download echotop images.

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

External

aemetxfb.obs.radar.get_radar_regional_echotop_4h(radar, output_path, period=0, prefix='')[source]

Download regional radar echotop images (TOP.12DBZ_240) for the last 4 hours.

Downloads regional radar echotop images from AEMet for the last 4 hours depending on the selected period. The available image format is PNG. Images correspond to the echotop height for a reflectivity > 12 dBZ.

Echotop values are displayed in kilometers (km) above ground. The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

Color

Range(km)

#0000fc

1-2

#0082ff

2-3

#00beff

3-4

#00ffff

4-5

#438323

5-6

#96c800

6-7

#00fa00

7-8

#ffff00

8-10

#ffaa00

10-12

#ff6b00

12-14

#fc0000

14-16

#c80050

16-20

#820a6e

>20

Also retrieves radar bounds (bounding box coordinates) in JSON format and saves them with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 4. Default is 0 (latest available image only).

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}".

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 4, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_reflectivity_4h

Download reflectivity images.

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

External

aemetxfb.obs.radar.get_radar_regional_accumprec1_24h(radar, output_path, period=0, prefix='')[source]

Download regional radar accumulated precipitation 1h images (RN1.1HR_CAPPI product) for the last 24 hours.

Downloads regional radar accumulated precipitation images from AEMet for the last 24 hours depending on the selected period. The available image format is PNG. The images correspond to the accumulated precipitation in 1h in mm.

Values are displayed in millimeters (mm) with the color scale:

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

The timestamp corresponds to hourly data (hours in point).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 24. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 24, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_reflectivity_4h

Download reflectivity images.

get_radar_regional_accumprec6_36h

Download 6h precipitation accumulation.

External

aemetxfb.obs.radar.get_radar_regional_accumprec6_36h(radar, output_path, period=0, prefix='')[source]

Download regional radar accumulated precipitation 6h images (RNN.6HR_CAPPI product) for the last 36 hours.

Downloads regional radar accumulated precipitation images from AEMet for the last 36 hours depending on the selected period. The available image format is PNG. The images correspond to the accumulated precipitation in 6h in mm.

Values are displayed in millimeters (mm) with the color scale:

Color

Range(mm)

#001eff

0.5-1

#0064ff

1-2

#0087ff

2-4

#00b4ff

4-8

#438323

8-16

#00d200

16-32

#ffbb00

32-64

#ff7f00

64-128

#ff0000

128-256

#ff00ff

>256

The timestamp corresponds to data every 6 hours (hours in point: 00, 06, 12, 18).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • radar (str) – Regional radar identifier (e.g., "NJR", "TJV"). Must be one of the available radars in regional_radars tuple.

  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 36. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If radar is not in regional_radars, period is not between 0 and 36, or output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_regional_accumprec1_24h

Download 1h precipitation accumulation.

get_radar_regional_reflectivity_4h

Download reflectivity images.

External

aemetxfb.obs.radar.get_radar_PI_IB_refl_24h(output_path, period=0, prefix='')[source]

Download radar reflectivity images (composite for Iberian Peninsula and Balearic islands).

Downloads the latest 10 minutes composite of radar reflectivity images from AEMet for the last 24h depending on the selected period. The available image format is PNG. The images correspond to the lowest radar elevation scan (0.5° above horizontal). Reflectivity values are displayed in decibels (dBZ) with the color scale:

Color

Range(dBZ)

#0000fc

12-18

#0094fc

18-24

#00fcfc

24-30

#438323

30-36

#00c000

36-42

#00ff00

42-48

#ffff00

48-54

#ffbb00

54-60

#ff7f00

60-66

#ff0000

66-72

#c8005a

72-150

The timestamp is rounded to the nearest 10-minute interval (00, 10, 20, …, 50 minutes).

This function also retrieves the radar bounds (bounding box coordinates) in JSON format and saves them to a file with the same name as the PNG but with .json extension.

Parameters:
  • output_path (str | pathlib.Path) – Directory path where the downloaded PNG and JSON files will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data. Must be between 0 and 24. A value of 0 (default) retrieves the latest available image and JSON data. Default is 0.

  • prefix (str, optional) – String to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{original_remote_filename}". Default is “”.

Returns:

Dictionary with two keys: "png" and "json", each containing a list of downloaded file paths.

Return type:

dict[str, list[str]]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_radar_PI_IB_refl_4h

Download composite reflectivity (last 4h).

get_radar_regional_reflectivity_4h

Download regional reflectivity.

External

aemetxfb.obs.radiation

Module to download radiation observation images from AEMet API.

This module provides functions to download solar radiation, UVI (Ultraviolet Index), and ozone data from AEMet observation stations across Spain.

Available data types:

  • Global, direct, and diffuse solar radiation

  • Infrared radiation

  • UVI (Ultraviolet Index) values and images

  • Ozone measurements and sounding data

See also: https://www.aemet.es/es/eltiempo/observacion/radiacion/radiacion/ayuda

aemetxfb.obs.radiation.get_radiation_rad(output_path, loc)[source]

Download solar radiation observation images from AEMet.

Downloads solar radiation images (global, direct, diffuse) from AEMet observation stations.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – Radiation location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_radiation_ir

Download infrared radiation images.

get_UVI_previous_day_img

Download UVI observation images.

External

Examples

>>> get_radiation_rad("data/rad/madrid.png", "Madrid-CRN")
'data/rad/madrid.png'
>>> get_radiation_rad("data/rad/madrid.txt", "Madrid-CRN")
Traceback (most recent call last):
    ...
ValueError: output_path must have .png extension...
>>> get_radiation_rad("data/rad/madrid.png", "Invalid")
Traceback (most recent call last):
    ...
ValueError: Invalid location 'Invalid'...
aemetxfb.obs.radiation.get_radiation_ir(output_path, loc)[source]

Download infrared radiation observation images from AEMet.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – Radiation location. Valid values: Coruna, Badajoz, Caceres, Cordoba, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_radiation_rad

Download solar radiation images.

get_UVI_previous_day_img

Download UVI observation images.

External

Examples

>>> get_radiation_ir("data/ir/madrid.png", "Madrid-CRN")
'data/ir/madrid.png'
aemetxfb.obs.radiation.get_UVI_previous_day_img(output_path, loc)[source]

Download UVI (Ultraviolet Index) observation image from AEMet.

Downloads the UVI observation image for the previous day from AEMet observation stations. The image shows the UVI values graphically.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – UVI location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_UVI_previous_day

Download UVI data table for the previous day.

get_UVI_running_year_img

Download UVI running year image.

get_radiation_rad

Download solar radiation images.

External

Examples

>>> get_UVI_previous_day_img("data/uvi/madrid.png", "Madrid-CRN")
'data/uvi/madrid.png'
aemetxfb.obs.radiation.get_UVI_previous_day()[source]

Download UVI (Ultraviolet Index) data for the previous day from AEMet.

Fetches UVI observation data from the AEMet website, parsing the HTML table that contains hourly UVI values for multiple stations.

Returns:

DataFrame with:

  • Station names as rows (index)

  • Hours 07-22 as columns

  • MAX column with maximum UVI for each station

Return type:

pd.DataFrame

Raises:

RuntimeError – If the data cannot be fetched or parsed.

See also

get_UVI_previous_day_img

Download UVI observation image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> df = get_UVI_previous_day()
>>> print(df.head())
            07  08  09  10  ...  21  22   MAX
A Coruña     0   0   0   1  ...   0   0   5.0
Almería      0   0   0   1  ...   0   0   6.0
aemetxfb.obs.radiation.get_UVI_running_year_img(output_path, loc)[source]

Download UVI (Ultraviolet Index) running year image from AEMet.

Downloads the UVI running year image from AEMet observation stations. The image shows the UVI values graphically for the current year.

Parameters:
  • output_path (str | pathlib.Path) – Full path where the image will be saved. Must have a .png extension. Parent directories will be created if they do not exist.

  • loc (str) – UVI location. Valid values: Coruna, Almeria, Badajoz, Barcelona, Caceres, Cadiz, CReal, Cordoba, Granada, Izana, Leon, Madrid-CRN, Malaga, Maspalomas, Arenosillo, Murcia, Palma, Navacerrada, Salamanca, Igueldo, Santander, Tenerife, Roquetas, Valencia, Valladolid, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:
  • ValueError – If loc is not a valid location name, or if output_path does not have a .png extension.

  • RuntimeError – If the image cannot be fetched or saved.

See also

get_UVI_previous_day_img

Download UVI observation image.

get_UVI_previous_day

Download UVI data table.

External

Examples

>>> get_UVI_running_year_img("data/uvi/anual_madrid.png", "Madrid-CRN")
'data/uvi/anual_madrid.png'
aemetxfb.obs.radiation.get_ozone_running_year(output_path, loc)[source]

Download ozone running year image from AEMet.

Downloads the ozone running year image from AEMet observation stations. The image shows the ozone values graphically for the current year.

Parameters:
  • output_path (str | pathlib.Path) – Path where the image will be saved (must have .png extension).

  • loc (str) – Ozone location. Valid values: Coruna, Izana, Madrid-CRN, Arenosillo, Murcia, Tenerife, Zaragoza.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:

ValueError – If loc is not a valid location name or output_path doesn’t have .png extension.

See also

get_ozone_sounding

Download ozone sounding image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> get_ozone_running_year("kaka/output.png", "Madrid-CRN")
'kaka/output.png'
>>> get_ozone_running_year("kaka/output.txt", "Madrid-CRN")
Traceback (most recent call last):
    ...
ValueError: output_path must have .png extension...
aemetxfb.obs.radiation.get_ozone_sounding(output_path, loc)[source]

Download ozone sounding image from AEMet.

Downloads the ozone sounding image from AEMet observation stations. The image shows the ozone sounding data graphically.

Parameters:
  • output_path (str | pathlib.Path) – Path where the image will be saved (must have .png extension).

  • loc (str) – Ozone sounding location. Valid values: BarajasMad, BotanicoTfe.

Returns:

Full path to the downloaded image file.

Return type:

str

Raises:

ValueError – If loc is not a valid location name or output_path doesn’t have .png extension.

See also

get_ozone_running_year

Download ozone running year image.

get_ozone_previous_day

Download ozone data table.

External

Examples

>>> get_ozone_sounding("kaka/output.png", "BarajasMad")
'kaka/output.png'
aemetxfb.obs.radiation.get_ozone_previous_day()[source]

Download ozone data for the previous day from AEMet.

Fetches ozone observation data from the AEMet website, parsing the HTML table that contains ozone values for multiple stations.

Returns:

DataFrame with:

  • Station names as rows (index)

  • "Ozono (UD)" column with ozone values

Return type:

pd.DataFrame

Raises:

RuntimeError – If the data cannot be fetched or parsed.

See also

get_ozone_running_year

Download ozone running year image.

get_ozone_sounding

Download ozone sounding image.

get_UVI_previous_day

Download UVI data table.

External

Examples

>>> df = get_ozone_previous_day()
>>> print(df.head())
               Ozono (UD)
A Coruña           45.0
Madrid             52.0

aemetxfb.obs.satellite

Module to get satellite data from AEMet API.

This module provides functions to download Meteosat satellite imagery including infrared, visible, global, air masses, NDVI, and sea surface temperature data.

Available products:

  • Infrared (IR) channel images (hourly)

  • Visible (VIS) channel images (hourly, daytime only)

  • Global satellite images from Meteosat, GOES, Himawari (every 3 hours)

  • RGB air mass composite images

  • NDVI (Normalized Difference Vegetation Index)

  • Sea Surface Temperature (SST)

See also: * https://www.aemet.es/es/eltiempo/observacion/satelite/infra/ayuda * https://www.aemet.es/es/eltiempo/observacion/satelite/visible/ayuda * https://www.aemet.es/es/eltiempo/observacion/satelite/global/ayuda * https://www.aemet.es/es/eltiempo/observacion/satelite/masas/ayuda * https://www.aemet.es/es/eltiempo/observacion/satelite/pderiv/ayuda

aemetxfb.obs.satellite.get_satellite_IR_24h(output_path, period=0, prefix='')[source]

Download processed Meteosat infrared satellite images.

The images are downloaded in GIF format from AEMet’s website.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and the N previous hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}".

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_VIS_24h

Download visible channel images.

get_satellite_global_24h

Download global satellite images.

External

Examples

>>> get_satellite_IR_24h("kaka", period=0)
['kaka/satellite_IR_...gif']
>>> get_satellite_IR_24h("kaka", period=25)
Traceback (most recent call last):
    ...
ValueError: period must be between 0 and 24
aemetxfb.obs.satellite.get_satellite_VIS_24h(output_path, period=0, prefix='')[source]

Download Meteosat visible channel satellite images.

The images are downloaded in JPEG format from AEMet’s website. Note that during nighttime hours, images may not be available (HTTP 404).

Parameters:
  • output_path (str | Path) – Directory path where the downloaded JPEG images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and the N previous hours, skipping unavailable nighttime images. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_global_24h

Download global satellite images.

External

aemetxfb.obs.satellite.get_satellite_global_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images from Meteosat, GOES, and Himawari.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_VIS_24h

Download visible channel images.

External

aemetxfb.obs.satellite.get_satellite_globe_0_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images of the Earth visible from Meteosat at 0° longitude.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_globe_415_24h

Download images from Meteosat at 41.5° longitude.

External

aemetxfb.obs.satellite.get_satellite_globe_415_24h(output_path, period=0, prefix='')[source]

Download infrared satellite images of the Earth visible from Meteosat at 41.5° longitude.

The images are downloaded in GIF format from AEMet’s website. Images are available every 3 hours.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded GIF images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 3 hours. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_globe_0_24h

Download images from Meteosat at 0° longitude.

External

aemetxfb.obs.satellite.get_satellite_airmasses_24h(output_path, period=0, prefix='')[source]

Download RGB composite satellite images showing air mass characteristics.

The images are downloaded in JPEG format from AEMet’s website. These RGB composites combine multiple Meteosat operational channels at 0°N 0°W to provide information about air mass properties and cloud characteristics.

Parameters:
  • output_path (str | Path) – Directory path where the downloaded JPEG images will be saved.

  • period (int, optional) – Number of hours to go back from the latest available data (0-24). Value 0 downloads only the latest available image. Value N downloads the latest image and images up to N hours back, downloading every 1 hour. Default is 0.

  • prefix (str, optional) – Optional prefix to prepend to downloaded filenames. If provided, files will be named as "{output_path}/{prefix}_{remote_filename}". Default is “”.

Returns:

List of paths to downloaded files.

Return type:

list[str]

Raises:
  • ValueError – If period is not between 0 and 24, or if output_path is empty or None.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_IR_24h

Download infrared channel images.

get_satellite_global_24h

Download global satellite images.

External

aemetxfb.obs.satellite.get_satellite_NDVI(output_path)[source]

Download NDVI (Normalized Difference Vegetation Index) satellite image.

The image is downloaded in GIF format from AEMet’s website. This NDVI image is derived from NASA’s MOD13A1 product, using MODIS data from the Terra and Aqua satellites. It shows vegetation development with a resolution of 500 m, updated every 16 days.

Parameters:

output_path (str | Path) – Full path where the downloaded GIF image will be saved. Must have a .gif extension. Parent directories will be created if they do not exist.

Returns:

Path to downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path is empty or None, or if it does not have a .gif extension.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_SST

Download sea surface temperature image.

External

Examples

>>> get_satellite_NDVI("data/ndvi_image.gif")
'data/ndvi_image.gif'
aemetxfb.obs.satellite.get_satellite_SST(output_path)[source]

Download Sea Surface Temperature (SST) satellite image.

The image is downloaded in GIF format from AEMet’s website. This SST image is generated based on the “Global Metop Sea Surface Temperature” product developed by OSI SAF (Ocean and Sea Ice Satellite Application Facility) of EUMETSAT, the center dedicated to satellite ocean and sea ice applications. The image has a resolution of 0.05° and is updated daily, showing temperature values with a maximum age of 48 hours.

Parameters:

output_path (str | Path) – Full path where the downloaded GIF image will be saved. Must have a .gif extension. Parent directories will be created if they do not exist.

Returns:

Path to downloaded file (same as output_path).

Return type:

str

Raises:
  • ValueError – If output_path is empty or None, or if it does not have a .gif extension.

  • RuntimeError – If data cannot be fetched or file cannot be saved.

See also

get_satellite_NDVI

Download NDVI vegetation index image.

External

Examples

>>> get_satellite_SST("data/sst_image.gif")
'data/sst_image.gif'