Time average on data from Sentinel-5

Hi everybody,

I am new to the openEO platform and and I’m trying to handle the data from Sentinel-5.

In particular (see attached code), I’m getting the data in a specific time window ([“2022-01-01T00:00:00Z”, “2022-01-12T00:00:00Z”]) for a specific gas (CO), and I’d like to perform a time average of CO values every N days (here I put 3 as an example).
To do so, I’ve selected the first 3 days (datacube_CO_1 = datacube_CO.filter_temporal(“2022-01-01”, “2022-01-04”)) and I was trying to (time) average those values, pixel by pixel, using the commands:

datacube_CO_1_mean = datacube_CO.process(“mean”, data=datacube_CO_1)
datacube_CO_1_mean.execute()

But that part of the code doesn’t seem to work.

Also, my aim would be to save the results as a GeoTiff image, and also as a CSV file, containing, for each pixel, the averaged value (over the time window) of each pixel.

So my issues regard the portion of the code that should perform the time average and the commands for saving the results (as I am not sure if they are correct).

Thanks everybody in advance for any help

import openeo
from openeo.processes import process
connection = openeo.connect("openeo.dataspace.copernicus.eu")
connection.authenticate_oidc_device()

datacube_CO = connection.load_collection("SENTINEL_5P_L2",
                               spatial_extent={"west": 9.077297902737973, "east": 9.305281982978242, "south": 45.40604831451452, "north": 45.53233801222407},
                               temporal_extent=["2022-01-01T00:00:00Z", "2022-01-12T00:00:00Z"],
                               bands=["CO"])

datacube_CO_1 = datacube_CO.filter_temporal("2022-01-01", "2022-01-04")

datacube_CO_1_mean = datacube_CO.process("mean", data=datacube_CO_1)
datacube_CO_1_mean.execute()

job=datacube_CO_1_mean.execute_batch(out_format="GTiff",title="C")
job.get_results().download_files()

Hi,
the process you are looking for is called ‘aggregate_temporal’ or ‘aggregate_temporal_period’. You can find an example in this notebook:

Note that we also offer Sentinel-5p data that has already been composited:
TERRASCOPE_S5P_L3_CO_TM_V1
or these daily CO values, that are likely to be cheaper to access:
TERRASCOPE_S5P_L3_CO_TD_V1

We do not yet support storing rasters as csv, but if you use aggregate_polygon, you can provide a set of points for which you want to extract values into a csv, and it’s of course possible to specify a dense set of points that corresponds to pixels.

best regards,
Jeroen