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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in area_statistics preprocessor: AttributeError: 'str' object has no attribute 'ndim' #2208

Closed
ehogan opened this issue Sep 27, 2023 · 2 comments
Assignees

Comments

@ehogan
Copy link
Contributor

ehogan commented Sep 27, 2023

Describe the bug
I was looking at a RTW issue today, but when I run the current version of the RTW (which uses the latest versions i.e. main of ESMValCore and ESMValTool), the radiation budget recipe fails with the error:

  File "/latest/ESMValCore/esmvalcore/preprocessor/_area.py", line 397, in area_statistics
    result = cube.collapsed(coord_names, operation, weights='cell_area')
  File "/environments/esmvaltool-2.8.0/lib/python3.10/site-packages/iris/cube.py", line 3936, in collapsed
    if weights is not None and weights.ndim > 1:
AttributeError: 'str' object has no attribute 'ndim'

I can confirm that the radiation budget recipe passes using ESMValTool v2.9.0.

The change to L397 in ESMValCore/esmvalcore/preprocessor/_area.py was introduced in #2139, after the v2.9.0 release.

@schlunma, @valeriupredoi, tagging you both since you developed and reviewed #2139, respectively; would either of you know how to fix this quickly? Otherwise I can look more closely at it :)

@schlunma
Copy link
Contributor

Have you updated iris to the latest version? This exact error appears when using an old iris version (I believe <3.5).

@ehogan
Copy link
Contributor Author

ehogan commented Sep 27, 2023

Ah, thanks @schlunma, that's exactly it; I'm using an old v2.9.0 environment that contains Iris v3.4.1. I will try with a more recent version of Iris and I'll go ahead and close this issue :)

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

No branches or pull requests

2 participants