-
Notifications
You must be signed in to change notification settings - Fork 284
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
Make cube.exponentiate lazy #1846
Conversation
test_data = tests.get_data_path(('PP', 'simple_pp', 'global.pp')) | ||
cube = iris.load_cube(test_data) | ||
exponentiate(cube, self.exponent, in_place=True) | ||
self.assertTrue(cube.has_lazy_data()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed the crucial step here. If you checked the data, I think you will find that it isn't correct.
Review actions. I've simplified |
result = exponentiate(cube, self.exponent) | ||
self.assertMaskedArrayEqual(result.data, expected) | ||
|
||
@tests.skip_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really need to use real data here. We can just use the lazy_array
method to get lazy data on the cube.
I think this is getting there. Is there documentation which needs updating? Is there in_place docs somewhere which describe the behaviour? |
I've taken a look; there is nothing in the cube mathematics section of the userguide about performing operations inplace. In the reference guide almost all of the mathematical operators have the
It's pretty terse, which actually means it is still correct. I could update it:
But that's increased the length of the description, which has not necessarily helped its cause. |
Agree, that doesn't really help. Maybe just a what's new item then. |
++ whatsnew ?? |
@pp-mo - is this lined for 1.9? |
Not unless you want to push for it. |
Rebase. Wonder whether the Biggus updates between when I opened this and now will have helped move this along? |
@dkillick Is there anything that can be done with this to get it moving again? The ticket is a year old. That's a bit ridiculous. Let me know if I can do something about this or bother someone who can. |
e58c1dc
to
d40b103
Compare
Another six months, another rebase... thanks @corinnebosley |
@dkillick Well that sucks. |
@dkillick 'The build has been terminated'.... Must be because it's Friday afternoon. Travis is probably at the pub by now. |
@@ -0,0 +1,94 @@ | |||
# (C) British Crown Copyright 2015, Met Office |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the license header is the only problem, we might be ok after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is far from being our only problem I suspect... Is it really complaining about the license header??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far, but the tests didn't complete, so...
I'd say see #2229. |
d40b103
to
584574d
Compare
Done (and mercifully painless!) - thanks @marqh |
there is now an explicit text failure that needs addressing: |
Hi @dkillick please could you review the test failures and see if this PR can be brought up to speed? If successful, please consider targeting the 1.12.x branch for 1.12 release thank you |
This PR is probably quite out of date with the recent dask work for v2. It might be worth checking to see if we have already go exp to be lazy at this point... |
Update: it's ambiguous as to whether it is lazy, but there is certainly scope for it to be lazy with the current implementation. https://github.com/SciTools/iris/blob/master/lib/iris/analysis/maths.py#L542 has the line:
Which presumably means that if data is a dask array, and it has lazy exp, then iris does lazy exp... 🎉 |
Changes the last line in
iris.analysis.maths._math_op_common
to use lazy data. This meansiris.analysis.maths.exponentiate
(providingcube ** exponent
functionality) is now lazy.As I was in the space, I've also added some tests for
iris.analysis.maths.exponentiate
. These do not follow the pattern of the other test modules in the directory as we do not make use of anoperator
attribute for cube exponentiation.