Closed
Description
📰 Custom Issue
As a subtask of #4754 is to rewrite the algorithm for AreaWeighted to use sparse matrices as the standard (if this improves performance). Looking at the code for area weighted regridding, it looks like there are a few opportunities to improve performance.
- Weight calculation happens in a nested for loop over x and y dimensions, e.g:
iris/lib/iris/analysis/_area_weighted.py
Line 889 in dab88e8
- The weights are applied using numpy average functions where matrix multiplication may be more appropriate
iris/lib/iris/analysis/_area_weighted.py
Line 510 in dab88e8
- It may turn out to be even more performant to store two weight matrices, one for each dimension. Each may then be applied independently.
- Note: In order for the application of weights to be separated, normalisation due to masked data will have to be handled after the application of weights as a separate step. This is not possible when using numpy average methods where the normalisation step is built in.
This would require rewriting much of the code for AreaWeighted from the ground up. This may be slightly simplified by following templates set by the use of sparse matrices in other Iris regridders.
Metadata
Metadata
Assignees
Labels
No labels