From 103fd7ddd544f50862b828d85adcfa36addd499e Mon Sep 17 00:00:00 2001 From: dabhicusp Date: Fri, 16 Feb 2024 06:08:49 +0000 Subject: [PATCH 1/5] Geometry bounds are updated with the projection. --- xee/ext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xee/ext.py b/xee/ext.py index 3929b54..028f2d8 100644 --- a/xee/ext.py +++ b/xee/ext.py @@ -279,9 +279,9 @@ def get_info(self) -> Dict[str, Any]: rpcs.append(('projection', self.projection)) if isinstance(self.geometry, ee.Geometry): - rpcs.append(('bounds', self.geometry.bounds())) + rpcs.append(('bounds', self.geometry.bounds(proj = self.projection))) else: - rpcs.append(('bounds', self.image_collection.first().geometry().bounds())) + rpcs.append(('bounds', self.image_collection.first().geometry().bounds(proj = self.projection))) # TODO(#29, #30): This RPC call takes the longest time to compute. This # requires a full scan of the images in the collection, which happens on the From 2ea35e55595253fc2d050a91e49748816a7c794f Mon Sep 17 00:00:00 2001 From: dabhicusp Date: Fri, 16 Feb 2024 06:26:42 +0000 Subject: [PATCH 2/5] lint error fixed. --- xee/ext.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xee/ext.py b/xee/ext.py index 028f2d8..b82163e 100644 --- a/xee/ext.py +++ b/xee/ext.py @@ -279,9 +279,12 @@ def get_info(self) -> Dict[str, Any]: rpcs.append(('projection', self.projection)) if isinstance(self.geometry, ee.Geometry): - rpcs.append(('bounds', self.geometry.bounds(proj = self.projection))) + rpcs.append(('bounds', self.geometry.bounds(proj=self.projection))) else: - rpcs.append(('bounds', self.image_collection.first().geometry().bounds(proj = self.projection))) + rpcs.append(( + 'bounds', + self.image_collection.first().geometry().bounds(proj=self.projection), + )) # TODO(#29, #30): This RPC call takes the longest time to compute. This # requires a full scan of the images in the collection, which happens on the From 7131655a4ee923b471db84a5dfb37b4c035312f8 Mon Sep 17 00:00:00 2001 From: dabhicusp Date: Fri, 16 Feb 2024 07:10:07 +0000 Subject: [PATCH 3/5] Added maxError as a 1 in the bounds for better. --- xee/ext.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xee/ext.py b/xee/ext.py index b82163e..87072d7 100644 --- a/xee/ext.py +++ b/xee/ext.py @@ -279,11 +279,13 @@ def get_info(self) -> Dict[str, Any]: rpcs.append(('projection', self.projection)) if isinstance(self.geometry, ee.Geometry): - rpcs.append(('bounds', self.geometry.bounds(proj=self.projection))) + rpcs.append(('bounds', self.geometry.bounds(1, proj=self.projection))) else: rpcs.append(( 'bounds', - self.image_collection.first().geometry().bounds(proj=self.projection), + self.image_collection.first() + .geometry() + .bounds(1, proj=self.projection), )) # TODO(#29, #30): This RPC call takes the longest time to compute. This From b8960a44d8f19a6e35b5504b0ab4346f424cd174 Mon Sep 17 00:00:00 2001 From: dabhicusp Date: Sun, 18 Feb 2024 16:19:03 +0000 Subject: [PATCH 4/5] Geometry bounds testcases are added. --- xee/ext_integration_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xee/ext_integration_test.py b/xee/ext_integration_test.py index 9d0b857..5f09e38 100644 --- a/xee/ext_integration_test.py +++ b/xee/ext_integration_test.py @@ -259,6 +259,32 @@ def __getitem__(self, params): self.assertEqual(getter.count, 3) + def test_geometry_bounds_with_and_without_projection(self): + image = ( + ee.ImageCollection('LANDSAT/LC08/C01/T1') + .filterDate('2017-01-01', '2017-01-03') + .first() + ) + point = ee.Geometry.Point(-40.2414893624401, 105.48790177216375) + distance = 311.5 + scale = 5000 + projection = ee.Projection('EPSG:4326', [1, 0, 0, 0, -1, 0]).atScale(scale) + image = image.reproject(projection) + + geometry = point.buffer(distance, proj=projection).bounds(proj=projection) + + data_store = xee.EarthEngineStore( + ee.ImageCollection(image), + projection=image.projection(), + geometry=geometry, + ) + data_store_bounds = data_store.get_info['bounds'] + + self.assertNotEqual(geometry.bounds().getInfo(), data_store_bounds) + self.assertEqual( + geometry.bounds(1, proj=projection).getInfo(), data_store_bounds + ) + class EEBackendEntrypointTest(absltest.TestCase): From 7beabcfe75fef22fa291159d066c5c7804431228 Mon Sep 17 00:00:00 2001 From: dabhicusp Date: Thu, 28 Mar 2024 06:41:05 +0000 Subject: [PATCH 5/5] lint error fixed. --- xee/ext.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/xee/ext.py b/xee/ext.py index 8880418..c54b1cc 100644 --- a/xee/ext.py +++ b/xee/ext.py @@ -280,12 +280,14 @@ def get_info(self) -> Dict[str, Any]: if isinstance(self.geometry, ee.Geometry): rpcs.append(('bounds', self.geometry.bounds(1, proj=self.projection))) else: - rpcs.append(( - 'bounds', - self.image_collection.first() - .geometry() - .bounds(1, proj=self.projection), - )) + rpcs.append( + ( + 'bounds', + self.image_collection.first() + .geometry() + .bounds(1, proj=self.projection), + ) + ) # TODO(#29, #30): This RPC call takes the longest time to compute. This # requires a full scan of the images in the collection, which happens on the @@ -298,14 +300,16 @@ def get_info(self) -> Dict[str, Any]: # client-side. Ideally, this would live behind a xarray-backend-specific # feature flag, since it's not guaranteed that data is this consistent. columns = ['system:id', self.primary_dim_property] - rpcs.append(( - 'properties', + rpcs.append( ( - self.image_collection.reduceColumns( - ee.Reducer.toList().repeat(len(columns)), columns - ).get('list') - ), - )) + 'properties', + ( + self.image_collection.reduceColumns( + ee.Reducer.toList().repeat(len(columns)), columns + ).get('list') + ), + ) + ) info = ee.List([rpc for _, rpc in rpcs]).getInfo()