Unit 19 - Sentinel preprocessing


Unit under construction.

In this unit Sentinel-2 L1C (see Sentinel Product Types description) data will be preprocessed to be used in GRASS GIS.

In the first step few Sentinal scenes will be downloaded similarly as shown in Unit 18 - Sentinel downloader. In this case producttype=S2MSI2Ap will be replaced by producttype=S2MSI1C.

i.sentinel.download -l map=oslo producttype=S2MSI1C settings=sentinel.txt \
start=2018-04-01 end=2018-10-01 area_relation=Contains clouds=10
ef0b12ac-9c79-46ec-8223-9655791943ea 2018-05-18T10:40:21Z  0% S2MSI1C
b40c6c72-da2d-427e-ae8f-a9461ca65c33 2018-07-05T10:50:29Z  0% S2MSI1C
97a5820c-c1c8-4300-a076-174c9e7694fa 2018-05-23T10:40:19Z  0% S2MSI1C
d6ab2378-84e8-4e73-8be9-0e9833587a65 2018-06-02T10:40:19Z  9% S2MSI1C

Since we already have the Sentinel scene for 23rd May (Unit 18 - Sentinel downloader) and 5th July 2017 (Unit 05 - Simple computation) the same dates of 2018 can be downloaded. A command to download specified scenes by UUID below.

i.sentinel.download settings=sentinel.txt output=geodata/sentinel/l1c \

In the next step downloaded data is imported into GRASS GIS using another command provided by i.sentinel addons, i.sentinel.preproc. This module requires some inputs used to perform the atmospheric correction of Sentinel-2 images.

As elevetion model DMT imported in Unit 17 can be used. What we need to obtain yet is a visibility map or an Aerosol Optical Depth (AOD) value, the second one is possible to obtain from http://aeronet.gsfc.nasa.gov.

First you have to select a station close to your Sentinel-2 scene area. In our case Birkenes, click on download, see Fig. 109.


Fig. 109 Download Aeronet station data.

Now tick the box near the bottom labelled as ‘Combined file (all products without phase functions)’.


Fig. 110 Combined file requested.

Last step is to accept the license (Public domain data).

Once we have downloaded Sentinel data and AOD we need to decompress them.

cd ~/geodata/sentinel/
unzip S2B_MSIL1C_20180523T104019_N0206_R008_T32VNM_20180523T142657.zip
unzip S2B_MSIL1C_20180705T105029_N0206_R051_T32VNM_20180705T130423.zip
cd ~/Downloads/
unzip 180501_180731_Birkenes.zip

Now we are ready to import the data with i.sentinel.preproc.

i.sentinel.preproc -a -t \
input_dir=~/geodata/sentinel/S2B_MSIL1C_20180523T104019_N0206_R008_T32VNM_20180523T142657.SAFE \
elevation=DEM atmospheric_model=Automatic aerosol_model="Continental model" \
aeronet_file=~/Downloads/180501_180731_Birkenes.dubovik suffix=cor \

i.sentinel.preproc -a -t \
input_dir=~/geodata/sentinel/S2B_MSIL1C_20180705T105029_N0206_R051_T32VNM_20180705T130423.SAFE \
elevation=DEM atmospheric_model=Automatic aerosol_model="Continental model" \
aeronet_file=PATH/180501_180731_Birkenes.dubovik suffix=cor \

The -a flag is needed since we use AOD file, -t is used to write a text file (text_file) ready to be used as input for the next step, creating cloud mask by i.sentinel.mask.

i.sentinel.mask creates clouds and cloud shadows masks for Sentinel-2 images, the algorithm has been developed starting from rules found in literature (Parmes et. al 2017) and conveniently refined.

i.sentinel.mask -r cloud_mask=FIX shadow_mask=FIX cloud_threshold=25000 shadow_threshold=5000 \
input_file=~/geodata/sentinel/S2B_MSIL1C_20180523T104019_N0206_R008_T32VNM_20180523T142657.SAFE/mask.txt \

i.sentinel.mask -r cloud_mask=FIX shadow_mask=FIX cloud_threshold=25000 shadow_threshold=5000 \
input_file=~/geodata/sentinel/S2B_MSIL1C_20180705T105029_N0206_R051_T32VNM_20180705T130423.SAFE/mask.txt \

In the last step topographic correction of reflectance must be performed in order to use Sentinel data for analysis. Required sun position for a given date is computed by r.sunmask.

r.sunmask -gs dtm_oslo year=2018 month=5 day=23 hour=10 minute=40 timezone=0
Using map center coordinates: 250000.000000 6675000.000000

Now we have to run i.topo.corr to calculate a illumination model from the elevation map.

i.topo.corr -i base=dtm_oslo zenith=50.010803 azimuth=167.292191 output=dtm_oslo.illu
i.topo.corr base=dtm_oslo.illu input= output=tcor zenith=50.010803 method=c-factor