Skip to content

DRAFT: Support ccrs.Geodetic source projection, add Polygon plot to Grid #1231

Closed
philipc2 wants to merge 6 commits into
mainfrom
geodesic
Closed

DRAFT: Support ccrs.Geodetic source projection, add Polygon plot to Grid #1231
philipc2 wants to merge 6 commits into
mainfrom
geodesic

Conversation

@philipc2
Copy link
Copy Markdown
Member

@philipc2 philipc2 commented May 2, 2025

Closes #1230

Overview

  • Adds support for using Cartopy's Geodetic projection as a source projection, allowing for better visualization of grids on the surface of a sphere and for handling splitting along the dateline: shapes crossing the dateline are not plotted correctly holoviz/geoviews#107
  • Using the Geodetic projection is especially useful for coarser grids where the distortion is more noticeable, and over the poles
  • Implements a Grid.plot.polygons() method that plots shaded polygons using the index of each face.

Examples

No Source Projection

image

Geodetic Source Projection

image

@philipc2 philipc2 self-assigned this May 2, 2025
@philipc2 philipc2 marked this pull request as ready for review May 2, 2025 17:01
@philipc2 philipc2 requested review from Copilot and erogluorhan May 2, 2025 17:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for using Cartopy's Geodetic projection as a source CRS and implements a new polygons plotting method to shade grid faces by their index. Key changes include:

  • The introduction of the check_crs helper function in utils.py to handle CRS adjustments.
  • Modifications to the edges and mesh methods and the addition of a new polygons method in accessor.py.
  • Updates to the test suite (test_plot.py) to cover these new functionalities.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
uxarray/plot/utils.py Added check_crs function for CRS handling
uxarray/plot/accessor.py Updated edges, mesh; added polygons method with CRS adjustments and raster settings
test/test_plot.py Extended tests to cover new polygons plotting and Geodetic projection usage

Comment thread uxarray/plot/utils.py Outdated
philipc2 and others added 3 commits May 2, 2025 12:10
Copy link
Copy Markdown
Member

@erogluorhan erogluorhan left a comment

Choose a reason for hiding this comment

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

This is great! Some thoughts on a few things though:

  • The name grid.plot.polygons() can potentially be confused with our polygons() visualizations that plot data values based polygons instead.
    • How about renaming it from polygons to something else?
      • Just an idea: This is only for topology diagnostics purposes, right? Maybe something to emphasize this aspect better, which'd also help avoid confusions with the other polygons? e.g. grid.plot.shade_faces() , etc?
  • In addition to renaming, if still needed, maybe also consider either adding a bigger emphasis on the purpose of this plotting function into the docstrings or displaying a warning message when this is called
  • Values in the color bars in both cases of fill argument for this function do not make much sense, e.g. face indices being float, or those float values around 1 when it is polygons.

@philipc2 philipc2 marked this pull request as draft May 3, 2025 03:33
@philipc2 philipc2 changed the title Support ccrs.Geodetic source projection, add Polygon plot to Grid DRAFT: Support ccrs.Geodetic source projection, add Polygon plot to Grid May 3, 2025
@philipc2
Copy link
Copy Markdown
Member Author

Closing this, as the ccrs.GeoDetic() projection is already supported. Will reopen an issue and PR with changes to documentation and/or usage if needed in the future.

@philipc2 philipc2 closed this Jun 23, 2025
@erogluorhan erogluorhan deleted the geodesic branch September 26, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HEALPix (maybe even others) connectivities and split visualizations have issues around the pole

3 participants