
Process Open-Meteo Climate Data from open-meteo-pipeline Repository
Source:R/process_open_meteo_data.R
process_open_meteo_data.RdReads 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.
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. DefaultFALSE.
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:
Reads all ERA5 monthly parquets (wide format, per-grid-point, daily)
Reads all climate model annual parquets (same schema)
Converts timestamps to Date
Splices ERA5 as primary source (real observations) with climate model projections for future dates only (clean cutover at ERA5's last date)
Pivots from wide to long format (17 climate variables)
Computes spatial mean across grid points per day per variable
Writes daily output
Aggregates to weekly: mean for most variables, sum for
precipitation_sumandet0_fao_evapotranspiration_sumWrites weekly output