Sen2cor not generating Level-2A output

Dear community,

I am running the latest version of SNAP 5.0 and sen2cor 2.3.1 on a sentinel-2 Level-1C image, downloaded from ESA’s data hub, to obtain a Level2-A, but I am not able to get the output, although the process says:
Process exited with value 1
Finished tool execution in 97 seconds
I checked the sen2cor folder created during installation in an attempt to look for the product and I found that the process generates a file that it is stored in the “log” folder with the same name as the image plus _report.xml but it is no readable with snap, as it should be.
I tried to follow the tutorial available in youtube of the installation of sen2cor, since at the end it demonstrates how to perform this process, however the version does not coincide with the current anymore.
I am pretty sure that snap and sen2cor were installed according to the requirements, since when I call L2A_Process --help via command line the menu is displayed.

The image
S2A OPER PRD MSIL1C PDMC 20160726T185727 R065 V20150806T102012 20150806T102012

The tile UUB
S2A_OPER_MSI_L1C_TL_EPA__20160721T205724_A000634_T33UUB_N02.04

Before running the process

Displaying execution output

Do you know where the output is being stored? Am I missing something out? Before, a file with almost the same name, except Level-1C replaced by Level-2A, was generated in the same path as the input data, but now this does not happen.
I would appreciate very much if you could point me in the right direction.

Best,
Stephania

Hi Stephania,

if Sen2Cor is working properly via command line, it could be a problem with the System Variables configuration. First of all, you should try to execute the process via the command line to be sure that it is working correctly. To do that, please execute:

L2A_Process [the_L1C_product_directory]/S2A_OPER_PRD_MSIL1C_PDMC_20160726T185727_R065 V20150806T102012 20150806T102012.SAFE --resolution=60

The name of the product must have underscores instead of spaces (if you have modified it, it could be the origin of the problem). If this works properly, then we will analyse your system variables.

Dear Obarrilero,
I did what you told me and got the following result:

However, I still don’t get the Level-2A image anywhere.

Thanks in advance

Hallo Stephania,

you have an error in your command: don’t use ‘=’

L2A_Process S2A_OPER… --resolution 60

Then you should get an result at least using the command line.

Bringfried

Hello Bringfried,

Thank you for your response. I tried out what you suggested, and also without defining any resolution, but still I am not getting the output. The command only generates xml. reports in the log file of the sen2cor folder like shown below


Stephania

Dear Obarrilero,

Can you please tell me how to check if my system variables are set correctly? I am still not able to generate Level-2A products.

Thanks in advance

Hi,

from the Sen2Cor’s user manual:

"The setup script generates the following three environment variables:
SEN2COR_HOME:this is the directory where the user configuration data are stored (see above). This can be changed later by you in setting the environment variable to a different location.
SEN2COR_BIN:this is a pointer to the installation of the SEN2COR package. This is located in the “site-packages” folder of Anaconda. Do not change this.
GDAL_DATA :this is a pointer to the directory where the GDAL coordinate system info is stored. This is located in the “sen2cor\cfg\gdal_data” folder of the SEN2COR site_package installation inside of Anaconda. Do not change this.

Open a new command line window, to be secure that your new environment settings are updated. From this new command line window, perform the following test: Call the processor via “L2A_Process --help”. This will give you a list of possible further options. If no errors are displayed, your installation was successful. "

Check also the Anaconda installation:

“At the end of the installation, open a command line window and check the proper installation by typing “python.” It should display:
C:>python
Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jul 2 2016, 17:42:40)[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2.”

Hallo Stephania,

on Windows you can check your system variables by typing the command set on the command line. Then all defined system variables are listed.

Your product from L2A-processing should be located in the same directory as your input file if you nothing other specified in the configuration. It has a name starting with S2A_USER_PRD_MSIL2A… for the L1C-product you used.

Does your installation gives the expected reponse if you type the command: L2A_Process --h ?

Bringfried

Dear Obarrilero,

These are the environment variable that were set as default after the installation I didn’t change anything. As you can see, there is no GDAL_DATA


I get the L2A_Process --help menu as showed in the previous screen shot

I get the following when typing python in a command line.

Dear Bringfried,

I get the following menu when typing L2A_Process --help

When checking system variables I find the following related to sen2cor :



Hi Stephania,

the variables related to sen2cor seems to be right. But perhaps, the PYTHONPATH variable can affect to the execution. Could you try to remove it and run L2A_Process again? Do not forget the value of the variable, because you should set it again after using sen2cor, because if not, some of your applications are not going to work properly…

On the other hand, it is normal that in sen2cor/log only appear the report files. The output should be created in the same folder where the L1C product is located. Please, could you check if anything has been created there? If a new product has been created but you are not able to open it, try to delete it and re-run sen2cor, perhaps the output product is corrupted.

To open the L2A product in SNAP, you have to select the metadata file (it should be similar to S2A_USER_MTD_SAFL2A_PDMC_20160424T021342_R084_V20160423T182433_20160423T182433.xml or MTD_MSIL2A.xml, not the report file).

Hi Obarrilero,

It doesn’t allow me to delete the PYTHONPATH

I added GDAL_DATA, and I tried with a different image and I think it is processing, I got this:

I got the following error now :frowning:

Dear Obarrilero,

I think I found the problem but I don’t know how to solve it.
I followed the path where the error occured and it turns out that I have two folders of sen2cor of different versions

And the lib20_60 that the code is looking for is only found in the folder of the old sen2cor version which correspond to 2.2.1, if I follow that path I find the file h99000_wv20_rura.atm.

But then there is a contradiction with the following:
In SNAP under the operator specifications it says that the version is 2.1.2.

But then in the system variables it appears the version 2.3.1

How can I solve this?

Hi,

I think it should not be a problem since the version of the operator descriptor showed in SNAP is not used (as far as I know)… Could you try to copy the folder 20_60 to the same location in the version of sen2cor you are using and re-run?

Dear Obarrilero,

It worked, thank you and thank you Bringfried for your support!
So just for future reference, I copied the lib folder of sen2cor old version into sen2cor new version (all within Anaconda folder)

Best,
Stephania