In which L2A_GIPP.xml settings need to be changed to integrate DEM for topographic correction

Issue #4 new
Charlotte Wilczok created an issue

Dear Sam,

I opened another issue, because it could be of interest to others as well! As my study area (= South-West Region of Cameroon) is quite mountainous, I would like to integrate a DEM during the sen2cor process to correct for topography and therefore reduce illumination effects.

I’ve found a lot of threads in the ESA-STEP forum on how to change the settings in the L2A_GIPP.xml file:

    <DEM_Directory>dem_srtm</DEM_Directory>
    <!-- should be either a directory in the sen2cor home folder or 'NONE'. If NONE, no DEM will be used -->
    <!-- DEM_Reference>NONE</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 -->

here I changed from “NONE” to “dem_srtm” and created beforehand in the sen2cor home directory the corresponding folder:

root@charlotte-VirtualBox:~/sen2cor/2.8/dem_srtm

Additionally I enabled the DEM_Reference.

When running your preprocess.py script it seems as the settings are not used. During the processing there is no hint in the terminal and no downloaded SRTM data sets are present in the respective folder I’ve set and created beforehand. Then I was looking for all “L2A_GIPP.xml”, within anaconda3/*, within sen2mosaic/* and changed the setting there as well (also in L2A_GIPP_255.xml). But nothing happened.

Could you please help me and give me a hint, which *.xml I have to change to get sen2cor using a DEM for topographic correction? I have not fully understood how your scripts are interacting with the sen2cor package.

Once again, thank you very much in advance.

Best,

Charlotte

Comments (1)

  1. Samuel Bowers repo owner

    Hi Charlotte,

    This is interesting, I hadn’t realised you can input your own DEM with sen2cor.

    The processing chain uses the version of L2A_GIPP.xml included with the scripts by default (in sen2mosaic/cfg/). L2A_GIPP_255.xml is specific to sen2cor 2.5.5, you shouldn’t need to use this unless using older Sentinel-2 data. You can also specify your own modified GIPP file (recommended in your case), or you could modify the included GIPP file directly if you prefer.

    In approximate order of the change of solving the issue, here’s some things I’d suggest doing:

    i) Manually reference the edited GIPP file for preprocessing using the -g flag (i.e. python /path/to/sen2mosaic/cli/preprocess.py -g /path/to/edited_gipp.xml). This way you can be sure you’re using the edited GIPP file.

    ii) Test your edits to the xml file outside of sen2mosaic. This would mean editing the xml file included with sen2cor, then manually preprocessing a granule with the L2A_process command of sen2cor. If your change works here but not with sen2mosaic, it might be something I need to test from my end.

    iii) Re-install sen2mosaic after editing the L2A_GIPP.xml file. Better to leave the included file alone if you can, but if this works but not i), please let me know!

    iv) Run preprocess with the -v flag. This will dump output from sen2cor into the terminal, you might be able to see something unexpected.

    Good luck!

    Sam

  2. Log in to comment