ESMValGroup / ESMValTool

ESMValTool: A community diagnostic and performance metrics tool for routine evaluation of Earth system models in CMIP
https://www.esmvaltool.org
Apache License 2.0
223 stars 128 forks source link

Error when saving iris Cube : "ValueError: Cell measures with missing data are not supported." #3031

Closed valeriupredoi closed 1 year ago

valeriupredoi commented 1 year ago

Discussed in https://github.com/ESMValGroup/ESMValTool/discussions/3025

Originally posted by **mpmoine** January 23, 2023 Dear support, When testing `recipe_sea_surface_salinity.yml` on `MPI-ESM1-2-HR/historical` dataset, preprocessing stops at step 6 (`06_add_fx_variables.nc`) with the following error message: > ValueError: Cell measures with missing data are not supported. Whereas all seem to be fine with the preprocessing of the reference dataset that is `ESACCI-SEA-SURFACE-SALINITY` : preprocessor runs until the end, `last 09_remove_fx_variables.nc `preproc file being generated. The preprocessing operator called is `area_statitics.mean` I am wondering whether this is an iris library problem or rather a miss-use of the recipe from my side? Here attached are the recipe and the log. Many thanks, Marie-Pierre. [main_log_debug.txt](https://github.com/ESMValGroup/ESMValTool/files/10482767/main_log_debug.txt) [recipe_sea_surface_salinity.yml.txt](https://github.com/ESMValGroup/ESMValTool/files/10482787/recipe_sea_surface_salinity.yml.txt)
valeriupredoi commented 1 year ago

I have just converted the Discussions item created by @mpmoine to an Issue because I think this is a tad more serious and needs investigation - possibly will move this to Core depending on what outcome we reach to here.

@mpmoine many thanks for the detailed report, but can I be a bother and ask you a couple more questions please? Namely:

remi-kazeroni commented 1 year ago

My suspicion is that this issue is related to the latest iris version as @valeriupredoi wrote in this comment. I think the iris version used can also be found in /opt/conda/envs/esmvaltool/lib/python3.10/site-packages/iris/_version.py.

The fact that I could run the recipe successfully with a recent installation of the Tool (using iris 3.4.0) and the same version of the MPI-ESM1-2-HR/historical dataset suggests that this error only occur when saving intermediary preprocessed cubes (save_intermediary_cubes: true). @mpmoine, could you try re-running the recipe using save_intermediary_cubes: false in your config-user.yml file? If that runs, it may mean that one of the preprocessor alters the cell_measures in a wrong way.

valeriupredoi commented 1 year ago

very good points all round, @remi-kazeroni - proper detective analysis :mag:

mpmoine commented 1 year ago

Hi guys,

Here are the versionsof the libraries I use with ESMValCore 2.7.0 / ESMValTool: 2.7.1.dev0+g97e395e57.d20221028:

I performed the test @remi-kazeroni suggested, keeping this install and turning save_intermediary_cubes: false and it is successful 👍

What I plan to test next is to upgrade to ESMValCore 2.7.1 and test with save_intermediary_cubes: true again. Does this makes sense?

Thanks! PS: I am running on a Cerfacs' internal analysis server

valeriupredoi commented 1 year ago

@mpmoine cheers very much for your investigations! It's good to see the replication of the issue and a possible cause (the saving of intermediary files) - as Remi pointed out, and tested by you. I wouldn't investigate more with a slightly newer version of ESMValTool - it would be good if you could (or the sys admins could) bring in ESMValCore=2.7.1 - so a recreation of the env would be needed, so that iris can be updated to a later version, ideally 3.4 (I am not sure if this will be solving the issue of the runs with intermediary save, but it's possible iris have relaxed the save rules from iris= 3.2 to 3.4)

remi-kazeroni commented 1 year ago

Thanks for your answer @mpmoine! I had another try at your recipe using the latest ESMValTool version (i.e. ESMValCore=2.7.1, iris=3.4.0) with save_intermediary_cubes: true and got the same error. So updating your installation may not solve your issue.

I also tried your recipe, replacing the MPI-ESM1-2-HR dataset by other CMIP6 datasets, still using save_intermediary_cubes: true. This led to other types of error, not related to the Cell measure issue you encountered. It could be that in some cases, a particular sequence of preprocessing operations, where all intermediary results are saved, leads to failures if the model is not 100% fully CMOR-compliant... Note that the preprocessing works fine for the OBS6 data used in your recipe. I'm not sure what is the best way forward here. This could be more model-related than an issue with our preprocessors or Iris... How important is it to run the recipe with save_intermediary_cubes: true in this case?

mpmoine commented 1 year ago

To answer your last question @remi-kazeroni I do no need to have save_intermediary_cubes: true. So you must be wondering why I am bothering you with this? 😉 Hum, well, at the origin, I just tuned it to true to get intermediate results, and better understand the ESMValTool wokflow but did not imagine this would generate errors. I now keep it to false for my next runs with other recipes. Many thanks to both of you @remi-kazeroni and @valeriupredoi for solving this issue! 🍻

valeriupredoi commented 1 year ago

many thanks to you @mpmoine for unearthing a bug that's probably been dormant for a while! I'll look into this, see what is the actual hap there :beer:

valeriupredoi commented 1 year ago

OK guys, so I managed to reproduce the error just using a barebones recipe with only the area mean preprocessor and of course, just the intermediary save turned on; this is now easier to see what the sacrebleu is going on :+1:

valeriupredoi commented 1 year ago

problem identified as a bug in ESMValCore via a weird feature from iris, see https://github.com/ESMValGroup/ESMValCore/issues/1917 - I will close this since we can talk there :+1: Many thanks @mpmoine - it was indeed a dormant bug that you unearthed for us! :beer: