Module fordead.cli.cli_process_tiles
Module grouping the full fordead process in one function and a corresponding command line.
Functions
process_tiles
def process_tiles(
output_directory,
sentinel_directory,
tiles=['study_area'],
lim_perc_cloud=0.3,
vi='CRSWIR',
sentinel_source='THEIA',
apply_source_mask=False,
extent_shape_path=None,
soil_detection=False,
ignored_period=None,
compress_vi=False,
path_dict_vi=None,
min_last_date_training='2018-01-01',
max_last_date_training='2018-06-01',
nb_min_date=10,
correct_vi=False,
threshold_anomaly=0.16,
max_nb_stress_periods=5,
stress_index_mode='weighted_mean',
forest_mask_source='BDFORET',
dep_path=None,
bdforet_dirpath=None,
list_forest_type=['FF2-00-00', 'FF2-90-90', 'FF2-91-91', 'FF2G61-61'],
path_oso=None,
list_code_oso=[17],
start_date_results='2015-06-23',
end_date_results='2022-01-01',
results_frequency='ME',
multiple_files=False,
threshold_list=[0.2, 0.265],
classes_list=['1-Faible anomalie', '2-Moyenne anomalie', '3-Forte anomalie']
)
Apply full fordead processing to several tiles:
compute_masked_vegetationindex > compute_forest_mask > train_model > dieback_detection > export_results
Parameters
----------
output_directory : str
Path of the output directory
sentinel_directory : str
Path of the directory with a directory containing Sentinel data for each tile
tiles : list
List of tiles to process
### compute_masked_vegetationindex arguments ###
lim_perc_cloud : float
Maximum cloudiness at the tile or zone scale, used to filter SENTINEL scenes
vi : str
Chosen vegetation index
sentinel_source : str
Source of Sentinel data: 'THEIA', 'Scihub' or 'PEPS'
apply_source_mask : bool
If True, applies the mask from SENTINEL-data provider
extent_shape_path : str
Path of shapefile used as extent of detection
soil_detection : bool
If True, performs soil detection (bare ground)
ignored_period : list
Period whose Sentinel dates to ignore (format 'MM-DD', ex : ["11-01","05-01"])
compress_vi : bool
If True, stores the vegetation index as low-resolution floating-point data as small integers in a netCDF file.
Uses less disk space but can lead to very small difference in results as the vegetation is rounded to three decimal places
path_dict_vi : str
Path of text file to add vegetation index formula, if None, only built-in vegetation indices can be used
### train_model arguments ###
min_last_date_training : str
First date that can be used for detection
max_last_date_training : str
Last date that can be used for training
nb_min_date : int
Minimum number of valid dates to compute a vegetation index model for the pixel
correct_vi : bool
If True, corrects vi using large scale median vi.
### dieback_detection arguments ###
threshold_anomaly : float
Threshold for anomaly detection
max_nb_stress_periods : int
Maximum number of stress periods. If this number is reached,
the pixel is masked in the too_many_stress_periods,
thus removed from future exports. Only used if stress_index_mode is not None.
stress_index_mode : str
If 'mean', the index is the mean of the difference
between the vegetation index and the predicted vegetation index
for all unmasked dates after the first anomaly subsequently confirmed.
If 'weighted_mean', the index is a weighted mean, where for each date used,
the weight corresponds to the number of the date (1, 2, 3, etc...) from the first anomaly.
If None, the stress periods are not detected, and no information is saved
### compute_forest_mask arguments ###
forest_mask_source : str
Source of the forest mask, accepts 'BDFORET', 'OSO',
the path to a binary raster with the extent and resolution of the computed area,
or None in which case all pixels will be considered valid
dep_path : str
Path to shapefile containg departements with code insee. Optionnal, only used if forest_mask_source equals 'BDFORET'
bdforet_dirpath : str
Path to directory containing BD FORET. Optionnal, only used if forest_mask_source equals 'BDFORET'
list_forest_type : list
List of forest types to be kept in the forest mask, corresponds to the CODE_TFV of the BD FORET. Optionnal, only used if forest_mask_source equals 'BDFORET'
path_oso : str
Path to soil occupation raster, only used if forest_mask_source = 'OSO'
list_code_oso : list
List of values used to filter the soil occupation raster. Only used if forest_mask_source = 'OSO'
### export_results arguments ###
start_date_results : str
Start date for results export
end_date_results : str
End date for results export
results_frequency : str
Frequency used to aggregate results, if value is 'sentinel',
then periods correspond to the period between sentinel dates used in the detection,
or it can be the frequency as used in pandas.date_range.
Examples 'ME' (monthly), '3ME' (three months), '15D' (fifteen days)
multiple_files : bool
If True, one shapefile is exported for each period containing
the areas suffering from dieback at the end of the period.
Else, a single shapefile is exported containing diebackd areas associated with the period of dieback
threshold_list : list
List of thresholds used to classify the levels of dieback by discretising the confidence index
classes_list : list
List of class names for discretising the confidence index.
If threshold_list has length n, classes_list must have length n+1.