Open-EO / openeo-gfmap

Generic framework for EO mapping applications building on openEO
Apache License 2.0
6 stars 0 forks source link

Implement a t_to_bands function #109

Open VincentVerelst opened 4 months ago

VincentVerelst commented 4 months ago

Typically, for feature extractions in parquet/csv/... format the time dimension is removed and timesteps are mapped to the band dimension. Currently, users have to take care of this manually, with a script like this:

from openeo.processes import ProcessBuilder, array_create

def time_to_bands(input_timeseries:ProcessBuilder):
    tsteps = array_create(data=[input_timeseries.array_element(i) for i in range(3)])
    return tsteps
cube = cube.apply_dimension(dimension='t',
                            target_dimension='bands',
                            process=time_to_bands)

tstep_labels = [f'S2-L2A-EVI_t{i}' for i in range(3)]
cube = cube.rename_labels('bands', tstep_labels)

Given that his happens commonly, we could implement a function that performs this operation in GFMap, so that the user only needs to provide the amount of timesteps (hardcoded as 3 in the example above).