[GRASS-dev] GSoC 2018 final report week 13 - GRASS GIS module for Sentinel-2 cloud and shadow detection

Hi all!
I’m Roberta Fagandini and this is the final report of my GSoC project.

The title of the project is “GRASS GIS module for Sentinel-2 cloud and shadow detection”. It adds new tools for the processing of Sentinel 2 images to GRASS GIS software (Organization: OSGeo).

Abstract:
Optical sensors are unable to penetrate clouds leading to related anomalous reflectance values. Unlike Landsat images, Sentinel 2 datasets do not include thermal and Quality Assessment bands that simplify the detection of clouds avoiding erroneous classification. At the same time, also clouds shadows on the ground lead to anomalous reflectance values which have to be taken into account during the image processing.
The project creates a specific module for GRASS GIS application (i.sentinel.mask) which implements an automatic procedure for clouds and shadows detection for Sentinel 2 images. The procedure is based on an algorithm, developed within my PhD research, which allows to automatically identify clouds and their shadows applying some rules on reflectance values (values thresholds, comparisons between bands, etc.). These have been defined starting from rules found in literature and conveniently refined. In order to increase the accuracy of the final results, a control check is implemented. Clouds and shadows are spatially intersected in order to remove misclassified areas. The final outputs are two different vector maps (OGR standard formats), one for clouds and one for shadows.
To run i.sentinel.mask, the bands of the desired Sentinel 2 images have to be imported and the atmospheric correction has to be applied.
In order to make the data preparation easier, another GRASS GIS addon module has been developed within the GSoC project.
i.sentinel.preproc is a module for the preprocessing of Sentinel 2 images (Level-1C Single Tile product) which wraps the import and the atmospheric correction using respectively two existing GRASS GIS modules, i.sentinel.import and i.atcorr.

The state of the art before the project:
Before this GSoC 2018 project, no modules for the detection of clouds and shadows were available for Sentinel 2 images. Only a specific module for Landsat automatic cloud coverage assessment was available within GRASS GIS (i.landsat.acca) while regarding shadows, no specific module was available.
Moreover, performing the atmospheric correction was a bit complicated especially for unexperienced users who have to process one band at a time and provide all input parameters manually.

The added value that the project brought to GRASS GIS:
Now a specific module for clouds and shadows detection, i.sentinel.mask, is available in GRASS GIS.
Moreover, i.sentinel.preproc provides a simplified module which allows importing images and performing the atmospheric correction avoiding users to supply all the required input parameters manually. The module should help users in preparing data to use as input for i.sentinel.mask. In fact, it makes especially the atmospheric correction procedure easier and faster because it allows performing atmospheric correction of all bands of a Sentinel 2 scene with a single process and it retrieves most of the required input parameters from the image itself. Moreover, one of the possible output of i.sentinel.preproc is a text file to be used as input for i.sentinel.mask.

Follow up:
Both i.sentinel.mask and i.sentinel.preproc are complete and working modules which can be easily installed with g.extension from the official GRASS GIS SVN repository.
Obviously, they can be improved therefore the next steps could be:

  • Implementation of other existing algorithms of clouds and shadows detection (i.sentinel.mask)

  • Implementation of a new download procedure avoiding dependencies (i.sentinel.preproc)

  • Integration of the Topographic Correction (i.sentinel.preproc)

NOTE: Implementation of other existing algorithms of clouds and shadows detection was one of the possible goals of the GSoC project but the coding and debugging of some parts of the two addons required more time than expected.

Permanent links:

Code developed during the GSoC coding period:
https://github.com/RobiFag/GRASS_clouds_and_shadows

Codes on the official GRASS GIS SVN repository:
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.mask
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.preproc

Documentation:
https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html

https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.preproc.html

Weekly reports:
https://trac.osgeo.org/grass/wiki/GSoC/2018/CloudsAndShadowsDetection

Images to showcase the project:
i.sentinel.mask
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_GWF.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CD.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_SD.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CS.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_ES.png
i.sentinel.preproc
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_preproc_GWF.png

Kind regards,
Roberta

Great work, Roberta !

Thanks for these two very useful modules !

Moritz

On 13/08/18 10:20, Roberta Fagandini wrote:

Hi all!
I'm Roberta Fagandini and this is the final report of my GSoC project.

The title of the project is "GRASS GIS module for Sentinel-2 cloud and shadow detection". It adds new tools for the processing of Sentinel 2 images to GRASS GIS software (Organization: OSGeo).

*Abstract:*
Optical sensors are unable to penetrate clouds leading to related anomalous reflectance values. Unlike Landsat images, Sentinel 2 datasets do not include thermal and Quality Assessment bands that simplify the detection of clouds avoiding erroneous classification. At the same time, also clouds shadows on the ground lead to anomalous reflectance values which have to be taken into account during the image processing.
The project creates a specific module for GRASS GIS application (i.sentinel.mask) which implements an automatic procedure for clouds and shadows detection for Sentinel 2 images. The procedure is based on an algorithm, developed within my PhD research, which allows to automatically identify clouds and their shadows applying some rules on reflectance values (values thresholds, comparisons between bands, etc.). These have been defined starting from rules found in literature and conveniently refined. In order to increase the accuracy of the final results, a control check is implemented. Clouds and shadows are spatially intersected in order to remove misclassified areas. The final outputs are two different vector maps (OGR standard formats), one for clouds and one for shadows.
To run i.sentinel.mask, the bands of the desired Sentinel 2 images have to be imported and the atmospheric correction has to be applied.
In order to make the data preparation easier, another GRASS GISaddonmodule has been developed within the GSoC project.
i.sentinel.preprocis a module for the preprocessing of Sentinel 2 images (Level-1C Single Tile product) which wraps the import and the atmospheric correction using respectively two existing GRASS GIS modules, i.sentinel.import and i.atcorr.

*The state of the art before the project:*
Before this GSoC 2018 project, no modules for the detection of clouds and shadows were available for Sentinel 2 images. Only a specific module for Landsat automatic cloud coverage assessment was available within GRASS GIS (i.landsat.acca) while regarding shadows, no specific module was available.
Moreover, performing the atmospheric correction was a bit complicated especially for unexperiencedusers who have to process one band at a time and provide all input parameters manually.

*The added value that the project brought to GRASS GIS:*
Now a specific module for clouds and shadows detection, i.sentinel.mask,is available in GRASS GIS.
Moreover, i.sentinel.preprocprovides a simplified module which allows importing images and performing the atmospheric correction avoiding users to supply all the required input parameters manually. The module should help users in preparing data to use as input for i.sentinel.mask. In fact, it makes especially the atmospheric correction procedure easier and faster because it allows performing atmospheric correction of all bands of a Sentinel 2 scene with a single process and it retrieves most of the required input parameters from the image itself. Moreover, one of the possible output of i.sentinel.preprocis a text file to be used as input for i.sentinel.mask.

*Follow up:*
Both i.sentinel.mask and i.sentinel.preprocare complete and working modules which can be easily installed with g.extension from the official GRASS GIS SVN repository.
Obviously, they can be improved therefore the next steps could be:

  * Implementation of other existing algorithms of clouds and shadows
    detection (i.sentinel.mask)
  * Implementation of a new download procedure avoiding dependencies
    (i.sentinel.preproc)
  * Integration of the Topographic Correction (i.sentinel.preproc)

NOTE: Implementation of other existing algorithms of clouds and shadows detection was one of the possible goals of the GSoC project but the codingand debuggingof some parts of the twoaddonsrequired more time than expected.

*Permanent links:*
*
/Code developed during the GSoC coding period: /
https://github.com/RobiFag/GRASS_clouds_and_shadows

/Codes on the official GRASS GIS SVN repository:/
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.mask
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.preproc

/Documentation:/
https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html
https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.preproc.html

/Weekly reports: /
https://trac.osgeo.org/grass/wiki/GSoC/2018/CloudsAndShadowsDetection

/Images to showcase the project:/
i.sentinel.mask
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_GWF.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CD.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_SD.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CS.png
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_ES.png
i.sentinel.preproc
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_preproc_GWF.png

Kind regards,
Roberta

Thank you Moritz for your support!!

Roberta

···

2018-08-13 12:06 GMT+02:00 Moritz Lennert <mlennert@club.worldonline.be>:

Great work, Roberta !

Thanks for these two very useful modules !

Moritz

On 13/08/18 10:20, Roberta Fagandini wrote:

Hi all!
I’m Roberta Fagandini and this is the final report of my GSoC project.

The title of the project is “GRASS GIS module for Sentinel-2 cloud and shadow detection”. It adds new tools for the processing of Sentinel 2 images to GRASS GIS software (Organization: OSGeo).

Abstract:
Optical sensors are unable to penetrate clouds leading to related anomalous reflectance values. Unlike Landsat images, Sentinel 2 datasets do not include thermal and Quality Assessment bands that simplify the detection of clouds avoiding erroneous classification. At the same time, also clouds shadows on the ground lead to anomalous reflectance values which have to be taken into account during the image processing.
The project creates a specific module for GRASS GIS application (i.sentinel.mask) which implements an automatic procedure for clouds and shadows detection for Sentinel 2 images. The procedure is based on an algorithm, developed within my PhD research, which allows to automatically identify clouds and their shadows applying some rules on reflectance values (values thresholds, comparisons between bands, etc.). These have been defined starting from rules found in literature and conveniently refined. In order to increase the accuracy of the final results, a control check is implemented. Clouds and shadows are spatially intersected in order to remove misclassified areas. The final outputs are two different vector maps (OGR standard formats), one for clouds and one for shadows.
To run i.sentinel.mask, the bands of the desired Sentinel 2 images have to be imported and the atmospheric correction has to be applied.
In order to make the data preparation easier, another GRASS GISaddonmodule has been developed within the GSoC project.
i.sentinel.preprocis a module for the preprocessing of Sentinel 2 images (Level-1C Single Tile product) which wraps the import and the atmospheric correction using respectively two existing GRASS GIS modules, i.sentinel.import and i.atcorr.

The state of the art before the project:
Before this GSoC 2018 project, no modules for the detection of clouds and shadows were available for Sentinel 2 images. Only a specific module for Landsat automatic cloud coverage assessment was available within GRASS GIS (i.landsat.acca) while regarding shadows, no specific module was available.
Moreover, performing the atmospheric correction was a bit complicated especially for unexperiencedusers who have to process one band at a time and provide all input parameters manually.

The added value that the project brought to GRASS GIS:
Now a specific module for clouds and shadows detection, i.sentinel.mask,is available in GRASS GIS.
Moreover, i.sentinel.preprocprovides a simplified module which allows importing images and performing the atmospheric correction avoiding users to supply all the required input parameters manually. The module should help users in preparing data to use as input for i.sentinel.mask. In fact, it makes especially the atmospheric correction procedure easier and faster because it allows performing atmospheric correction of all bands of a Sentinel 2 scene with a single process and it retrieves most of the required input parameters from the image itself. Moreover, one of the possible output of i.sentinel.preprocis a text file to be used as input for i.sentinel.mask.

Follow up:
Both i.sentinel.mask and i.sentinel.preprocare complete and working modules which can be easily installed with g.extension from the official GRASS GIS SVN repository.
Obviously, they can be improved therefore the next steps could be:

  • Implementation of other existing algorithms of clouds and shadows
    detection (i.sentinel.mask)
  • Implementation of a new download procedure avoiding dependencies
    (i.sentinel.preproc)
  • Integration of the Topographic Correction (i.sentinel.preproc)

NOTE: Implementation of other existing algorithms of clouds and shadows detection was one of the possible goals of the GSoC project but the codingand debuggingof some parts of the twoaddonsrequired more time than expected.

Permanent links:
*
*
/Code developed during the GSoC coding period: /
https://github.com/RobiFag/GRASS_clouds_and_shadows <https://github.com/RobiFag/GRASS_clouds_and_shadows>

/Codes on the official GRASS GIS SVN repository:/
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.mask <https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.mask>
https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.preproc <https://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.sentinel.preproc>

/Documentation:/
https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html <https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html>
https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.preproc.html <https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.preproc.html>

/Weekly reports: /
https://trac.osgeo.org/grass/wiki/GSoC/2018/CloudsAndShadowsDetection <https://trac.osgeo.org/grass/wiki/GSoC/2018/CloudsAndShadowsDetection>

/Images to showcase the project:/
i.sentinel.mask
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_GWF.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_GWF.png>
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CD.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CD.png>
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_SD.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_SD.png>
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CS.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_CS.png>
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_ES.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_mask_ES.png>
i.sentinel.preproc
https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_preproc_GWF.png <https://raw.githubusercontent.com/RobiFag/GRASS_clouds_and_shadows/master/images/i_sentinel_preproc_GWF.png>

Kind regards,
Roberta

Roberta,
Thank you for this work!
Doug

···

Doug Newcomb - Cartographer
USFWS
551F Pylon Dr
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

__NOTE: This email correspondence and any attachments to and from this sender is subject to the Freedom of Information Act (FOIA) and may be disclosed to third parties.__​

Hi Roberta,

The title of the project is "GRASS GIS module for Sentinel-2 cloud >and

shadow detection". It adds new tools for the processing of >Sentinel 2
images to GRASS GIS software (Organization: OSGeo).

Thanks for the nice addon!

Does your addon also work with already atmospheric corrected sentinel data
by other software, or is the step with i.sentinel.preproc needed?

Is there maybe a workflow with such data documented in the wiki?

-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html

Hi Helmut,

···

2018-08-21 18:46 GMT+02:00 Helmut Kudrnovsky <hellik@web.de>:

Hi Roberta,

The title of the project is “GRASS GIS module for Sentinel-2 cloud >and
shadow detection”. It adds new tools for the processing of >Sentinel 2
images to GRASS GIS software (Organization: OSGeo).

Thanks for the nice addon!

Thank you, I hope it will be useful for the GRASS community!

Does your addon also work with already atmospheric corrected sentinel data
by other software, or is the step with i.sentinel.preproc needed?

Sure, it works with bands corrected with other software. For instance before developing i.sentinel.preproc I used arcsi to correct bands (I also tested i.sentinel.mask with bands corrected using Qgis).

It also works with Sentinel images of the L2A level. If I remember correctly Stefan told me to have tested i.sentinel.mask with L2A images obtaining good results.

Is there maybe a workflow with such data documented in the wiki?

you can find more information and a general workflow about the module and the developed algorithm in the manual page [0]. Hope this helps!!

[https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html]

kind regards

Roberta


best regards
Helmut

Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Helmut,

···

2018-08-21 19:52 GMT+02:00 Roberta Fagandini <robifagandini@gmail.com>:

Hi Helmut,

sorry, I thought you were referring to my GSoC wiki page but maybe I understood what you meant for ‘wiki’ [0]. I will add the documentation about i.sentinel.mask and i.sentinel.preproc in the next days.

Kind regards,

Roberta

[0] https://grasswiki.osgeo.org/wiki/SENTINEL

2018-08-21 18:46 GMT+02:00 Helmut Kudrnovsky <hellik@web.de>:

Hi Roberta,

The title of the project is “GRASS GIS module for Sentinel-2 cloud >and
shadow detection”. It adds new tools for the processing of >Sentinel 2
images to GRASS GIS software (Organization: OSGeo).

Thanks for the nice addon!

Thank you, I hope it will be useful for the GRASS community!

Does your addon also work with already atmospheric corrected sentinel data
by other software, or is the step with i.sentinel.preproc needed?

Sure, it works with bands corrected with other software. For instance before developing i.sentinel.preproc I used arcsi to correct bands (I also tested i.sentinel.mask with bands corrected using Qgis).

It also works with Sentinel images of the L2A level. If I remember correctly Stefan told me to have tested i.sentinel.mask with L2A images obtaining good results.

Is there maybe a workflow with such data documented in the wiki?

you can find more information and a general workflow about the module and the developed algorithm in the manual page [0]. Hope this helps!!

[https://grass.osgeo.org/grass74/manuals/addons/i.sentinel.mask.html]

kind regards

Roberta


best regards
Helmut

Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev