Sen2cor processing to 10m resolution

Running the sen2cor thematic land processing tool from the SNAP plugin menu one of the options is to set the resolution. Having set the resolution to 10m as in the screenshot below:

the output (when viewd as an RGB image) proves not to be 10m resolution. On the left is the original RGB image (10m) and the ‘output’ RGB image on the right. Although the resolution was set to 10m this output appears to be at 60m resolution:

I’d like to know if I’m misinterpreting the settings or have perhaps set them incorrectly.

I’m using SNAP 6.0 and Sen2Cor-02.05.05

Did you try to open the result in other software e.g. QGIS?

Yes. I’ve also tried running the tool from the command line. Looking at the outputs I find that in the GRANULE folder with the IMG_DATA directory I only have R20 and R60 folders:

The R20 folder only holds what looks like an intermediary file:

Whereas the R60 folder holds all bands at 60m:

Running the tool from the cli afforded me the opportunity to see the readout and something does go wrong. Here’s the output from the cmd window:

Traceback (most recent call last):
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\lib\multiprocessing\process.py”, line 258, in _bootstrap
self.run()
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\Lib\site-packages\sen2cor\L2A_ProcessTile.py”, line 124, in run
if not self.process_20():
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\Lib\site-packages\sen2cor\L2A_ProcessTile.py”, line 158, in process_20
return self.process()
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\Lib\site-packages\sen2cor\L2A_ProcessTile.py”, line 223, in process
if ac.process() == False:
File “L2A_AtmCorr.py”, line 3163, in L2A_AtmCorr.L2A_AtmCorr.process (L2A_AtmC
orr.c:73951)
File “L2A_AtmCorr.py”, line 7710, in L2A_AtmCorr.L2A_AtmCorr.rho_retrieval_ste
p1 (L2A_AtmCorr.c:204885)
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\Lib\site-packages\sen2cor\L2A_Tables.py”, line 2598, in getDataType
h5file = open_file(self._ImageDataBase, mode=‘r’)
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\lib\site-packages\tables\file.py”, line 320, in open_file
return File(filename, mode, title, root_uep, filters, **kwargs)
File “C:\myInstallLocation\Sen2Cor-02.05.05-win64\Sen2Cor-02.05.05-win6
4\lib\site-packages\tables\file.py”, line 783, in init
self._g_new(filename, mode, **params)
File “tables\hdf5extension.pyx”, line 487, in tables.hdf5extension.File._g_new
(tables\hdf5extension.c:5943)
HDF5ExtError: HDF5 error back trace

File “C:\sen2cor\deps\hdf5-1.8.18\src\H5F.c”, line 604, in H5Fopen
unable to open file
File “C:\sen2cor\deps\hdf5-1.8.18\src\H5Fint.c”, line 1087, in H5F_open
unable to read superblock
File “C:\sen2cor\deps\hdf5-1.8.18\src\H5Fsuper.c”, line 294, in H5F_super_read

unable to load superblock

File “C:\sen2cor\deps\hdf5-1.8.18\src\H5AC.c”, line 1262, in H5AC_protect
H5C_protect() failed.
File “C:\sen2cor\deps\hdf5-1.8.18\src\H5C.c”, line 3574, in H5C_protect
can’t load entry
File “C:\sen2cor\deps\hdf5-1.8.18\src\H5C.c”, line 7954, in H5C_load_entry
unable to load entry
File “C:\sen2cor\deps\hdf5-1.8.18\src\H5Fsuper_cache.c”, line 476, in H5F_sblo
ck_load
truncated file: eof = 389409061, sblock->base_addr = 0, stored_eoa = 4634678
78

End of HDF5 error back trace

This would explain why when the tool is run in SNAP only a 60m output can be viewed. However, I don’t know what is causing the issue.

Next I will try removing the standalone install of sen2cor, resetting my paths, uninstalling the plugin from SNAP, reinstalling the plugin to SNAP and then insallting the bundle through the SNAP interface. I’ll report back what I find.

good idea. I made a short checklist here: Sen2cor 2.4.0 on SNAP 6.0

Thanks the checklist was very useful. I’ve done a clean install and getting closer but still unable to complete the sen2cor tool successfully at 10m resolution. I’ve got as far as 20m but the tool failed (stack trace below). Here’s the imagery:

The only option (when trying to view RGB image) was atmospheric penetration. So I tried that.

The R10 folder still only has the .hd5 file in it and the stack trace was:

Progress[]: 98.54 : PID-27112, L2A_AtmCorr: end of surface reflectance retrieval preparation, elapsed time[s]: 3.950 Process L2A_ProcessTile-1: Traceback (most recent call last): File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\lib\multiprocessing\process.py", line 258, in _bootstrap self.run() File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\Lib\site-packages\sen2cor\L2A_ProcessTile.py", line 135, in run if self.process_10() == False: File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\Lib\site-packages\sen2cor\L2A_ProcessTile.py", line 181, in process_10 return self.process_10() File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\Lib\site-packages\sen2cor\L2A_ProcessTile.py", line 182, in process_10 return self.process() File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\Lib\site-packages\sen2cor\L2A_ProcessTile.py", line 219, in process if ac.process() == False: File "L2A_AtmCorr.py", line 3261, in L2A_AtmCorr.L2A_AtmCorr.process (L2A_AtmCorr.c:77588) File "L2A_AtmCorr.py", line 8817, in L2A_AtmCorr.L2A_AtmCorr.rho_retrieval_step1 (L2A_AtmCorr.c:242299) File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\Lib\site-packages\sen2cor\L2A_Tables.py", line 2230, in getDataType h5file = open_file(self._ImageDataBase, mode='r') File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\lib\site-packages\tables\file.py", line 320, in open_file return File(filename, mode, title, root_uep, filters, **kwargs) File "C:\myInstall\.snap\auxdata\Sen2Cor-2.4.0-win64\lib\site-packages\tables\file.py", line 783, in __init__ self._g_new(filename, mode, **params) File "tables\hdf5extension.pyx", line 487, in tables.hdf5extension.File._g_new (tables\hdf5extension.c:5943) HDF5ExtError: HDF5 error back trace File "C:\sen2cor\deps\hdf5-1.8.18\src\H5F.c", line 604, in H5Fopen unable to open file File "C:\sen2cor\deps\hdf5-1.8.18\src\H5Fint.c", line 1087, in H5F_open unable to read superblock File "C:\sen2cor\deps\hdf5-1.8.18\src\H5Fsuper.c", line 294, in H5F_super_read unable to load superblock File "C:\sen2cor\deps\hdf5-1.8.18\src\H5AC.c", line 1262, in H5AC_protect H5C_protect() failed. File "C:\sen2cor\deps\hdf5-1.8.18\src\H5C.c", line 3574, in H5C_protect can't load entry File "C:\sen2cor\deps\hdf5-1.8.18\src\H5C.c", line 7954, in H5C_load_entry unable to load entry File "C:\sen2cor\deps\hdf5-1.8.18\src\H5Fsuper_cache.c", line 476, in H5F_sblock_load truncated file: eof = 1303506910, sblock->base_addr = 0, stored_eoa = 1682670152 End of HDF5 error back trace Unable to open/create file 'C:\myData\S2B_MSIL1C_20170817T222019_N0205\S2B_MSIL2A_20170817T222019_N0205_R029_T60KYG_20170817T222017.SAFE\GRANULE\L2A_T60KYG_A002343_20170817T222017\IMG_DATA\R10m\.database.h5' Progress[]: 100.00 : Application terminated successfully.
Finished tool execution in 3169 seconds

Difficulties

I’d like to be able to test this on a subset of the data because the processing times are very long but it seems sen2cor only works with full scenes. So far I have tried:

Using the subset tool - the tool threw an error that bands were at different resolutions so I tried…
Using the resample tool - I successfully resampled the data to 10m resolution (very time consuming) for all bands and then tried…
Using the subset tool - I successfully subset a smaller area for testing.

However, I’m getting the error that sen2cor requires the pattern … .SAFE and the only save option available for the subset is the DIM format.

Is there are a way to use a smaller area of data other than a whole scene for sen2cor so I can troubleshoot in a more time efficient way?

I’ve also thought perhaps it would be more efficient to spin up and EC2 linux instance on AWS (with more processing power than I have) and install SNAP and sen2cor on it and run it there.

Thanks for your help so far.

HELLO how i do Sen2Cor citation

After doing atmospheric correction by Sen2Cor, I couldn’t open the meta data file (MTD_MSIL2A) and image data of 10 and 20 m resolution in corrected Sentinel 2 image. what’s wrong?