From e22d8ffb06968f44a59eea3967bbd8aea8ba5cb3 Mon Sep 17 00:00:00 2001 From: Jeroen Dries Date: Thu, 9 Feb 2023 18:49:42 +0100 Subject: [PATCH] unit test fixes https://github.com/Open-EO/openeo-geotrellis-extensions/issues/69 --- openeo_driver/ProcessGraphDeserializer.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openeo_driver/ProcessGraphDeserializer.py b/openeo_driver/ProcessGraphDeserializer.py index 9f32b91e..dd4d4d69 100644 --- a/openeo_driver/ProcessGraphDeserializer.py +++ b/openeo_driver/ProcessGraphDeserializer.py @@ -46,7 +46,7 @@ from openeo_driver.dry_run import DryRunDataTracer, SourceConstraint from openeo_driver.errors import ProcessParameterRequiredException, ProcessParameterInvalidException, \ FeatureUnsupportedException, OpenEOApiException, ProcessGraphInvalidException, FileTypeInvalidException, \ - ProcessUnsupportedException + ProcessUnsupportedException, CollectionNotFoundException from openeo_driver.processes import ProcessRegistry, ProcessSpec, DEFAULT_NAMESPACE from openeo_driver.save_result import JSONResult, SaveResult, AggregatePolygonResult, NullResult, \ to_save_result, AggregatePolygonSpatialResult, MlModelResult @@ -460,10 +460,14 @@ def extract_arg_enum(args: dict, name: str, enum_values: Union[set, list, tuple] return value def _align_extent(extent,collection_id,env): - metadata = env.backend_implementation.catalog.get_collection_metadata(collection_id) + metadata = None + try: + metadata = env.backend_implementation.catalog.get_collection_metadata(collection_id) + except CollectionNotFoundException: + pass - if(not metadata.get('_vito',{}).get("data_source",{}).get("realign",False)): - return + if(metadata == None or not metadata.get('_vito',{}).get("data_source",{}).get("realign",False)): + return extent x = metadata.get('cube:dimensions', {}).get('x', {}) y = metadata.get('cube:dimensions', {}).get('y', {}) if ("step" in x @@ -494,6 +498,8 @@ def align(v, dimension, rounding): _log.info(f"Realigned input extent {extent} into {new_extent}") return new_extent + else: + return extent def _extract_load_parameters(env: EvalEnv, source_id: tuple) -> LoadParameters: """