-
Notifications
You must be signed in to change notification settings - Fork 40
Major Refactor - Explicit Pixel Grids & CF Dimensions - v0.1.0 #275
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
base: main
Are you sure you want to change the base?
Conversation
PiperOrigin-RevId: 712905652
PiperOrigin-RevId: 712996660
Ensure shape_2d is a tuple
…ion guide for v0.1.0
|
I see that there are conflicts, I'll work on resolving these. |
schwehr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only blocker: Can we bring back python 3.10?
Yes, I've added 3.10 back in. |
|
@schwehr and @naschmitz I've addressed all of the comments. Can you please take another look. |
Major Refactor - Explicit Pixel Grids & CF Dimensions
This PR represents a major refactor to the core of Xee's backend. It is merges the
simplify_pixel_grid_paramsbranch into main. Thesimplify_pixel_grid_paramshas months of changes - the significant changes to Xee API have been through review, doc changes and CI/CD Python version changes were directly pushed. The most significant changes are adopting explicit pixel grid parameters for opening datasets (see discussion) and updating the default dimension ordering to align with community standards (see discussion). After this PR is merged we should release v0.1.0 (from v0.0.x).xarray.open_datasetcalls when upgrading to this version. Please refer to the Migration Guide for detailed instructions.💥 Breaking Changes & Rationale
1. Explicit Pixel Grid Definition
The previous, heuristic-based grid definition arguments (
scale,geometry, andprojection) have been removed fromxr.open_dataset(..., engine='ee').open_datasetfunction now requires three explicit parameters to define the pixel grid:crs,crs_transform(a 6-tuple affine matrix), andshape_2d(width/height pixel count).2. CF-friendly Dimension Ordering
The default order of spatial dimensions in the resulting Xarray objects has been changed.
[time, y, x]instead of the old[time, x, y]..transpose()calls.✨ New Features & Helper Utilities
To support the new explicit grid workflow, a new
xee.helpersmodule has been added with key utilities:extract_grid_params(ee_obj): Automatically derives the requiredcrs,crs_transform, andshape_2dfrom an existingee.Imageoree.ImageCollection.fit_geometry(...): Computes the required grid parameters to cover a specificshapely.geometry(AOI) at either a fixed scale/resolution or a fixed shape/pixel count.math.floorandmath.ceilto precisely snap the grid to the bounding box extents, improving coordinate accuracy and preventing sub-pixel misalignment.📚 Documentation & Infrastructure Updates
docs/migration-guide-v0.1.0.md, has been created to assist users in updating their code to the new v0.1.0 API.concepts.md) and a User Guide (guide.md) were added to clarify the philosophy behind the pixel grid parameters and collect common workflows. The mainREADME.mdand examples have also been fully updated.3.10support was removed from all CI workflows, and the default publish environment was updated to Python3.11.📋 Checklist
PixelGridParamssignature and removed old implicit arguments.[time, y, x].extract_grid_params,fit_geometry, andset_scale.ext_integration_test.pyandext_integration_test.pypass.