Skip to contents

Reads raw ERA5 historical and climate model projection parquets from the open-meteo-pipeline repository, performs spatial averaging across grid points, splices ERA5 observations with model projections for future dates, and writes daily and weekly aggregated parquets to the MOSAIC-data processed directory.

Usage

process_open_meteo_data(PATHS, climate_model = "MRI_AGCM3_2_S", force = FALSE)

Arguments

PATHS

A list of paths generated by get_paths(), must include:

  • OPEN_METEO_REPO: Path to the open-meteo-pipeline repository.

  • DATA_CLIMATE: Path to weekly climate output directory.

  • DATA_CLIMATE_DAILY: Path to daily climate output directory.

climate_model

Character string specifying the climate model for future projections. Default "MRI_AGCM3_2_S".

force

Logical. If TRUE, re-process all countries even if output files already exist and are up to date. Default FALSE.

Value

Invisibly returns the weekly output directory path. Writes one parquet per country to both PATHS$DATA_CLIMATE_DAILY and PATHS$DATA_CLIMATE.

Details

For each of the 40 MOSAIC countries, the function:

  1. Reads all ERA5 monthly parquets (wide format, per-grid-point, daily)

  2. Reads all climate model annual parquets (same schema)

  3. Converts timestamps to Date

  4. Splices ERA5 as primary source (real observations) with climate model projections for future dates only (clean cutover at ERA5's last date)

  5. Pivots from wide to long format (17 climate variables)

  6. Computes spatial mean across grid points per day per variable

  7. Writes daily output

  8. Aggregates to weekly: mean for most variables, sum for precipitation_sum and et0_fao_evapotranspiration_sum

  9. Writes weekly output