Replies: 2 comments
-
Thanks Tyler! I'm happy with this breaking change as well. I'm especially persuaded when you compare Xee's parameters to the standards established by other libraries. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is great, Tyler, thanks! I'm in support of it and understand that it could break some uses. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
The core of Xee is providing an entrypoint so that Xarray can open datasets hosted on (or computed by) Earth Engine. The main user-facing method for accomplishing this is the open_dataset method, which has several parameters for describing the spatial characteristics of the data to be retrieved from Earth Engine.
These parameters are all optional and may provide conflicting information, and the intended behavior when conflicting information is provided is not clearly described. This behavior and documentation have resulted in numerous Xee issues related to projection information, both open (examples: #215, #208, #207, #198, #171, #158) and closed (examples: #193, #192, #176, #173, #139, #118, #96).
What information does Xee need to provide to Earth Engine?
Xee accesses GEE using a projects.image.computePixels call, passing a PixelGrid object to describe how the image should be reprojected and clipped. The PixelGrid is defined with three parameters:
{"scaleX": number, "shearX": number, "translateX": number, "shearY": number, "scaleY": number, "translateY": number}
which defines the offset from the projection origin and the pixel size.{"width": integer, "height": integer}
which define the size of the raster image that GEE returns.This abstraction model matches up with the abstractions used by other open source Python libraries that work with Xarray including:
crs
,affine
,shape
)dst_crs
,transform
,shape
)Proposed changes to Xee
My proposal is to:
rewrite Xee's
open_dataset()
method and EarthEngineStore class to require the three parameters needed by Earth Engine:crs
,affine_transform
, andshape
. This will simplify the logic of Xee.Add helper functions that can be used to calculate the three core parameters. Requiring users to explicitly call these helper functions should code clearer to understand and debug.
Here are some helper functions that could be useful:
geometry
,crs
, andtransform
, return the 3 parameters with the affine_transform'stranslateX
andtranslateY
parameters updated to match the geometry.geometry
,crs
, anddimensions
, return the 3 parameters with the affine_transform'sscaleX
andscaleY
parameters updated to match the geometry.crs
string andaffine_transform
matrix based on the first image in the image collection.These changes would potentially be breaking for some users. But given Xee's handling of projections other than
crs='EPSG:4326'
is largely broken (#207), there should be limited impact on users. If implemented, these changes should result in a new MINOR version number.Beta Was this translation helpful? Give feedback.
All reactions