Skip to content

Commit

Permalink
Issue #386: DataCube.aggregate_spatial should return VectorCube
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Apr 6, 2023
1 parent 90c0505 commit 9b87888
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions openeo/rest/datacube.py
Expand Up @@ -1699,51 +1699,64 @@ def raster_to_vector(self) -> VectorCube:

####VIEW methods #######

@deprecated("Use :py:meth:`aggregate_spatial` with reducer ``'mean'``.", version="0.10.0")
def polygonal_mean_timeseries(self, polygon: Union[Polygon, MultiPolygon, str]) -> 'DataCube':
@deprecated(
"Use :py:meth:`aggregate_spatial` with reducer ``'mean'``.", version="0.10.0"
)
def polygonal_mean_timeseries(
self, polygon: Union[Polygon, MultiPolygon, str]
) -> VectorCube:
"""
Extract a mean time series for the given (multi)polygon. Its points are
expected to be in the EPSG:4326 coordinate
reference system.
:param polygon: The (multi)polygon; or a file path or HTTP URL to a GeoJSON file or shape file
:return: DataCube
"""
return self.aggregate_spatial(geometries=polygon, reducer="mean")

@deprecated("Use :py:meth:`aggregate_spatial` with reducer ``'histogram'``.", version="0.10.0")
def polygonal_histogram_timeseries(self, polygon: Union[Polygon, MultiPolygon, str]) -> 'DataCube':
@deprecated(
"Use :py:meth:`aggregate_spatial` with reducer ``'histogram'``.",
version="0.10.0",
)
def polygonal_histogram_timeseries(
self, polygon: Union[Polygon, MultiPolygon, str]
) -> VectorCube:
"""
Extract a histogram time series for the given (multi)polygon. Its points are
expected to be in the EPSG:4326 coordinate
reference system.
:param polygon: The (multi)polygon; or a file path or HTTP URL to a GeoJSON file or shape file
:return: DataCube
"""
return self.aggregate_spatial(geometries=polygon, reducer="histogram")

@deprecated("Use :py:meth:`aggregate_spatial` with reducer ``'median'``.", version="0.10.0")
def polygonal_median_timeseries(self, polygon: Union[Polygon, MultiPolygon, str]) -> 'DataCube':
@deprecated(
"Use :py:meth:`aggregate_spatial` with reducer ``'median'``.", version="0.10.0"
)
def polygonal_median_timeseries(
self, polygon: Union[Polygon, MultiPolygon, str]
) -> VectorCube:
"""
Extract a median time series for the given (multi)polygon. Its points are
expected to be in the EPSG:4326 coordinate
reference system.
:param polygon: The (multi)polygon; or a file path or HTTP URL to a GeoJSON file or shape file
:return: DataCube
"""
return self.aggregate_spatial(geometries=polygon, reducer="median")

@deprecated("Use :py:meth:`aggregate_spatial` with reducer ``'sd'``.", version="0.10.0")
def polygonal_standarddeviation_timeseries(self, polygon: Union[Polygon, MultiPolygon, str]) -> 'DataCube':
@deprecated(
"Use :py:meth:`aggregate_spatial` with reducer ``'sd'``.", version="0.10.0"
)
def polygonal_standarddeviation_timeseries(
self, polygon: Union[Polygon, MultiPolygon, str]
) -> VectorCube:
"""
Extract a time series of standard deviations for the given (multi)polygon. Its points are
expected to be in the EPSG:4326 coordinate
reference system.
:param polygon: The (multi)polygon; or a file path or HTTP URL to a GeoJSON file or shape file
:return: DataCube
"""
return self.aggregate_spatial(geometries=polygon, reducer="sd")

Expand Down

0 comments on commit 9b87888

Please sign in to comment.