diff --git a/openeo_driver/datacube.py b/openeo_driver/datacube.py index 629e3447..bdec1d90 100644 --- a/openeo_driver/datacube.py +++ b/openeo_driver/datacube.py @@ -224,6 +224,7 @@ class DriverVectorCube: DIM_PROPERTIES = "properties" COLUMN_SELECTION_ALL = "all" COLUMN_SELECTION_NUMERICAL = "numerical" + VECTOR_CUBE_DUMMY = "vector_cube_dummy" def __init__( self, @@ -324,7 +325,7 @@ def from_geodataframe( data=numpy.full(shape=[data.shape[0]], fill_value=numpy.nan), dims=[cls.DIM_GEOMETRIES], coords={cls.DIM_GEOMETRIES: data.geometry.index.to_list()}, - attrs={"vector_cube_dummy": True}, + attrs={cls.VECTOR_CUBE_DUMMY: True}, ) return cls(geometries=data, cube=cube) @@ -418,7 +419,7 @@ def _as_geopandas_df( """Join geometries and cube as a geopandas dataframe""" # TODO: avoid copy? df = self._geometries.copy(deep=True) - if self._cube is not None: + if self._cube is not None and not self._cube.attrs.get(self.VECTOR_CUBE_DUMMY): assert self._cube.dims[0] == self.DIM_GEOMETRIES # TODO: better way to combine cube with geometries # Flatten multiple (non-geometry) dimensions from cube to new properties in geopandas dataframe diff --git a/tests/test_vectorcube.py b/tests/test_vectorcube.py index 708ad874..7eb33643 100644 --- a/tests/test_vectorcube.py +++ b/tests/test_vectorcube.py @@ -154,7 +154,7 @@ def test_to_internal_json_defaults(self, gdf): "geometries": {"attrs": {}, "data": [0, 1], "dims": ("geometries",)}, }, "data": [IsNan(), IsNan()], - "attrs": {}, + "attrs": {"vector_cube_dummy": True}, }, ), (