Sen2cor (detailled instructions)

Apparently, the new released SNAP 6.0 allows the sen2cor 2.4.0 plugin to be installed and run directly within the SNAP. Indeed, SNAP installs the bundle when try to run it.

However, it doesn’t work for me. Although a new folder is generated (S2A_MSIL1A…from the S2A_MSIL1C), the folder does not contain the corrected bands.

Is there anyone that succeeded with it without using Anaconda nor the standalone sen2cor tool? (I am a Windows user)

I enter the image through the MTD_MSIL1C file within the download folder S2A_MSIL1C_…

Then I run the sen2cor and a new folder is generated named S2A_MSIL2A_…

But inside the latter folder I just have two empty folders: AUX_DATA and DATASTRIP

Any suggestion?

1 Like

This is what works for my configuration.
I previously had sen2cor 2.3 and previous versions installed as well, also older versions of SNAP which I then updated to version 6. So this might also be the case for most of the users.

Please note: These instructions were originally written for sen2cor 2.4 but they simply describe a clean install of a new version and should basically work with later ones as well.

If you didn’t have SNAP or sen2cor installed before, you can skip steps 1 and 2, but if you want to go sure that everything is clean, follow all of them. This may also help to identify possible errors.

#1. Deletion of all sen2cor plugins (if available)

Tools > Manage external Tools
Make sure that sen2cor is no longer listed. Remove it with the minus sign.

Tools > Plugins
Uninstall all sen2cor versions available, even if 2.4 is listed under SNAP 6. I experienced that there are some old references which might still interfere with that. So select sen2cor and click “uninstall”. Then restart SNAP.

#2. Delete all sen2cor folders from your system, especially under

  • C:\users\yourname\documents\sen2cor
  • C:\users\yourname\.snap\auxdata\Sen2Cor-2.4.0-win64 (this is hidden, you have to display all data first)

#3. Perform a clean new installation of sen2cor 2.4 within SNAP 6

Tools > Plugins
Select sen2cor under “Available plugins” and install. Restart SNAP upon request.

#4. Run sen2cor for the first time

Optical > Thematic Land Processing > sen2cor
It will probably not work yet but give you a message:

This is no wonder because none of these folders does exist.

Hit “OK” and you are redirected to the plugin settings again. You are asked if you want to install the bundle for SNAP 6. Confirm with “Yes”. This might then take some while because sen2cor is freshly downloaded and integrated.

Progress bar at the bottom.

After completion, you get a message - remember this path:

The System variable SEN2COR_BIN should now point to this directory, however SEN2COR_HOME doesn’t exist yet (as we deleted the folder in step 1).

#5. Create SEN2COR_HOME

Create a new folder at this location (or any other, but make sure it exactly matches the SEN2COR_HOME variable).

#6. Run sen2cor

Optical > Thematic Land Processing > sen2cor
Make sure you select a Level1C product of Sentinel-2 (MSIL1C) and use it as input for the tool.
In the “Processing Parameters” tab, enable “Display execution output” to get information on the progress of the tool and possible errors.

#7. Open the result

After finishing the target product was written in the same folder as your input data.

S2_MSIL1C represents the product before correction, MSIL1A is the corrected product. Open it with the MTD_MSIL2A.xml file.

Left: Level-1C, right Level-2A:

A note on performance: As you see, sen2cor doesn’t work wonders. Slight haze can be removed but no thick layers of clouds, of course. The core functionality is the conversion into bottom-of-atmosphere reflectance and the reduction of topographic effects. The new plugin allows to play around with the parameters directly in SNAP, aerosols for example.

9 Likes

Thanks a lot for your reply and the technical support. But no way. It doesn’t work to me. I did all according to your suggestion, but at the end the new folder generated is just made by two empty folders: AUX_DATA and DATASTRIP.

is maybe any other sen2cor variable still left in your system’s environment variables?

I don’t know. I did what you explained before. Is there any way to verify if other sen2cor variables still left?

Have a look here and see if there are entries which include old sen2cor directories

Hi A. Actually there were some variables still there and I deleted them. After that I repeated the steps as you suggested, but again same result!!! No way to me. Is it possible that it depends on windows 8?

Did you import the whole S2 product? Have you applied any preprocessing?
I think it shouldn’t make a difference which Windows is installed.

What do you mean with “whole S2 product” and “any preprocessing”?

I have downloaded an S2 image, and it seems complete, as you can see in the image I have attached…but no other steps have been applied to the image…

I have downloaded the image via USGS glovis platform. And within the folder I have the following data (see image). In SNAP I open the MTD_MSIL1C

I just wondered because this happened to others in this before, for example they didn’t use the import function for opening S2 data products. But this is not the case for you. How big is the extracted S2 folder? Depending on the covered scene it should be around 500 MB.

Yes the folders are around 700/800 MB. For importing you mean opening the MTD-MSIL1c file?

Actually, what is strange is that when closing and re-open SNAP now the “external Tools Manager” is empty, although the sen2cor plugin appears as installed…

And the sen2cor now doesn’t run

yes - with File > Import > Optical > Sentinel 2 > Level 1C

Hard to tell what is wrong on your side without seeing it. If it is no longer there I can just recommend installing it from scratch as I explained above.

Did you try to run it from the command line? Just add the path to L2A_process to your system’s PATH variable and open the command window in the directory where your S2 product is located and proceed as described in the manual in chapter 3.3.1

I have no succeeded…I will try tomorrow with another PC, and I let you know. Thank you very much for you efforts!!

Dear nicola.colaninno,

Someone else was telling me the adapter is disappearing after restart. I tried different combinations of operations and I could not reproduce the disappearing. Please uninstall SNAP, Sen2Cor, and Anaconda, delete the suggested folders and system variables, and then retake the usual installation steps. I also use Windows 8, so the OS is not an issue. If you manage to reproduce the disappearing on a clean installation, please give me the steps (like: download the installer from …, double click the installer, restart, check the button… etc). This is a priority for me, so I want to find the issue and to provide a solution in the next update. So please, send me the details.
Have a nice day.

Error related to the List index out of range

I have resolved this problem by changing the code in line number 163 in L2A_Tables.py
Older code:
self.tileId2a = t1c_split[0] + ‘USER’ + t1c_split[2] + '’ + t2a_split[0] + ‘’ +
t1c_split[4] + '
’ + t1c_split[5] + ‘’ + t2a_split[3] + '’ +
t2a_split[2] + ‘’ + t2a_split[1] + '’ + t1c_split[10]

Changed code
self.tileId2a = t1c_split[0] + ‘USER’ + t1c_split[2] + '’ + t2a_split[0] + ‘’ +
t1c_split[4] + '
’ + t1c_split[5] + ‘’ + t2a_split[3] + '’ +
t2a_split[2] + ‘’ + t2a_split[1] + '’ + t1c_split[-1]