bakaano.meteo

Meteorological forcing download and preprocessing.

Role: Retrieve and prepare precipitation and temperature forcings.

class bakaano.meteo.Meteo(working_dir, study_area, start_date, end_date, local_data=False, data_source='CHELSA', local_prep_path=None, local_tasmax_path=None, local_tasmin_path=None, local_tmean_path=None)[source]

Bases: object

check_missing_dates(variables=None, scratch_dir=None)[source]

Check for missing daily ERA5-Land GeoTIFFs in scratch folder.

Parameters:
  • variables (list[str], optional) – Variable names to check.

  • scratch_dir (str | Path, optional) – Directory containing raw daily GeoTIFFs for the requested variables.

Returns:

Missing dates in YYYY-MM-DD format.

Return type:

list[str]

export_urls_for_download_manager()[source]

Export CHELSA download URLs to text files in the working directory.

get_chelsa_meteo_data()[source]

Download/process CHELSA daily data (or load local NetCDFs).

Returns:

prep_nc, tasmax_nc, tasmin_nc, tmean_nc.

Return type:

tuple[xr.Dataset, xr.Dataset, xr.Dataset, xr.Dataset]

get_chirps_prep_meteo_data()[source]

Download/process CHIRPS precipitation and ERA5 temperatures.

Returns:

prep_nc, tasmax_nc, tasmin_nc, tmean_nc.

Return type:

tuple[xr.Dataset, xr.Dataset, xr.Dataset, xr.Dataset]

get_era5_land_meteo_data()[source]

Download/process ERA5-Land daily data and return datasets.

Returns:

prep_nc, tasmax_nc, tasmin_nc, tmean_nc.

Return type:

tuple[xr.Dataset, xr.Dataset, xr.Dataset, xr.Dataset]

get_meteo_data()[source]

Get meteo data for the selected source.

Returns:

prep_nc, tasmax_nc, tasmin_nc, tmean_nc.

Return type:

tuple[xr.Dataset, xr.Dataset, xr.Dataset, xr.Dataset]

plot_meteo(variable, date)[source]

Plot a meteorological field for a given date.

Parameters:
  • variable (str) – One of "precip", "tasmax", "tasmin", "tmean".

  • date (str or datetime) – Date to plot (nearest available).

Returns:

None. Displays a matplotlib plot.