Skip to content
Snippets Groups Projects
Commit 7dac8d39 authored by Christophe974's avatar Christophe974
Browse files

MAJ documentation

parent bdbac341
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,22 @@ From Downloading L1C to computing radiometric indices
Downloading L1C Product
-----------------------
A function allows tiles to be downloaded at L1C level according to a set of parameters, which the most important are :
- **provider** (Default to peps): EO products provider.
- **download** (Default to True): Download condition. When False only search and returns L1C products available.
- **dl_mode** (Default to "multit" for multithreading.): Download mode among sequential, multiprocessing or multithreading.
- **start** (Default to "2015-01-01"): Period of Interest first date.
- **end** (Default to "9999-12-31"): Period of Interest last date.
- **min_cloudcover** (Default to 0): Cloudcover minimum threshold value to filter searched products.
- **max_cloudcover** (Default to 0): Cloudcover maximmum threshold value to filter searched products.
The python reference guide gives all the possible parameters for this function.
In the following case, the line of code will launch the download of the 40KCB tile from 2022-01-01 on the PEPS provider, selecting images that are less than 80% cloudy.
.. code-block:: python
Tile("40KCB").get_l1c(provider='peps', start='2022-01-01', max_cloudcover=80)
Computing products
......@@ -25,19 +40,18 @@ Three functions are used to compute the different products from downloaded raw L
For all 3, the process is the same: entire database is scanned to identify a list of missing products for which the computing will be done.
In case of no missing products, nothing is done. Each function has its own set of specific parameters (see details bellow), with these in common:
- _date_min_ and _date_max_: the date after, date before, or time range between which the missing products will be computed. Default values _None_ results in the entire database being scanned.
- _reprocess (boolean)_: possibility to reprocess already computed products. Default value _False_.
- _nb_proc_: All products in the process list are computed using multiprocessing to reduce processing time. Default value is 4, to increase according to your hardware. Limited by the number of cores of your processor.
- **date_min and _date_max**: the date after, date before, or time range between which the missing products will be computed. Default values _None_ results in the entire database being scanned.
- **reprocess (boolean)**: possibility to reprocess already computed products. Default value _False_.
- **nb_proc**: All products in the process list are computed using multiprocessing to reduce processing time. Default value is 4, to increase according to your hardware. Limited by the number of cores of your processor.
### Computing L2A
This function is used to compute missing L2A for L1C products present in the local database. Possibility to specify dates or reprocessing, see parameters above.
```python
>>> Tile("40KCB").compute_l2a()
>>> Tile("40KCB").compute_l2a(date_min="2019-01-01", nb_proc=12)
43780:2021-10-06 13:05:17:INFO:sen2chain.tiles:All l2a products already computed
```
.. code-block:: python
Tile("40KCB").compute_l2a()
Tile("40KCB").compute_l2a(date_min="2019-01-01", nb_proc=12)
### Computing cloudmasks
......@@ -53,10 +67,10 @@ This function computes missing cloudmasks for L2A products present in local data
The output cloudmask is named according to cloudmask version and the set of parameters, and produced only if not already present.
```python
>>> Tile("40KCB").compute_cloudmasks()
>>> Tile("40KCB").compute_cloudmasks(cm_version="cm004", iterations=2, cld_shad=False, thin_cir=False, nb_proc=8)
```
.. code-block:: python
Tile("40KCB").compute_cloudmasks()
Tile("40KCB").compute_cloudmasks(cm_version="cm004", iterations=2, cld_shad=False, thin_cir=False, nb_proc=8)
### Computing indices
......@@ -64,20 +78,19 @@ This function computes all missing indices for l2a products. Indices are given a
- **nodata_clouds**: Default value _True_, to produce a second set of cloudmasked index images (cloudmasks have to be be present). If not specified CM001 will be used. For CM003 & CM004, other CM specific parameters can be adjusted.
```python
>>> Tile("40KCB").compute_indices(["NDVI"], date_max="2020-12-31" )
>>> Tile("40KCB").compute_indices(["NDVI"], cm_version="cm002", nb_proc=2)
```
.. code-block:: python
Tile("40KCB").compute_indices(["NDVI"], date_max="2020-12-31" )
Tile("40KCB").compute_indices(["NDVI"], cm_version="cm002", nb_proc=2)
### Computing quicklooks
You can compute quicklooks for multiple provided tiles for L1C and/or L2A products. If no tile provided, whole L1C + L2A product database is used. Possibility to set specific output QL resolution (default 750m/px). Possibility to set output format JPEG (default) or TIFF.
```python
>>> Tile("40KCB").compute_ql(product_list = ["l2a"],
.. code-block:: python
Tile("40KCB").compute_ql(product_list = ["l2a"],
resolution = 100,
jpg = False)
```
## Database information and management
......@@ -85,79 +98,82 @@ You can compute quicklooks for multiple provided tiles for L1C and/or L2A produc
You can get informations on the number of files in database, downloaded l1c, and produced l2a, cloudmasks and indices using the _info_ function.
```python
>>> t.info
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:l1c: 344
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:l2a: 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:cloud_masks: 625
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndwigao (raw / masked): 345 / 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:bigr (raw / masked): 345 / 349
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:birnir (raw / masked): 215 / 211
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ireci (raw / masked): 2 / 2
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndwimcf (raw / masked): 345 / 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:bibg (raw / masked): 211 / 211
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndvi (raw / masked): 345 / 352
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndre (raw / masked): 11 / 4
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:mndwi (raw / masked): 54 / 57
```
.. code-block:: python
t.info
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:l1c: 344
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:l2a: 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:cloud_masks: 625
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndwigao (raw / masked): 345 / 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:bigr (raw / masked): 345 / 349
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:birnir (raw / masked): 215 / 211
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ireci (raw / masked): 2 / 2
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndwimcf (raw / masked): 345 / 345
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:bibg (raw / masked): 211 / 211
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndvi (raw / masked): 345 / 352
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:ndre (raw / masked): 11 / 4
43780:2021-10-06 12:53:34:INFO:sen2chain.tiles:mndwi (raw / masked): 54 / 57
### Size
The _size_ function retrieves the used disk space for each kind of product. Execution can take time, depending on database size, disk or network speed. Local and archived disk spaces are analysed.
```python
>>> t.size
43780:2021-10-06 12:53:41:INFO:sen2chain.tiles:l1c: 198GB (local: 44GB / archived: 154GB)
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:l2a: 258GB (local: 65GB / archived: 192GB)
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndwigao: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:bigr: 24GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:birnir: 15GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ireci: 324MB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndwimcf: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:bibg: 15GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndvi: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndre: 791MB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:mndwi: 4GB
```
.. code-block:: python
t.size
43780:2021-10-06 12:53:41:INFO:sen2chain.tiles:l1c: 198GB (local: 44GB / archived: 154GB)
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:l2a: 258GB (local: 65GB / archived: 192GB)
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndwigao: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:bigr: 24GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:birnir: 15GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ireci: 324MB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndwimcf: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:bibg: 15GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndvi: 25GB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:ndre: 791MB
43780:2021-10-06 12:53:45:INFO:sen2chain.tiles:mndwi: 4GB
## Listing products
Different functions are called to retrieve a list all database products :
```python
>>> t.l1c # list downloaded l1c indice products
>>> t.l2a # list l2a indice products
>>> t.cloudmasks # list cloudmask products
>>> t.ndvi # list ndvi indice products
>>> t.ndwigao # list ndwi Gao indice products
>>> t.mndwi # list mndwi indice products
```
.. code-block:: python
t.l1c # list downloaded l1c indice products
t.l2a # list l2a indice products
t.cloudmasks # list cloudmask products
t.ndvi # list ndvi indice products
t.ndwigao # list ndwi Gao indice products
t.mndwi # list mndwi indice products
As a ProductList class this retrieved list of products can be reduced using multiples functions :
```python
>>> t.l2a.products # list of product names
>>> t.l2a.dates # list of product dates
>>> t.l2a.first # the first (oldest) product in database
>>> t.l2a.last # the last (newest) product in database
.. code-block:: python
>>> t.l2a.filter_dates(date_min = "yyyy-mm-dd", date_max = "yyyy-mm-dd") # list of products between date_min and date_max
>>> t.l2a.filter_dates(date_min = "yyyy-mm-dd") # list of products after date_min
>>> t.l2a.filter_dates(date_max = "yyyy-mm-dd") # list of products before date_max
t.l2a.products # list of product names
t.l2a.dates # list of product dates
t.l2a.first # the first (oldest) product in database
t.l2a.last # the last (newest) product in database
.. code-block:: python
t.l2a.filter_dates(date_min = "yyyy-mm-dd", date_max = "yyyy-mm-dd") # list of products between date_min and date_max
t.l2a.filter_dates(date_min = "yyyy-mm-dd") # list of products after date_min
t.l2a.filter_dates(date_max = "yyyy-mm-dd") # list of products before date_max
.. code-block:: python
>>> t.l2a.filter_clouds(cover_min = 0, cover_max = 100) # list of products with a cloud cover between cover_min and cover_max
>>> t.l2a.filter_clouds(cover_min = 20) # list of products with more than 20% cloud cover
>>> t.l2a.filter_clouds(cover_max = 50) # list of products with less than 50% cloud cover
```
t.l2a.filter_clouds(cover_min = 0, cover_max = 100) # list of products with a cloud cover between cover_min and cover_max
t.l2a.filter_clouds(cover_min = 20) # list of products with more than 20% cloud cover
t.l2a.filter_clouds(cover_max = 50) # list of products with less than 50% cloud cover
Cloudmask and indice lists as CloudMaskList class objects can be reduced using 4 different functions, one for each type of cloud mask :
```python
>>> t.cloudmasks.cm001 # list cloudmask products of type CM001
>>> t.cloudmasks.cm002 # list cloudmask products of type CM002
>>> t.cloudmasks.cm003 # list cloudmask products of type CM003
>>> t.cloudmasks.cm004 # list cloudmask products of type CM004
```
.. code-block:: python
t.cloudmasks.cm001 # list cloudmask products of type CM001
t.cloudmasks.cm002 # list cloudmask products of type CM002
t.cloudmasks.cm003 # list cloudmask products of type CM003
t.cloudmasks.cm004 # list cloudmask products of type CM004
For cloudmasks of types CM003 and CM004 the _params_ function is used to select cloudmasks with specific parameters. See specific wiki page for cloudmasks implementation within Sen2Chain (**_to do_**). Default values are :
......@@ -168,31 +184,31 @@ For cloudmasks of types CM003 and CM004 the _params_ function is used to select
- **cld_hi_prob**: _True_, used with CM004. Boolean value for masking clouds with high probability from 20m Sen2Chain Scene Classification.
- **thin_cir**: _True_, used with CM004. Boolean value for masking thin cirrus clouds from 20m Sen2Chain Scene Classification.
```python
>>> t.cloudmasks.cm003.params() # list cloudmask products of type CM003 with default values
>>> t.cloudmasks.cm003.params(probability = 25) # list cloudmask products of type CM003 with pixel cloud probability of 25%
>>> t.cloudmasks.cm004.params() # list cloudmask products of type CM004 with default values
>>> t.cloudmasks.cm004.params(cld_shad = False) # list cloudmask products of type CM004, without considering cloud shadows
```
.. code-block:: python
t.cloudmasks.cm003.params() # list cloudmask products of type CM003 with default values
t.cloudmasks.cm003.params(probability = 25) # list cloudmask products of type CM003 with pixel cloud probability of 25%
t.cloudmasks.cm004.params() # list cloudmask products of type CM004 with default values
t.cloudmasks.cm004.params(cld_shad = False) # list cloudmask products of type CM004, without considering cloud shadows
Indice lists can be filtered using one of the 3 defined functions: _raws_, _masks_, and _quicklooks_
```python
>>> t.ndvi.raws #list only non masked ndvi indices
>>> t.ndwigao.masks #list only masked ndwi Gao indices (by any mask)
>>> t.ndwigao.masks.cm001 #list only ndwi Gao indices masked by CM001 cloudmasks
>>> t.mndwi.quicklooks #list only mndwi indice quicklooks
```
.. code-block:: python
t.ndvi.raws #list only non masked ndvi indices
t.ndwigao.masks #list only masked ndwi Gao indices (by any mask)
t.ndwigao.masks.cm001 #list only ndwi Gao indices masked by CM001 cloudmasks
t.mndwi.quicklooks #list only mndwi indice quicklooks
## Cleaning corrupted products
Data in image database can sometimes be corrupted during their production, while downloading and unzipping l1c products, computing l2a with Sen2Cor (frequent corruptions with old 2.5.5 Sen2Cor version), cloudmasks or indices. The _clean_lib_ function has been introduced to check for data integrity, with the possibility to remove corrupted products (whole SAFE folder). Removed products have to be downloaded / computed again.
```python
>>> t.clean_lib() # Check corrupted products (remove nothing)
.. code-block:: python
t.clean_lib() # Check corrupted products (remove nothing)
{'problems': [], 'identified_problems': 0, 'removed_problems': 0}
>>> t.clean_lib(remove = True) # Check and remove corrupted products
```
t.clean_lib(remove = True) # Check and remove corrupted products
## Archiving products
......@@ -204,11 +220,11 @@ The _size_only_ option offers the possibility to get the info, whithout moving a
Every moved SAFE folder is replaced by its symlink in the original product folder. L2A SAFE products can be moved only if there is no file error (_clean_lib_ function automatically performed first).
```python
>>> t.archive_l1c() # Archive L1C products
>>> t.archive_l2a(size_only = True) # Checking L2A products ready to archive (nothing moved)
>>> t.archive_all() # Chaining L1C and L2A archive functions
```
.. code-block:: python
t.archive_l1c() # Archive L1C products
t.archive_l2a(size_only = True) # Checking L2A products ready to archive (nothing moved)
t.archive_all() # Chaining L1C and L2A archive functions
## Removing products
......@@ -216,8 +232,8 @@ Two functions offers the possibility to remove the entire L1C or L2A products fr
**!!! To use with care !!!**
```python
>>> t.remove_l1c()
>>> t.remove_l2a(identifier_list = list)
```
.. code-block:: python
t.remove_l1c()
t.remove_l2a(identifier_list = list)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment