Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update a diagnostic to new Iris version #2390

merged 1 commit into from Oct 28, 2021


Copy link

@katjaweigel katjaweigel commented Oct 28, 2021


Recipe recipe_flato13ipcc.yml crashes due to a new IRIS version:
2021-10-28 11:31:58,651 [5412] INFO esmvaltool.diag_scripts.shared._base,550 Creating /work/bd1083/b380216/output/recipe_flato13ipcc_20211028_100738/plots/fig09-14/fig09-14
Traceback (most recent call last):
File "/mnt/lustre02/work/bd1083/b380216/CORE202102/ESMValTool/esmvaltool/diag_scripts/ipcc_ar5/", line 407, in
File "/mnt/lustre02/work/bd1083/b380216/CORE202102/ESMValTool/esmvaltool/diag_scripts/ipcc_ar5/", line 396, in main
plot_path = produce_plots(config, data)
File "/mnt/lustre02/work/bd1083/b380216/CORE202102/ESMValTool/esmvaltool/diag_scripts/ipcc_ar5/", line 351, in produce_plots
lines, labels = plot_zonal_mean_errors_ensemble(
File "/mnt/lustre02/work/bd1083/b380216/CORE202102/ESMValTool/esmvaltool/diag_scripts/ipcc_ar5/", line 259, in plot_zonal_mean_errors_ensemble
cube_list = multi_model_merge(zonal_mean_errors)
File "/mnt/lustre02/work/bd1083/b380216/CORE202102/ESMValTool/esmvaltool/diag_scripts/ipcc_ar5/", line 177, in multi_model_merge
File "/work/bd0854/b380216/anaconda3/envs/esmvaltool202106/lib/python3.9/site-packages/iris/experimental/", line 30, in equalise_attributes
raise Exception(emsg)
Exception: The function "iris.experimental.equalise_cubes.equalise_attributes" has been moved.
Please replace "iris.experimental.equalise_cubes.equalise_attributes()" with "iris.util.equalise_attributes()".

It should be easy to fix with changing:
from iris.experimental.equalise_cubes import equalise_attributes
from iris.util import equalise_attributes
This new line is already used in ESMValCore/esmvalcore/preprocessor/

I make this a draft first because I want to check if it runs (it did not the first time but that could have been caused by other issues.)

  • Closes #issue_number
  • Link to documentation:


It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 馃洜 Technical or 馃И Scientific review.

New or updated recipe/diagnostic

To help with the number of pull requests:

Copy link

@zklaus zklaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean.

@zklaus zklaus added this to the [locked] v2.4.0 milestone Oct 28, 2021
@zklaus zklaus marked this pull request as ready for review October 28, 2021 13:55
@zklaus zklaus changed the title Import needs to be changed because function was moved in IRIS. Update a diagnostic to new Iris version Oct 28, 2021
@zklaus zklaus merged commit b762a4b into main Oct 28, 2021
@zklaus zklaus deleted the Fix_moved_iris_function_equalise_attributes branch October 28, 2021 13:57
Copy link
Contributor Author

katjaweigel commented Oct 29, 2021

Sorry, that I'm to slow with the tests, but recipe_flato13ipcc.yml still doesn't run. That is probably not caused by that line but related: In addition to equalise_attributes the diagnostic removes several possible the auxiliary coordinates for time to allow for the multi model mean with:

for cube in cube_list:
    cube.cell_methods = tuple()
    for coord in ['day_of_month', 'month_number', 'year']:
        except CoordinateNotFoundError:

Now it looks as there is a new one in one of the data sets, which is not included, yet. I get the error:

iris.exceptions.MergeError: failed to merge into a single cube.
Coordinates in cube.aux_coords (scalar) differ: time.

(I also had to remove several data sets from the recipe to come to that point because I didn't want to check the new download tool.)
I try to find the aux_coord name or data set which causes that and will open a new PR if removing an additional aux_coord helps.
The best is probably to use (or mimic) the complete function used for a similar purpose in the preprocessor (esmvalcore/preprocessor/

def _combine(cubes):
"""Merge iris cubes into a single big cube with new dimension.

This assumes that all input cubes have the same shape.
equalise_attributes(cubes)  # in-place

for i, cube in enumerate(cubes):
    concat_dim = iris.coords.AuxCoord(i, var_name=CONCAT_DIM)


    # Clear some metadata that can cause merge to fail
    #    merge_and_concat.html#common-issues-with-merge-and-concatenate

    cube.cell_methods = None

    for coord in cube.coords():
        coord.long_name = None
        coord.attributes = None

cubes = iris.cube.CubeList(cubes)

merged_cube = cubes.merge_cube()

return merged_cube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants