Skip to content

Commit

Permalink
Issue #134/#100 Drop 0.4.0-style ImageCollectionClient
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Mar 7, 2023
1 parent d16417c commit d7e8dbf
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 1,557 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

- Remove `ImageCollectionClient` (and related helpers),
a now unused leftover from the pre-1.0.0 versions of the openEO API
([#134](https://github.com/Open-EO/openeo-python-client/issues/134), [#100](https://github.com/Open-EO/openeo-python-client/issues/100))

### Fixed


Expand Down
2 changes: 1 addition & 1 deletion examples/mundialis_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def execute(
json.dumps(connection.describe_collection(image_collection), indent=2),
)
# TODO: change to con.load_collection()
cube = ImageCollectionClient.load_collection(session = connection, collection_id = image_collection, bands = all_bands)
cube = connection.load_collection(collection_id=image_collection, bands=all_bands)
cube = cube.filter_bbox( **bbox)
cube = cube.filter_temporal(extent=temporal_extent)

Expand Down
5 changes: 2 additions & 3 deletions examples/mundialis_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
spectral_extent = ["S2_8", "S2_4", "S2_2"]

# connect to mundialis backend
session = openeo.connect(backend_url).authenticate_basic()
connection = openeo.connect(backend_url).authenticate_basic()

# TODO change to s2_radiometry = session.load_collection( ...)
s2_radiometry = ImageCollectionClient.load_collection(
session=session,
s2_radiometry = connection.load_collection(
collection_id=collection_id,
temporal_extent=temporal_extent,
spatial_extent=spatial_extent
Expand Down
2 changes: 1 addition & 1 deletion examples/py3_process_wrapper-wcps_eurac.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def execute(
image_collection,
json.dumps(connection.describe_collection(image_collection), indent=2),
)
cube = ImageCollectionClient.load_collection(session = connection, collection_id = image_collection, bands = all_bands)
cube = connection.load_collection(collection_id=image_collection, bands=all_bands)
cube = cube.filter_bbox( **bbox)
cube = cube.filter_temporal(extent=temporal_extent)

Expand Down
2 changes: 1 addition & 1 deletion openeo/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.15.1a1"
__version__ = "0.16.0a1"
153 changes: 0 additions & 153 deletions openeo/internal/graphbuilder_040.py

This file was deleted.

23 changes: 9 additions & 14 deletions openeo/rest/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
OidcClientInfo, OidcAuthenticator, OidcRefreshTokenAuthenticator, OidcResourceOwnerPasswordAuthenticator, \
OidcDeviceAuthenticator, OidcProviderInfo, OidcException, DefaultOidcClientGrant, GrantsChecker
from openeo.rest.datacube import DataCube
from openeo.rest.imagecollectionclient import ImageCollectionClient
from openeo.rest.mlmodel import MlModel
from openeo.rest.userfile import UserFile
from openeo.rest.job import BatchJob, RESTJob
Expand Down Expand Up @@ -1001,18 +1000,13 @@ def load_collection(
.. versionadded:: 0.13.0
added the ``max_cloud_cover`` argument.
"""
if self._api_version.at_least("1.0.0"):
return DataCube.load_collection(
assert self._api_version.at_least("1.0.0")
return DataCube.load_collection(
collection_id=collection_id, connection=self,
spatial_extent=spatial_extent, temporal_extent=temporal_extent, bands=bands, properties=properties,
max_cloud_cover=max_cloud_cover,
fetch_metadata=fetch_metadata,
)
else:
return ImageCollectionClient.load_collection(
collection_id=collection_id, session=self,
spatial_extent=spatial_extent, temporal_extent=temporal_extent, bands=bands
)

imagecollection = legacy_alias(load_collection, name="imagecollection")

Expand Down Expand Up @@ -1245,7 +1239,9 @@ def service(self, service_id: str) -> Service:
"""
return Service(service_id, connection=self)

def load_disk_collection(self, format: str, glob_pattern: str, options: dict = {}) -> ImageCollectionClient:
def load_disk_collection(
self, format: str, glob_pattern: str, options: Optional[dict] = None
) -> DataCube:
"""
Loads image data from disk as an ImageCollection.
Expand All @@ -1254,11 +1250,10 @@ def load_disk_collection(self, format: str, glob_pattern: str, options: dict = {
:param options: options specific to the file format
:return: the data as an ImageCollection
"""

if self._api_version.at_least("1.0.0"):
return DataCube.load_disk_collection(self, format, glob_pattern, **options)
else:
return ImageCollectionClient.load_disk_collection(self, format, glob_pattern, **options)
assert self._api_version.at_least("1.0.0")
return DataCube.load_disk_collection(
self, format, glob_pattern, **(options or {})
)

def as_curl(self, data: Union[dict, DataCube], path="/result", method="POST") -> str:
"""
Expand Down
Loading

0 comments on commit d7e8dbf

Please sign in to comment.