-
Notifications
You must be signed in to change notification settings - Fork 297
Fix circular quiver plots #3371
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
Conversation
# Test circular longitude does not cause a crash. | ||
res = 5 | ||
lat = DimCoord(np.arange(-90, 91, res), 'latitude', | ||
units='degrees_north') |
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.
E127 continuation line over-indented for visual indent
lat = DimCoord(np.arange(-90, 91, res), 'latitude', | ||
units='degrees_north') | ||
lon = DimCoord(np.arange(0, 360, res), 'longitude', | ||
units='degrees_east') |
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.
E127 continuation line over-indented for visual indent
u_arr = np.ones((nlat, nlon)) | ||
v_arr = np.ones((nlat, nlon)) | ||
u_cube = Cube(u_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], | ||
standard_name='eastward_wind') |
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.
E127 continuation line over-indented for visual indent
u_cube = Cube(u_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], | ||
standard_name='eastward_wind') | ||
v_cube = Cube(v_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], | ||
standard_name='northward_wind') |
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.
E127 continuation line over-indented for visual indent
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.
Nice addition @stephenworsley 👍
I believe the test should have an assertion of success/non-error?
@trexfeathers thanks. |
OK, sounds good to me 😊 |
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.
Thanks @stephenworsley !
Just a small change needed then this should be good to go
standard_name='eastward_wind') | ||
v_cube = Cube(v_arr, dim_coords_and_dims=[(lat, 0), (lon, 1)], | ||
standard_name='northward_wind') | ||
u_cube.coord('longitude').circular = True |
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.
Could you also set circular=True
for v_cube?
I know we don't explicitly do a compatibility check for the u_cube and v_cube as it is still a TODO but once that is fixed, it would throw up an error about the longitude coordinates being different on u_cube and v_cube.
Also, you could do it when you initialise the lon
, i.e.:
lon = DimCoord(np.arange(0, 360, res), 'longitude',
units='degrees_east', circular=True)
As that would apply to both u_cube and v_cube
Great! Thanks @stephenworsley ! |
Fixes bug in #3340.