Skip to content
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

Pcolormesh wrapping fix #1622

Merged
merged 2 commits into from
Aug 20, 2020
Merged

Conversation

greglucas
Copy link
Contributor

This implements the diagonal test that @htonchia put in #1467 and adds them as a coauthor to that commit.
I additionally added a simple test to demonstrate that works as expected.

There was some additional things in that other PR that can still be implemented later if desired.

Rationale

Fixes several issues with identifying cells to mask and then uses pcolor to draw them properly.

Fixes #1416
Fixes #1447
Fixes #1328

Implications

Slight difference in edge length calculation determining what the maximum cell diagonal vs edge length is compared to before. That is why I set this at 2*sqrt(2) now, otherwise the Goode image will fail if it is just half the distance like previous edge distances.

greglucas and others added 2 commits August 7, 2020 08:57
Use diagonals to calculate the size of cells rather than just
the edge lengths which was done previously. This prevents
big cells from spanning the entire plot.

Co-authored-by: htonchia <[email protected]>
Adds a test of a cell that cross the boundary at a diagonal with
the top edge on one side of the boundary and the bottom edge
on the other.
@greglucas greglucas force-pushed the pcolormesh_wrapping branch from dd3d5eb to 24b1edc Compare August 7, 2020 14:57
@greglucas greglucas added this to the 0.19 milestone Aug 20, 2020
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good.

@QuLogic QuLogic merged commit 08db54f into SciTools:master Aug 20, 2020
sdeastham referenced this pull request in sdeastham/gcgridobj Sep 10, 2020
…crosses 180E

An upcoming update to Cartopy (expected in 0.19.0) enables pcolormesh to correctly
display polygons crossing the antimeridian. This removes the need for thresholding
at that location, and means that ALL cubed sphere data is now shown on plots. Users
can recover the old functionality by passing the argument `cs_threshold=5` when
calling `plot_layer` (or the lower-level `plot_cs` function). A side effect of this
fix is that a wrapped set of polgyons is sometimes generated when plotting one of
the cubed-sphere faces. `plottools.set_clim` has been modified to account for this.
@greglucas greglucas deleted the pcolormesh_wrapping branch September 5, 2021 19:18
@rvalenzuelar
Copy link

Just for documenting, I had the same issue today. Before plotting with Cartopy I had to convert the coordinates to a positive range, like Lon[Lon<0]=Lon[Lon<0]+360. Then, plotting with Cartopy shows no wrapping (although Matplotlib still shows it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment