CORDEX-be2 / ValEnsPy

A Python package to Validate Ensembles of gridded model data
GNU General Public License v3.0
1 stars 0 forks source link

Bug: ERA5 Inputconverter unit conversion #111

Open Ivanderkelen opened 4 months ago

Ivanderkelen commented 4 months ago

Describe the bug For accumulated variables (hfls, pr) the ERA5 and ERA5 unit conversion is not working as it should. This could be due to (i) the postprocessing of hourly to daily variables done outside Valenspy or (ii) the way the accumulated variables are calculated in ERA5 itself (eg J/m2 fir hourly values are not corresponding to the energy in one hour, but to the energy over one day).

By loading the hourly values and dividing by 86400 (secs per day), values in the correct range are obtained. This needs to be double changed and fixed in the inputconvertor.

https://confluence.ecmwf.int/display/CKB/ERA5-Land%3A+data+documentation, search for Wm-2

Ivanderkelen commented 4 months ago

In addition, in ERA5 (and models) upward sensible and latent heat fluxes are defined negative, while in CORDEX defenition is positive. The bugfix should also account for this.

Ivanderkelen commented 3 months ago

see also #129

fserras299 commented 3 months ago

Issue is most likely due to cclm units. The cclm units were changed in the attributes without actually being recalculated. A warning should be included if units are changed but no calculation was carried out.

Ivanderkelen commented 3 months ago

Thanks for this Fien To turn on the warnings, best to check this is not on in the notebook: and if so, delete these lines.

# Turn off all warnings
warnings.filterwarnings('ignore')
Ivanderkelen commented 3 months ago

tagging @kobebryant432 in case he would check this too

fserras299 commented 3 months ago

I have been able to solve the issue related to precipitaiton. It appears to be two-fold:

  1. Change of units in the attributes without including the calculation
  2. Inputconverter for precipitation returned the daily mean precipitation. Meaning that the conversion from kg/m2 to kg/m2s used daily time steps while data was hourly averages.

--> also issue with CCLM postprocessing of precipitation as only daily mean and not daily totals are returned

kobebryant432 commented 3 months ago

Great Fien! In have you been able to push these changes yet? If so in which branch? I have seen that there are some other input_conversion issue - so I am writing some tests to automatically catch these in the future - see #139

fserras299 commented 3 months ago

The changes have been added to the cclm_inputconvertor

kobebryant432 commented 2 months ago

@Ivanderkelen and @fserras299 I am correct that precipitation is no longer an issue here and that we are currently still investigating the other variables (energy fluxes, ...) in #146

If this is the case than I will close #129

Ivanderkelen commented 2 months ago

Yes, I think this is correct.