ESMValGroup / ESMValCore

ESMValCore: A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts.
https://www.esmvaltool.org
Apache License 2.0
42 stars 38 forks source link

Calendar conversion in the ETCCDI recipe #2372

Open nicocortesi opened 6 months ago

nicocortesi commented 6 months ago

Hi! There is an issue when running 'recipe_extreme_events.yml' to measure the set of indices of extreme events of the ETCCDI.

In this recipe, model data and observational datasets are combined. It is known that when the datasets have daily resolution, non-standard model calendars can cause issues (see e.g. Issue #2106).

In this case, the preprocessor function 'fix_metadata' fails at converting the Proleptic Gregorian calendar of the daily reanalysis values from ERA5 (pr, tas, tasmax, tasmin) to the Standard calendar of the CMIP6 models:

_ValueError: Unable to convert from 'Unit('days since 1950-1-1 00:00:00', calendar='prolepticgregorian')' to 'Unit('days since 1850-1-1 00:00:00.0', calendar='standard')'

Changing the calendar of ERA5 data from Proleptic Gregorian to Standard didn't fix the issue, as a different error is introduced:

_ValueError: invalid day number provided in cftime.DatetimeGregorian(1950, 2, 30, 12, 0, 0, 0, has_yearzero=False)

which I'm not able to solve. Do you know any possible fix?

I attach the recipe and the main log debug:

main_log_debug.txt recipe_extreme_events.txt