@@ -216,6 +216,7 @@ class DriverVectorCube:
216216 These components are "joined" on the GeoPandas dataframe's index and DataArray first dimension
217217 """
218218 DIM_GEOMETRIES = "geometries"
219+ DIM_BANDS = "bands"
219220 FLATTEN_PREFIX = "vc"
220221
221222 def __init__ (
@@ -519,7 +520,7 @@ def apply_dimension(
519520
520521 if single_run_udf :
521522 # 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 :
523524 log .warning (
524525 f"Using experimental feature: DriverVectorCube.apply_dimension along dim { dimension } and empty cube"
525526 )
@@ -535,14 +536,18 @@ def apply_dimension(
535536 result_data = env .backend_implementation .processing .run_udf (udf = single_run_udf .udf , data = udf_data )
536537 log .info (f"[run_udf] UDF resulted in { result_data !r} " )
537538
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+ )
546551
547552
548553class DriverMlModel :
0 commit comments