@@ -216,6 +216,7 @@ class DriverVectorCube:
216
216
These components are "joined" on the GeoPandas dataframe's index and DataArray first dimension
217
217
"""
218
218
DIM_GEOMETRIES = "geometries"
219
+ DIM_BANDS = "bands"
219
220
FLATTEN_PREFIX = "vc"
220
221
221
222
def __init__ (
@@ -519,7 +520,7 @@ def apply_dimension(
519
520
520
521
if single_run_udf :
521
522
# Process with single "run_udf" node
522
- if self . _cube is None and dimension == self .DIM_GEOMETRIES and target_dimension is None :
523
+ if dimension == self .DIM_BANDS and target_dimension is None :
523
524
log .warning (
524
525
f"Using experimental feature: DriverVectorCube.apply_dimension along dim { dimension } and empty cube"
525
526
)
@@ -535,14 +536,18 @@ def apply_dimension(
535
536
result_data = env .backend_implementation .processing .run_udf (udf = single_run_udf .udf , data = udf_data )
536
537
log .info (f"[run_udf] UDF resulted in { result_data !r} " )
537
538
538
- if isinstance (result_data , openeo .udf .UdfData ):
539
- result_features = result_data .get_feature_collection_list ()
540
- if result_features and len (result_features ) == 1 :
541
- return DriverVectorCube (geometries = result_features [0 ].data )
542
- raise ValueError (f"Could not handle UDF result: { result_data } " )
543
-
544
- raise FeatureUnsupportedException ()
545
-
539
+ if not isinstance (result_data , openeo .udf .UdfData ):
540
+ raise ValueError (f"UDF should return UdfData, but got { type (result_data )} " )
541
+ result_features = result_data .get_feature_collection_list ()
542
+ if not (result_features and len (result_features ) == 1 ):
543
+ raise ValueError (
544
+ f"UDF should return single feature collection but got { result_features and len (result_features )} "
545
+ )
546
+ return DriverVectorCube (geometries = result_features [0 ].data )
547
+
548
+ raise FeatureUnsupportedException (
549
+ message = f"DriverVectorCube.apply_dimension with { dimension = } and { bool (single_run_udf )= } "
550
+ )
546
551
547
552
548
553
class DriverMlModel :
0 commit comments