Skip to content

Module fordead.steps.step3_dieback_detection

Functions

dieback_detection

def dieback_detection(
    data_directory,
    threshold_anomaly=0.16,
    max_nb_stress_periods=5,
    stress_index_mode=None,
    vi=None,
    path_dict_vi=None,
    progress=True
)
Detects anomalies by comparing the vegetation index and its prediction from the model. 
Detects pixels suffering from dieback when there are 3 successive anomalies. If pixels detected as suffering from dieback have 3 successive dates without anomalies, they are considered healthy again.
If stress_index_mode parameter is given, information on those periods between detection and return to normal are saved, with the date of first anomaly, date of return to normal, number of dates, an associated stress index, and the total number of those periods.
Anomalies and dieback data are written in the data_directory
See details here : https://fordead.gitlab.io/fordead_package/docs/user_guides/english/03_dieback_detection/


Parameters
----------
data_directory : str
    Path of the output directory
threshold_anomaly : float
    Minimum 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
    Chosen stress index, 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 informations on stress periods are saved.
vi : str
    Chosen vegetation index, only useful if step1 was skipped
path_dict_vi : str
    Path of text file to add vegetation index formula, only useful if step1 was skipped
progress : bool, optional
    Whether to show a progress bar. Defaults to True.
Returns
-------