Skip to content

Conversation

@rajeeja
Copy link
Contributor

@rajeeja rajeeja commented Dec 8, 2025

Thanks to @brianpm for reporting #1393. This PR fixes #1393 that axes extent must be set before calling to_raster, and fixes the flat-output issue by auto-detecting default axes limits and setting a reasonable extent from grid lon/lat bounds when needed (with a warning). It also adds support for data with extra length-1 dimensions by allowing singleton dims and squeezing to (n_face,) before rasterization.

@rajeeja rajeeja requested a review from erogluorhan December 8, 2025 18:34
@rajeeja
Copy link
Contributor Author

rajeeja commented Dec 12, 2025

@erogluorhan We can auto-set bounds just for the rasterization (or via an extent kwarg) so users still get a meaningful image without having to call set_global(). What do you think?

xarray’s .plot() sets xlim/ylim from coord..

@erogluorhan
Copy link
Member

@erogluorhan We can auto-set bounds just for the rasterization (or via an extent kwarg) so users still get a meaningful image without having to call set_global(). What do you think?

xarray’s .plot() sets xlim/ylim from coord..

Thanks for this, Rajeev! It makes complete sense to me to provide some auto-set here. So, applying xarray's way here would work in a way to set axes extent based on the min-max x and y that is in the grid rather than setting to global, right?, So, it will work for our rasterization, correct?

Also, since this "axes extent" thing was the actual reason behind #1393 , could you modify the description of this PR to reflect that (the current description can still reflect what additional features we are implementing about multi dims, but it is not the reason behind the reported issue)

@rajeeja rajeeja force-pushed the rajeeja/fix_issue1393 branch from 64602f1 to e8c5198 Compare December 17, 2025 19:15
@erogluorhan erogluorhan linked an issue Dec 17, 2025 that may be closed by this pull request
@rajeeja rajeeja changed the title Allow to_raster to handle singleton extra dims and fix flat output to_raster: handle unset extent; accept singleton extra dims Dec 17, 2025
Copy link
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 looking great and almost there; please see my comments below.

@erogluorhan erogluorhan self-requested a review December 19, 2025 19:26
Copy link
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.

Looks good to me! Please fix the link-check and merge

@rajeeja rajeeja merged commit b688ed5 into main Dec 19, 2025
13 checks passed
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.

to_raster producing all the same value

3 participants