Skip to content

Commit

Permalink
ext: Reformat to fix lint errors.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 669437728
  • Loading branch information
naschmitz authored and Xee authors committed Aug 30, 2024
1 parent 18ef42b commit 0bc3c2f
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions xee/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,12 @@ 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
Expand All @@ -313,16 +311,14 @@ 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(
rpcs.append((
'properties',
(
'properties',
(
self.image_collection.reduceColumns(
ee.Reducer.toList().repeat(len(columns)), columns
).get('list')
),
)
)
self.image_collection.reduceColumns(
ee.Reducer.toList().repeat(len(columns)), columns
).get('list')
),
))

info = ee.List([rpc for _, rpc in rpcs]).getInfo()

Expand Down Expand Up @@ -1033,6 +1029,7 @@ def open_dataset(
getitem_kwargs: Optional[Dict[str, int]] = None,
fast_time_slicing: bool = False,
) -> xarray.Dataset: # type: ignore
# fmt: off
"""Open an Earth Engine ImageCollection as an Xarray Dataset.
Args:
Expand Down Expand Up @@ -1085,9 +1082,9 @@ def open_dataset(
system is set by the the `crs` and `scale` arguments.
geometry (optional): Specify an `ee.Geometry` to define the regional
bounds when opening the data or a bbox specifying [x_min, y_min, x_max,
y_max] in EPSG:4326. When not set, the bounds are defined by
the CRS's 'area_of_use` boundaries. If those aren't present, the bounds
are derived from the geometry of the first image of the collection.
y_max] in EPSG:4326. When not set, the bounds are defined by the CRS's
'area_of_use` boundaries. If those aren't present, the bounds are
derived from the geometry of the first image of the collection.
primary_dim_name (optional): Override the name of the primary dimension of
the output Dataset. By default, the name is 'time'.
primary_dim_property (optional): Override the `ee.Image` property for
Expand All @@ -1114,10 +1111,11 @@ def open_dataset(
makes slicing an ImageCollection across time faster. This optimization
loads EE images in a slice by ID, so any modifications to images in a
computed ImageCollection will not be reflected.
Returns:
An xarray.Dataset that streams in remote data from Earth Engine.
"""

# fmt: on
user_agent = f'Xee/{__version__}'
if ee.data.getUserAgent() != user_agent:
ee.data.setUserAgent(user_agent)
Expand Down

0 comments on commit 0bc3c2f

Please sign in to comment.