Skip to content
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

Error when passing in ee.Projection() as parameter for open_dataset() #158

Open
mhutchinson-woolpert opened this issue Apr 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mhutchinson-woolpert
Copy link

Good afternoon,

I've tried to reproduce one of the examples from the website, but rather using a different dataset (Sentinel-2). The goal was to open the dataset using the same projection as the satellite image. So far these have been tried:

  • Using an ImageCollection constructed from a specific image EE path
  • Using an ImageCollection created via filtering
  • Using a manual ee.Geometry.Rectangle
  • Using the geometry in EPSG 4326
  • Using the geometry in EPSG 32605 (same as the image)
# ic = ee.ImageCollection(ee.Image('COPERNICUS/S2_SR_HARMONIZED/20230728T221531_20230728T221534_T05WPU'))
ic = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED').filter(ee.Filter.eq('PRODUCT_ID', 'S2A_MSIL2A_20230728T221531_N0509_R115_T05WPU_20230729T014233') )

rect = ee.Geometry.Rectangle(-148.46380797863654, 70.30003598701754, -148.39544465908497, 70.32308553183186)
# rect_projected = rect.transform(ic.first().select(0).projection(), 1)

xr_ds = xarray.open_dataset(ic, 
                            engine='ee',
                            projection=ic.first().select('B4').projection(),
                            geometry=rect)

Version 0.0.12 of Xee is being used.
Note that other data has been loaded successfully using Xee (different parameters, different datasets etc.), so it's not an issue related to installation or dependencies.

The error can be seen below:

image

@naschmitz
Copy link
Collaborator

I took a quick look. Xee doesn't do a great job exporting data in this image's native projection. Earth Engine batch export tools are the way to go for something like that.

I think you've hit a bug. We calculate the specified region's bounds in EPSG:32605 projection and it ends up being a complex multi-polygon (which Xee isn't equipped to deal with). You could consider using a different projection for the output (EPSG:4326 for example).

@naschmitz naschmitz added the bug Something isn't working label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants