[sen2cor 2.8] Terminal: Unspecific error in metadata

Hello everybody,

When I want to perform an atmospherical correction in sen2cor 2.8 terminal mode, the correction always terminates with the following error:

Unspecific Error in metadata, preprocessing failed. Application terminated with at least one error.

The terminal is running with administrator rights and the folder containing the data is inside a subfolder of drive C. Funnily, everything works when I use the GUI in SNAP. But then only when I give in the parameters manually.

I hope someone may help, as using the terminal is more convenient.

How did you call the sen2cor from the terminal?

Was any preprocess done before AC?

I just downloaded the data, unpacked it and copied it to another directory. No preprocessing, I even did not open it. As I have set an environmental variable to my sen2cor directory in Windows, I change directory to the folder of the image. The L2A_GIPP.xml is also saved in this folder. The command is:

L2A_Process S2B_MSIL1C_20190301T043719_N0207_R033_T45QXG_20190301T081602.SAFE --GIP_L2A L2A_GIPP_lw.xml

But the same error comes when I call L2A_Process.bat or if I include the full path of the L2A_Process.

Would you please to try up call it, as below,

here is an example of call and implement sen2cor from the console, Navigate to the directory, where the granular is existed and then, implement L2A_ Process as below,


Also you could remove the resolution to AC all bands.

With that command it does work. But I like to use the configuration file as I made some changes to the default settings.

You could add up the setting you’d prefer. similarly to the resolution, please take a look at the sen2cor 2.8 documents.

That works only for some arguments. But adding a DEM directory, changing the Mid_Latitude argument and changing the Ozone_Content argument only works with the GIPP file. Therefore, I like to process a AC with that configuration file.

Might be the developer of the plugin could answer this @obarrilero would you please to share your knowledge.

The sen2cor plugin is generating a GIPP file with the parameters the user selects and then it runs a command similar to the one you used, so if it is working in SNAP but not in the command line, perhaps there is a typo in your GIPP file. Could you share it in order to analyze it?

I saved the parameter file you mentioned under a new name and changed some parameters. That is the file:

<?xml version="1.0" encoding="UTF-8"?>
<Level-2A_Ground_Image_Processing_Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="L2A_GIPP.xsd">
    <!-- Nr_Treads determines the number of threads used for reading the OpenJPEG2 images. This is a new
         feature implemented with OpenJPEG 2.3., improving the speed for importing the Bands.
         If AUTO is chosen, the number of treads are deduced, using cpu_count().
         Set this to 1 up to a maximum of 8, if this automatic mode will not fit to your platform -->
    <!-- should be either a directory in the sen2cor home folder or 'NONE'. If NONE, no DEM will be used -->
    <!-- DEM_Reference>http://data_public:GDdci@data.cgiar-csi.org/srtm/tiles/GeoTIFF/</DEM_Reference -->
    <!-- disable / enable the upper two rows if you want to use an SRTM DEM -->
    <!-- The SRTM DEM will then be downloaded from this reference, if no local DEM is available -->
    <!-- if you use Planet DEM you can optionally add the local path instead,
         which then will be inserted in the datastrip metadata -->
    <!-- FALSE: no DEM output, TRUE: store DEM in the AUX data directory -->
    <!-- FALSE: no TCI output, TRUE: store TCI in the IMAGE data directory -->
    <!-- FALSE: no DDV output, TRUE: store DDV in the QI_DATA directory -->
    <!-- TRUE: create additional 60m bands when 20m is processed -->
    <PSD_Scheme PSD_Version="14.2" PSD_Reference="S2-PDGS-TAS-DI-PSD-V14.2_Schema">
    <PSD_Scheme PSD_Version="14.5" PSD_Reference="S2-PDGS-TAS-DI-PSD-V14.5_Schema">
      <!-- RURAL, MARITIME, AUTO -->
      <!-- SUMMER, WINTER, AUTO -->
      <!-- The atmospheric temperature profile and ozone content in Dobson Unit (DU)
      	0: to get the best approximation from metadata
      	(this is the smallest difference between metadata and column DU),
      	else select one of:
        For midlatitude summer (MS) atmosphere:
        250, 290, 331 (standard MS), 370, 410, 450
        For midlatitude winter (MW) atmosphere:
        250, 290, 330, 377 (standard MW), 420, 460
      <!-- 0: No WV correction, 1: only 940 nm bands, 2: only 1130 nm bands , 3: both regions used during wv retrieval, 4: Thermal region -->
      <!-- 0: constant, 1: variable visibility -->
      <!-- 0: not replaced, 1: land-average, 2: line-average -->
      <!-- FALSE: no cirrus correction applied, TRUE: cirrus correction applied -->
      <!--Use DEM for Terrain Correction, otherwise only used for WVP and AOT -->
      <!-- 0: no BRDF correction, 1, 2, 11, 12, 22, 21: see IODD for explanation -->
      <!-- In most cases, g=0.2 to 0.25 is adequate, in extreme cases of overcorrection g=0.1 should be applied -->
      <!-- Adjancency Range [km] -->
      <!-- visibility (5 <= visib <= 120 km) -->
      <!-- [km] -->
      <!-- length of square box, [meters] -->
      <!-- water vapor threshold to switch off cirrus algorithm [cm]Range: 0.1-1.0 -->
      <!-- zlib compression level for image database [0-9, 0: best speed, 9: best size] -->

I have executed sen2cor 2.8 with your GIPP file with success. Are you having the error only with a product or with anyone?