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

iris.exceptions.NotYetImplementedError: Coord AuxCoord #4000

Closed
SarahAlidoost opened this issue Feb 12, 2021 · 7 comments · Fixed by #4159
Closed

iris.exceptions.NotYetImplementedError: Coord AuxCoord #4000

SarahAlidoost opened this issue Feb 12, 2021 · 7 comments · Fixed by #4159

Comments

@SarahAlidoost
Copy link

🐛 Bug Report

The order in which a mathematical operation is applied on a 'iris.coords.AuxCoord' and 'iris.cube.Cube' makes a difference, i.e.
iris.cube.Cube / iris.coords.AuxCoord works fine whereas iris.coords.AuxCoord / iris.cube.Cube returns the error as:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sarah/anaconda3/envs/iris/lib/python3.8/site-packages/iris/coords.py", line 464, in __truediv__
    return self.__binary_operator__(other, self._MODE_DIV)
  File "/home/sarah/anaconda3/envs/iris/lib/python3.8/site-packages/iris/coords.py", line 425, in __binary_operator__
    raise iris.exceptions.NotYetImplementedError(emsg)
iris.exceptions.NotYetImplementedError: Coord / AuxCoord

A workaround to avoid the error is that the user takes care of the order of "Cubes" and "Auxcoords". However, this can cause a problem in complicated equations including several terms.

How To Reproduce

Steps to reproduce the behaviour:

  1. please see cube math documentation, section Combining Multiple Phenomena to Form a New One.
  2. first, load the pressure cube as it is explained.
  3. then, define P0 as it is explained.
  4. calculate the new pressure using the equation (pressure / p0): this works fine.
  5. now make a different equation by changing the order i.e. (p0 / pressure): this returns the error, mentioned above.
  6. replace the operator " / " with any operators of " + ", " - ", or " * " and repeat steps 3 and 4: the same things happen.

Environment

  • OS & Version: Ubuntu 20.04 LTS
  • Iris Version: 3.0.1
  • environment file is attached iris.txt.
@rcomer
Copy link
Member

rcomer commented Feb 12, 2021

An alternative workaround would be to define p0 as a scalar cube:

p0 = iris.cube.Cube(1000.0, long_name='reference_pressure', units='hPa')
p0 / pressure

this has only worked since Iris 3.0.

If I keep p0 as an AuxCoord, I also get an error for p0 / pressure under Iris 2.4, so I'm curious about which Iris version ESMValTool used before.

@rcomer
Copy link
Member

rcomer commented Feb 12, 2021

Ah, I see Coord + Cube and Coord * Cube did work at Iris 2.4, and those seem to be the cases you are addressing at ESMValGroup/ESMValTool#2023.

@bjlittle almost completely rewrote arithmetic for Iris 3.0 (making it better in all sorts of ways) so he'll know how easy it would be to reinstate that functionality.

@bjlittle bjlittle self-assigned this Feb 21, 2021
@bjlittle
Copy link
Member

bjlittle commented Feb 21, 2021

@SarahAlidoost Apologies for the delay in getting back to you... and thanks for taking the time to raise your very first iris issue 😄

Okay, so you've given me everything I need to replicate this issue and investigate further. So leave it with me and I'll take it from here. I'll get back as soon as possible once I've figured out a way forward and a plan of action.

Thanks again 👍

@bjlittle
Copy link
Member

bjlittle commented Mar 2, 2021

Hey @SarahAlidoost,

Just to let you know that I can easily recreate this issue on Iris master and the release feature branch v3.0.x.

We're going to make an Iris v3.0.2 patch release which will include the fix for this issue... it will also pull in at least one other bugfix in the patch release, which is another free win for the community 🥳

You can track our progress with the v3.0.2 release on this Iris GitHub project... but I'll also update you here.

I don't have an ETA of when v3.0.2 will be available, but I'm keen to resolve this ASAP. When tentative release dates do start to form, again I'll let you know here 👍

@SarahAlidoost
Copy link
Author

Hey @SarahAlidoost,

Just to let you know that I can easily recreate this issue on Iris master and the release feature branch v3.0.x.

We're going to make an Iris v3.0.2 patch release which will include the fix for this issue... it will also pull in at least one other bugfix in the patch release, which is another free win for the community

You can track our progress with the v3.0.2 release on this Iris GitHub project... but I'll also update you here.

I don't have an ETA of when v3.0.2 will be available, but I'm keen to resolve this ASAP. When tentative release dates do start to form, again I'll let you know here

thanks a lot for the explanations and update. Looking forward to v3.0.2 release 👍

@alastair-gemmell alastair-gemmell unpinned this issue Apr 19, 2021
@bjlittle bjlittle pinned this issue May 14, 2021
@bjlittle bjlittle unpinned this issue May 26, 2021
@bjlittle
Copy link
Member

Hey @SarahAlidoost,

It's been a while, but I've not forgotten about you or this issue 😄

Just to let you know that we're in the final stages of pulling together iris v3.0.2 and I'm currently working on this issue right now.

I'm glad to say that I've managed to work out the root cause of the problem, and I'm now testing my fix. Once my fix is tested, reviewed and merged, we'll then release iris v3.0.2, which will be available before the end of next week i.e., before Friday 4th June 2021.

Thanks for your patience 👍

@bjlittle bjlittle linked a pull request May 27, 2021 that will close this issue
@bjlittle
Copy link
Member

Closed by #4159

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

Successfully merging a pull request may close this issue.

3 participants