-
Notifications
You must be signed in to change notification settings - Fork 283
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
PI-2472: _regrid_area_weighted_array: Move averaging out of loop #3589
Closed
abooton
wants to merge
8
commits into
SciTools:master
from
abooton:tweak_area_weighting_regrid_move_averaging_out_of_loop
Closed
PI-2472: _regrid_area_weighted_array: Move averaging out of loop #3589
abooton
wants to merge
8
commits into
SciTools:master
from
abooton:tweak_area_weighting_regrid_move_averaging_out_of_loop
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 tasks
stickler-ci
reviewed
Dec 9, 2019
lib/iris/experimental/regrid.py
Outdated
# Determine whether to mask element i, j based on whether | ||
# there are valid weights. | ||
weights = cached_weights[j][i] | ||
if isinstance(weights, bool) and weights == False: |
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.
E712 comparison to False should be 'if cond is False:' or 'if not cond:'
abooton
force-pushed
the
tweak_area_weighting_regrid_move_averaging_out_of_loop
branch
from
December 10, 2019 13:28
883e0e8
to
a3e9de7
Compare
…== False' is changed to 'and not weights'
abooton
force-pushed
the
tweak_area_weighting_regrid_move_averaging_out_of_loop
branch
from
December 12, 2019 09:09
a9ccf47
to
174a3f3
Compare
Closed superseded by #3596 |
abooton
changed the title
_regrid_area_weighted_array: Move averaging out of loop
PI-2472: _regrid_area_weighted_array: Move averaging out of loop
Dec 24, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimise the averaging in the _regrid_area_weighted_array.
This is achieved by refactoring the weights calculation, collating the data and the weights in a single array, then finally computing the weighted mean as a whole-array-manipulation.
Calculating the weights first is necessary because the size (i.e. number of elements) of the weights and source data region varies per target grid point. In order to record all the values in a single array, the maximum size of the weights array needs to be established, so the single array can be setup. Therefore we first computing the weights and record the maximum weight-array size, hence we have refactored the weights calculation too.