Where can I find a documentation about python command lines to call sen2cor?


I am new to Sen2cor and I would like to use Sen2cor functionalities SCENECLASS (for classification) and ATMCORR (for atmospheric correction) with python command line (so that later I use it with Spark).
Where could I find documentation about Sen2cor command line with python ?
Do you have any example or script that could help me start ?

Thank you !

Hello Coralie,

I never used only the SCENECLASS, but you can find the basics codes of sen2cor when you run “L2A_Process -h” in a command window:

Which OS are you using? Windows, Linux,…? Basically you can run sen2cor with the following command in your py-script:

cmd = ‘L2A_Process --resolution 20 C:/S2/S2A_OPER_PRD_M…_20151211T084342’


1 Like

Hello Andreas,

Thank you for your answer !

I finally used L2A_process, as you said, with the shell on Linux and it compiled correctly !

I have difficulties to understand where I can find the classification (cloud etc) it made.

In which directory is it ?
Do I need to rebuild an image (with each band and gdal for example) to see the cloud map?
Is there a metadata with statistical and geographical information about the classification made?

Thank you,

Hi Coralie

You are welcome.

If you open the file in SNAP you can find the Scene-Classification (=scl_) files und “Masks” (at the bottom). And metadata of the Quality can be found under “Bands/quality/quality_scene_classification”. About where to find this files in the directory: There I can not help, until now I did not find them myself either.

Concerning the clouds: If you only need this information, then they are already in the original files implemented. :wink:

Hallo Coralie,

the most easy way to see all the results is opening the product in SNAP as already explained.
You find a correct summary of the classification results (percentage per class) in the product directory at the end of S2A_USER_MTD_SAFL2A_PDMC_ … .xml
The images itself are located on granule level with the scene classification images like S2A_USER_SCL_L2A_TL_SGS__20160512T160424_A004638_T32UQB_20m.jp2 in the IMG_DATA folder and the cloud- and snow confidence images in the folder QI_DATA (files like S2A_USER_CLD_L2A_TL_SGS__20160512T160424_A004638_T32UQB_20m.jp2 and S2A_USER_SNW_L2A_TL_SGS__20160512T160424_A004638_T32UQB_20m.jp2 .


Please visit here. This may help you solving your query. https://docs.python.org/2/using/cmdline.html

Later you can use it with Spark.