[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,

L2A_Process ./S2A_MSIL1C_XXXXXXXXXXXXXXXXXXXXXX.SAFE -–resolution=10

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">
  <Common_Section>
    <Log_Level>INFO</Log_Level>
    <!-- can be: NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL -->
    <Nr_Threads>AUTO</Nr_Threads>
    <!-- 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 -->
    <DEM_Directory>C:\Users\lukaswimmer\Desktop\RiShi_0619\data\accuracy\s2-shesh\DEM</DEM_Directory>
    <!-- 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>
    <!-- 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 -->
    <Generate_DEM_Output>FALSE</Generate_DEM_Output>
    <!-- FALSE: no DEM output, TRUE: store DEM in the AUX data directory -->
    <Generate_TCI_Output>TRUE</Generate_TCI_Output>
    <!-- FALSE: no TCI output, TRUE: store TCI in the IMAGE data directory -->
    <Generate_DDV_Output>FALSE</Generate_DDV_Output>
    <!-- FALSE: no DDV output, TRUE: store DDV in the QI_DATA directory -->
    <Downsample_20_to_60>TRUE</Downsample_20_to_60>
    <!-- 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">
		<UP_Scheme_1C>S2_User_Product_Level-1C_Metadata</UP_Scheme_1C>
		<UP_Scheme_2A>S2_User_Product_Level-2A_Metadata</UP_Scheme_2A>
		<Tile_Scheme_1C>S2_PDI_Level-1C_Tile_Metadata</Tile_Scheme_1C>
		<Tile_Scheme_2A>S2_PDI_Level-2A_Tile_Metadata</Tile_Scheme_2A>
		<DS_Scheme_1C>S2_PDI_Level-1C_Datastrip_Metadata</DS_Scheme_1C>
		<DS_Scheme_2A>S2_PDI_Level-2A_Datastrip_Metadata</DS_Scheme_2A>
    </PSD_Scheme>
    <PSD_Scheme PSD_Version="14.5" PSD_Reference="S2-PDGS-TAS-DI-PSD-V14.5_Schema">
		<UP_Scheme_1C>S2_User_Product_Level-1C_Metadata</UP_Scheme_1C>
		<UP_Scheme_2A>S2_User_Product_Level-2A_Metadata</UP_Scheme_2A>
		<Tile_Scheme_1C>S2_PDI_Level-1C_Tile_Metadata</Tile_Scheme_1C>
		<Tile_Scheme_2A>S2_PDI_Level-2A_Tile_Metadata</Tile_Scheme_2A>
		<DS_Scheme_1C>S2_PDI_Level-1C_Datastrip_Metadata</DS_Scheme_1C>
		<DS_Scheme_2A>S2_PDI_Level-2A_Datastrip_Metadata</DS_Scheme_2A>
	</PSD_Scheme>
    <GIPP_Scheme>L2A_GIPP</GIPP_Scheme>
    <SC_Scheme>L2A_CAL_SC_GIPP</SC_Scheme>
    <AC_Scheme>L2A_CAL_AC_GIPP</AC_Scheme>
    <PB_Scheme>L2A_PB_GIPP</PB_Scheme>
  </Common_Section>
  <Scene_Classification>
    <Filters>
      <Median_Filter>0</Median_Filter>
    </Filters>
  </Scene_Classification>
  <Atmospheric_Correction>
    <Look_Up_Tables>
      <Aerosol_Type>RURAL</Aerosol_Type>
      <!-- RURAL, MARITIME, AUTO -->
      <Mid_Latitude>AUTO</Mid_Latitude>
      <!-- SUMMER, WINTER, AUTO -->
      <Ozone_Content>0</Ozone_Content>
      <!-- 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
        ==========================================
       -->
    </Look_Up_Tables>
    <Flags>
      <WV_Correction>1</WV_Correction>
      <!-- 0: No WV correction, 1: only 940 nm bands, 2: only 1130 nm bands , 3: both regions used during wv retrieval, 4: Thermal region -->
      <VIS_Update_Mode>1</VIS_Update_Mode>
      <!-- 0: constant, 1: variable visibility -->
      <WV_Watermask>1</WV_Watermask>
      <!-- 0: not replaced, 1: land-average, 2: line-average -->
      <Cirrus_Correction>FALSE</Cirrus_Correction>
      <!-- FALSE: no cirrus correction applied, TRUE: cirrus correction applied -->
      <DEM_Terrain_Correction>TRUE</DEM_Terrain_Correction>
      <!--Use DEM for Terrain Correction, otherwise only used for WVP and AOT -->
      <BRDF_Correction>0</BRDF_Correction>
      <!-- 0: no BRDF correction, 1, 2, 11, 12, 22, 21: see IODD for explanation -->
      <BRDF_Lower_Bound>0.22</BRDF_Lower_Bound>
      <!-- In most cases, g=0.2 to 0.25 is adequate, in extreme cases of overcorrection g=0.1 should be applied -->
    </Flags>
    <Calibration>
      <Adj_Km>1.000</Adj_Km>
      <!-- Adjancency Range [km] -->
      <Visibility>23.0</Visibility>
      <!-- visibility (5 <= visib <= 120 km) -->
      <Altitude>0.100</Altitude>
      <!-- [km] -->
      <Smooth_WV_Map>100.0</Smooth_WV_Map>
      <!-- length of square box, [meters] -->
      <WV_Threshold_Cirrus>0.25</WV_Threshold_Cirrus>
      <!-- water vapor threshold to switch off cirrus algorithm [cm]Range: 0.1-1.0 -->
      <Database_Compression_Level>0</Database_Compression_Level>
      <!-- zlib compression level for image database [0-9, 0: best speed, 9: best size] -->
    </Calibration>
  </Atmospheric_Correction>
</Level-2A_Ground_Image_Processing_Parameter>

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