-
Notifications
You must be signed in to change notification settings - Fork 286
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: Set order y_dim, x_dim axis to be last dimensions #3587
PI-2472: _regrid_area_weighted_array: Set order y_dim, x_dim axis to be last dimensions #3587
Conversation
src_data = np.moveaxis(src_data, y_dim, -2) | ||
x_dim = src_data.ndim - 1 | ||
y_dim = src_data.ndim - 2 | ||
|
||
# Create empty data array to match the new grid. |
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.
- test_regrid_transposed is the only test that has an input that is affected by
np.moveaxis
(the fourth loop). Would it be possible to add a test with an input that is affected bynp.moveaxis
for each of the other loops? - Since all the other tests don't require any axes to be moved, is it worth performing a check to determine whether an axis needs to be moved before moving it?
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.
Possibly. If we add a test for data ordered: [x, z, y], and like [y, x, z] I think this captures most of it. In the next PR we ensure we have x and y dims to might want to re-evaluate this next.
2124de1
to
3a14cb1
Compare
z = src.coord("model_level_number") | ||
lat = src.coord("grid_latitude") | ||
lon = src.coord("grid_longitude") | ||
z_shape = 4 |
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.
F841 local variable 'z_shape' is assigned to but never used
lat = src.coord("grid_latitude") | ||
lon = src.coord("grid_longitude") | ||
z_shape = 4 | ||
lat_shape = 3 |
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.
F841 local variable 'lat_shape' is assigned to but never used
lon = src.coord("grid_longitude") | ||
z_shape = 4 | ||
lat_shape = 3 | ||
lon_shape = 2 |
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.
F841 local variable 'lon_shape' is assigned to but never used
3a14cb1
to
0792ad1
Compare
Closing as superseded by #3594 |
Re-order the axis to be [..., y_dim, x_dim]. The weights.T then becomes redundant.
Changes are in preparation for optimising the averaging.