66"""
77# Note: this module was initially developed under the ``openeo-udf`` project (https://github.com/Open-EO/openeo-udf)
88
9+ from deprecated import deprecated
910import xarray
1011from pandas import Series
1112
@@ -33,11 +34,13 @@ def apply_timeseries(series: Series, context: dict) -> Series:
3334 # TODO: do we need geospatial coordinates for the series?
3435 return series
3536
36-
37+ @ deprecated
3738def apply_datacube (cube : XarrayDataCube , context : dict ) -> XarrayDataCube :
3839 """
3940 Map a :py:class:`XarrayDataCube` to another :py:class:`XarrayDataCube`.
4041
42+ Deprecated: use the signature with xarray.DataArray instead.
43+
4144 Depending on the context in which this function is used, the :py:class:`XarrayDataCube` dimensions
4245 have to be retained or can be chained.
4346 For instance, in the context of a reducing operation along a dimension,
@@ -50,6 +53,22 @@ def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
5053 """
5154 return cube
5255
56+ def apply_datacube (cube : xarray .DataArray , context : dict ) -> xarray .DataArray :
57+ """
58+ Map a :py:class:`xarray.DataArray` to another :py:class:`xarray.DataArray`.
59+
60+ Depending on the context in which this function is used, the :py:class:`xarray.DataArray` dimensions
61+ have to be retained or can be chained.
62+ For instance, in the context of a reducing operation along a dimension,
63+ that dimension will have to be reduced to a single value.
64+ In the context of a 1 to 1 mapping operation, all dimensions have to be retained.
65+
66+ :param cube: input data array
67+ :param context: A dictionary containing user context.
68+ :return: output data array
69+ """
70+ return cube
71+
5372
5473def apply_udf_data (data : UdfData ):
5574 """
0 commit comments