Xcube CLI for Sentinel-3 OLCI

Dear EDC support,

I would like to use the CLI version of the python library xcube to generate a datacube based on Sentinel-3 OLCI data locally stored, exploiting the command xcube gen. I tried running some tests following the written documentation and examples found, however, I wasn’t able to create the cube.
I also tried installing the plugin xcube-gen-bc and setting the INPUT-PROCESSOR accordingly without success.

The settings used for the first test are:

  • 3 Sentinel-3 OLCI Level 2 products

  • output_size: [500, 500]

  • output_region: [9.4603, 45.05, 11.00, 46.00]

  • desired output in NetCDF format

I also attach the command tried

xcube gen -P snap-olci-highroc-l2 -S 500,500 -R 9.4603, 45.05, 11.00, 46.00 --format netcdf4 -o '/application/pi/s3_datacube.nc' /data/pilot_s3/xcube_S3/s3_data/L2/**/*.nc

and the error obtained

Internal error: illegal L2 input: missing start/stop time

I’ve got the same result passing the parameters inside a .yml configuration file:

xcube gen -c /data/pilot_query_s3/config_file_s3_test.yml /data/pilot_s3/xcube_S3/s3_data/L2/**/*.nc

What I would like to know is:

  • Am I doing something wrong?
  • Is there a way to use xcube gen together with the OLCI dataset?
  • If there is a solution, does the solution support also OLCI Level 1 datasets?

Thank you in advance,

Hi Pietro,

The xcube xcube-gen-bc plugin has been developed to process special NetCDF Level-2 files are generated at Brockmann Consult (=bc) using the SNAP software. That’s why you did not succeed, sorry for this. To process S3A_OL_2_LFR data you’ll need to write a special input processor for the “xcube gen” tool

However, if you have a Sentinel Hub account, you can use the xcube-sh plugin instead. This will allow you to open Sentinel-1, 2, and 3 data cubes directly from Sentinel Hub. You can then save the cubes to Zarr or NetCDF.

Have a look into dedicated notebooks in xcube and xcube-sh:

Note the xcube-sh plugin must be installed with xcube in both cases. In your Python env:

$ conda install -c conda-forge xcube xcube-sh

Hope this helps

Dear Norman,

Thank you for your quick and clear reply.

We will consider the option of using the xcube-sh library.

Regarding the possibility to prepare the input with SNAP, would you give me some hints on how how to pre-process the data in order to get them in a suitable format? (e.g. if you used some operators or graph)
If the input data is properly pre-processed, how it is then possible to write an ad-hoc input processor?

Thank you again,

Please have a look into existing plugins that provide specific input processors, e.g. dcs4cop/xcube-gen-bc: An xcube plugin that allows generating data cubes from EO data products provided by BC. You can use the repo as starting point. The implementation is in xcube_gen_bc/iproc.py.