Quick Use Case#
Now that Sen2Chain different products were explained, a simple use case can be introduced :
Note
This example displays the download of a L1C image and the computing of the L2A version according to the user-defined Sen2cor configuration. It is also possible to download L2A images directly from the online catalogs with get_l2a() command, wich is simpler and less time consuming.
If we want to compute the radiometric indices NDVI and NDWIGAO on La Reunion Island (Tile ‘40KCB’), for January 2023 :
First, download the corresponding L1C products :
from sen2chain import Tile
Tile('40KCB').get_l1c(start="2023-01-01",end="2023-01-30")
Note
Tile.get_l1c() method uses EODAG to download products, and cop_dataspace as a default EO data provider.
Then, compute the corresponding L2A Product :
Tile('40KCB').compute_l2a(date_min="2023-01-01",date_max="2023-01-30", nb_proc=6)
This method only computes missing products for the given tile. Reprocessing is available by setting the parameter reprocess to True.
Then, choose and compute a cloudmask :
Here, we go for Cloudmask CM004, with 1 iteration of erosion-dilatation of clouds, and other parameters to default=True
Tile('40KCB').compute_cloudmasks(cm_version='CM004', iterations = 1, date_min="2023-01-01", date_max="2023-01-30", nb_proc=6)
Finally, compute NDVI and NDWIGAO and mask them with CM004 :
Tile('40KCB').compute_indices(indices=['NDVI','NDWIGAO'], cm_version='CM004', iterations = 1, date_min="2023-01-01", date_max="2023-01-30", nb_proc=6)
Multiprocessing#
Depending on your infrastructures, Sen2Chain processes can be launched using multiprocessing. The parameter nb_proc lets you select the correct number of processors you need.