diff --git a/openeo_driver/ProcessGraphDeserializer.py b/openeo_driver/ProcessGraphDeserializer.py index 59ccb256..28b9e2ae 100644 --- a/openeo_driver/ProcessGraphDeserializer.py +++ b/openeo_driver/ProcessGraphDeserializer.py @@ -15,6 +15,7 @@ from openeo.capabilities import ComparableVersion from openeo.metadata import MetadataException from openeo_driver.backend import get_backend_implementation, UserDefinedProcessMetadata +from openeo_driver.datacube import DriverDataCube from openeo_driver.delayed_vector import DelayedVector from openeo_driver.errors import ProcessParameterRequiredException, \ ProcessParameterInvalidException diff --git a/openeo_driver/backend.py b/openeo_driver/backend.py index 615aaeaf..7aabafaa 100644 --- a/openeo_driver/backend.py +++ b/openeo_driver/backend.py @@ -16,9 +16,9 @@ from pathlib import Path from typing import List, Union, NamedTuple, Dict -from openeo import ImageCollection from openeo.internal.process_graph_visitor import ProcessGraphVisitor from openeo.util import rfc3339 +from openeo_driver.datacube import DriverDataCube from openeo_driver.errors import CollectionNotFoundException, ServiceUnsupportedException from openeo_driver.utils import read_json, EvalEnv @@ -154,7 +154,7 @@ def get_collection_metadata(self, collection_id: str) -> dict: """ return self._get(collection_id=collection_id) - def load_collection(self, collection_id: str, viewing_parameters: dict) -> ImageCollection: + def load_collection(self, collection_id: str, viewing_parameters: dict) -> DriverDataCube: raise NotImplementedError @@ -379,7 +379,7 @@ def file_formats(self) -> dict: """ return {"input": {}, "output": {}} - def load_disk_data(self, format: str, glob_pattern: str, options: dict, viewing_parameters: dict) -> object: + def load_disk_data(self, format: str, glob_pattern: str, options: dict, viewing_parameters: dict) -> DriverDataCube: # TODO: move this to catalog "microservice" raise NotImplementedError diff --git a/openeo_driver/datacube.py b/openeo_driver/datacube.py new file mode 100644 index 00000000..6abc6509 --- /dev/null +++ b/openeo_driver/datacube.py @@ -0,0 +1,8 @@ +from openeo.metadata import CollectionMetadata + + +class DriverDataCube: + """Base class for "driver" side data cubes.""" + + def __init__(self, metadata: CollectionMetadata = None): + self.metadata = metadata if isinstance(metadata, CollectionMetadata) else CollectionMetadata(metadata or {})