Keep seam faces in polygon plots#1519
Open
rajeeja wants to merge 2 commits into
Open
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses seam/antimeridian artifacts in face-centered shaded polygon plots by changing the default periodic-element handling to preserve seam-crossing faces, and adds regression coverage for the NE30PG2 SCRIP tutorial dataset.
Changes:
- Switch
UxDataArray.plot.polygons()(and thusUxDataArray.plot()for face-centered data) to defaultperiodic_elements="split"so seam-crossing faces are not dropped. - Add a NE30PG2 regression test intended to ensure antimeridian faces are preserved when using split handling.
- Update plotting documentation to reflect the new default and show explicit
excludevssplitexamples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
uxarray/plot/accessor.py |
Changes default polygon plotting behavior to split periodic (seam-crossing) faces and updates docstring text. |
test/core/test_dataarray.py |
Adds a NE30PG2 regression test for split periodic handling (with a few correctness/naming adjustments needed). |
docs/user-guide/plotting.ipynb |
Updates user-guide narrative and examples to match the new default and recommended options. |
docs/user-guide/mpl.ipynb |
Clarifies Matplotlib to_polycollection() default periodic handling in the docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+392
to
396
| Specifies whether to split, include, or exclude periodic elements in the grid. | ||
| Options are: | ||
| - "exclude": Exclude periodic elements, | ||
| - "split": Split periodic elements. | ||
| - "exclude": Exclude periodic elements, | ||
| - "ignore": Include periodic elements without any corrections |
| datasetpath("scrip", "ne30pg2", "data.nc"), | ||
| ) | ||
|
|
||
| gdf = uxds["RELHUM"].isel(lev=0).to_geodataframe(periodic_elements="split") |
| assert len(pc_geoflow_grid._paths) == uxds_geoflow.uxgrid.n_face | ||
|
|
||
|
|
||
| def test_plot_polygons_preserves_antimeridian_faces(gridpath, datasetpath): |
This file contains hidden or 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
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.
Summary
Closes #1518