In the following code the datacube called datacube_CR is created containing a band without name (label). When I call rename_labels to apply a label to the band I get a message:
ValueError: Invalid dimension ‘bands’. Should be one of [‘x’, ‘y’]
How can I label the band of the datacube created?
Thanks in advance, Best Regards,
Chris Kiranoudis, Professor NTUA
import openeo
from openeo.processes import array_element, normalized_difference
def CR_function(data):
VV = data[0]
VH = data[1]
result = VH / VV
return result
datacube = connection.load_collection(
"SENTINEL1_GRD",
spatial_extent={"west": 16.06, "south": 48.06, "east": 16.07, "north": 48.07},
temporal_extent=["2020-04-01", "2020-06-01"],
bands=["VV", "VH"]
)
datacube = datacube.reduce_dimension(dimension = "t", reducer = "mean")
datacube_CR = datacube.reduce_dimension(reducer = CR_function, dimension = "bands").rename_labels(dimension = "bands", target = ["CR"])
datacube = datacube.merge_cubes(datacube_CR)
datacube.download("s1-aggregate.tiff", format = "GTiff")