Skip to content

expanded methods for plot.rasterize? #918

Closed

Description

@wwieder

Proposed new feature or change:

Hello,

I'm trying to make a polar view of CESM output on the ne30 grid (nominal 1 degree resolution). I found this MPAS example helpful. Thank you!

With this relatively coarse resolution, I can only get reasonable looking plots by reducing pixel_ratio so the points look larger. It also seems this could be addressed if method = trimesh or polygon were enabled, but it seems like this is currently not supported? Is this something that's coming? or is there another way to customize plots besides using the rasterize function?

My code is below if you're on derecho and interested in replicating

# Read in data
mesh = '/glade/campaign/cesm/cesmdata/inputdata/share/meshes/ne30pg3_ESMFmesh_cdf5_c20211018.nc'
fin = '/glade/derecho/scratch/wwieder/ADF/b.e23_alpha17f.BLT1850.ne30_t232.093/climo/b.e23_alpha17f.BLT1850.ne30_t232.093_TSA_climo.nc'
ds = ux.open_dataset(mesh, fin)

# Set up some features and the projection
def features(projection):
    return gf.coastline(projection=projection, linewidth=1, scale="50m") * gf.states(
        projection=projection, linewidth=1, scale="50m"
    )

projection = ccrs.Orthographic(central_latitude=90)

# Make the plot
ds.TSA.mean('time').plot.rasterize(
    method="point",
    projection=projection,
    cmap="RdBu_r",
    backend="matplotlib",
    pixel_ratio=0.3,
    fig_size=250,
) * features(projection)
 

Activity

  1. added
    new feature
    on Aug 28, 2024
  2. philipc2 commented on Aug 28, 2024

    @philipc2
    Member

    Hi @wwieder

    We haven't added projection support for polygons directly with our plotting API yet. I'd suggest using our Matplotlib routines for now until we add direct support.

    https://uxarray--917.org.readthedocs.build/en/917/user-guide/mpl.html#geographic-projections-elements

    Let me know if this works out for you.

  3. moved this from 📚 Backlog to ✅ Done in UXarray Developmenton Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new feature

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions