Skip to content

CLI Reference

This page provides documentation for our command line tools.

fordead

fordead - Remote sensing time series processing to detect forest anomalies

The usual workflow is : masked_vi --> train_model --> dieback_detection --> forest_mask --> export_results

Usage:

fordead [OPTIONS] COMMAND [ARGS]...

Options:

  --version  Show the version and exit.
  --help     Show this message and exit.

fordead calval_dieback_detection

Updates of the csv file containing periods, so for each pixel, the whole time series is covered with the first and last unmasked Sentinel-2 acquisition date of each period, and its associated state. The 'state' column can now hold the following values :

- Training : Period used in training the harmonic model
- Healthy : Period detected as healthy, with no stress, dieback or bare ground detected
- Stress : Period beginning with 3 successive anomalies, ending with the last anomaly before three successive non-anomalies of the beginning of a 'Healthy' period.
- Dieback : Period beginning with 3 successive anomalies, ending with the last available acquisition, or the beggining of a Bare ground period.
- Invalid : The pixel is invalid, there were not enough valid acquisitions to compute a harmonic model

A new column 'anomaly_intensity' is also added, it is a weighted mean of the difference between the calculated vegetation indices and their predicted value for the period. The weight is the number of the date within that period (1+2+3+...+ nb_dates). It is only calculated for 'Healthy', 'Stress' and 'Dieback' periods

if 'update_masked_vi' is True, this function also updates the csv at 'masked_vi_path' with the following columns:

- period_id : id of the period the acquisition is associated with
- state : Status of of the associated period, can be 'Training', 'Healthy', 'Stress', 'Dieback' or 'Invalid'.
- predicted_vi : The prediction of the vegetation index using the harmonic model
- diff_vi : Difference between the vegetation and its prediction, in the expected direction of anomalies for the vegetation index
- anomaly : True if 'diff_vi' exceeds 'threshold_anomaly', else False

See additional information here

Usage:

fordead calval_dieback_detection [OPTIONS]

Options:

  --masked_vi_path TEXT          Path of the csv containing the vegetation
                                 index for each pixel of each observation, for
                                 each valid Sentinel-2 acquisition.
  --pixel_info_path TEXT         Path used to write the csv containing pixel
                                 info such as the validity of the model and
                                 its coefficients.
  --periods_path TEXT            Path of the csv containing pixel periods
  --name_column TEXT             Name of the ID column  [default: id]
  --update_masked_vi             If True, updates the csv at masked_vi_path
                                 with the columns 'period_id', 'state',
                                 'predicted_vi', 'diff_vi' and 'anomaly'
  -s, --threshold_anomaly FLOAT  Minimum threshold for anomaly detection
                                 [default: 0.16]
  --stress_index_mode TEXT       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,
                                 no stress period index is computed.
  --vi TEXT                      Chosen vegetation index  [default: CRSWIR]
  --path_dict_vi TEXT            Path to a text file used to add potential
                                 vegetation indices. If not filled in, only
                                 the indices provided in the package can be
                                 used (CRSWIR, NDVI, NDWI). The file [ex_dict_
                                 vi.txt](https://gitlab.com/fordead/fordead_pa
                                 ckage/-/blob/master/docs/examples/ex_dict_vi.
                                 txt) gives an example for how to format this
                                 file. One must fill the index's name,
                                 formula, and '+' or '-' according to whether
                                 the index increases or decreases when
                                 anomalies occur.
  --help                         Show this message and exit.

fordead calval_masked_vi

Computes the vegetation index for each pixel of each observation, for each valid Sentinel-2 acquisition. Filters out data by applying the fordead mask (if soil_detection is True) or a user mask defined by the user. (optional) Filters out acquisition by applying a limit on the percentage of cloud cover as calculated by the extract_cloudiness function Writes the results in a csv file, as well as the first date of the training period for each pixel and, if soil_detection is True, the first date of detected bare ground.

See additional information here

Usage:

fordead calval_masked_vi [OPTIONS]

Options:

  --reflectance_path TEXT     Path of the csv file with extracted reflectance.
  --masked_vi_path TEXT       Path used to write the csv containing the
                              vegetation index for each pixel of each
                              observation, for each valid Sentinel-2
                              acquisition.
  --periods_path TEXT         Path used to write the csv containing the first
                              date of the training periods for each pixel and,
                              if soil_detection is True, the first date of
                              detected bare ground.
  --name_column TEXT          Name of the ID column  [default: id]
  --cloudiness_path TEXT      Path of a csv with the columns
                              'area_name','Date' and 'cloudiness' used to
                              filter acquisitions, can be calculated by the
                              [extract_cloudiness function](https://fordead.gi
                              tlab.io/fordead_package/docs/Tutorials/Validatio
                              n/03_extract_cloudiness/). Not used if not
                              given.
  --vi TEXT                   Chosen vegetation index  [default: CRSWIR]
  -n, --lim_perc_cloud FLOAT  Maximum cloudiness at the tile scale, used to
                              filter used SENTINEL dates. Set parameter as -1
                              to not filter based on cloudiness  [default:
                              0.4]
  --soil_detection            If True, bare ground is detected and used as
                              mask, but the process has not been tested on
                              other data than THEIA data in France (see https:
                              //fordead.gitlab.io/fordead_package/docs/user_gu
                              ides/english/01_compute_masked_vegetationindex/)
                              . If False, mask from formula_mask is applied.
  --formula_mask TEXT         formula whose result would be binary, as
                              described here https://fordead.gitlab.io/fordead
                              _package/reference/fordead/masking_vi/#compute_v
                              egetation_index. Is only used if soil_detection
                              is False.  [default: (B2 >= 700)]
  --path_dict_vi TEXT         Path of text file to add vegetation index
                              formula, if None, only built-in vegetation
                              indices can be used (CRSWIR, NDVI)
  -b, --list_bands LIST       Bands to import and use ex : -b B2 -b  B3 -b B11
                              [default: B2, B3, B4, B5, B6, B7, B8, B8A, B11,
                              B12, Mask]
  --apply_source_mask         If True, applies the mask from SENTINEL-data
                              supplier
  --sentinel_source TEXT      Source of data, can be 'THEIA' et 'Scihub' et
                              'PEPS'  [default: THEIA]
  --ignored_period TEXT       Period whose Sentinel dates to ignore (format
                              'MM-DD', ex : --ignored_period 11-01
                              --ignored_period 05-01
  --help                      Show this message and exit.

fordead calval_train_model

Adjusts an harmonic model to predict the temporal periodicity of the vegetation index, based on the acquisitions of a specified training period.

See additional information here

Usage:

fordead calval_train_model [OPTIONS]

Options:

  --masked_vi_path TEXT          Path of the csv containing the vegetation
                                 index for each pixel of each observation, for
                                 each valid Sentinel-2 acquisition.
  --pixel_info_path TEXT         Path used to write the csv containing pixel
                                 info such as the validity of the model and
                                 its coefficients.
  --periods_path TEXT            Path of the csv containing pixel periods, it
                                 will be updated with the last_date of the
                                 training.
  --name_column TEXT             Name of the ID column  [default: id]
  --min_last_date_training TEXT  The date in YYYY-MM-DD format after which
                                 SENTINEL dates are no longer used for
                                 training, as long as there are at least
                                 nb_min_date dates valid for the pixel
                                 [default: 2018-01-01]
  --max_last_date_training TEXT  Date in YYYY-MM-DD format until which
                                 SENTINEL dates can be used for training to
                                 reach the number of nb_min_date valid dates
                                 [default: 2018-06-01]
  --nb_min_date INTEGER          Minimum number of valid dates to calculate a
                                 model.  [default: 10]
  --help                         Show this message and exit.

fordead dieback_detection

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, Those periods between detection and return to normal are saved, with the date of first anomaly, date of return to normal, number of dates, and an associated stress index. 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/

Usage:

fordead dieback_detection [OPTIONS]

Options:

  -o, --data_directory TEXT       Path of the output directory
  -s, --threshold_anomaly FLOAT   Minimum threshold for anomaly detection
                                  [default: 0.16]
  --max_nb_stress_periods INTEGER
                                  Maximum number of stress periods  [default:
                                  5]
  --stress_index_mode TEXT        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 TEXT                       Chosen vegetation index, only useful if
                                  step1 was skipped
  --path_dict_vi TEXT             Path of text file to add vegetation index
                                  formula, only useful if step1 was skipped
  --help                          Show this message and exit.

fordead export_results

Export results to a vectorized shapefile format.

Usage:

fordead export_results [OPTIONS]

Options:

  -o, --data_directory TEXT       Path of the output directory
  --start_date TEXT               Start date for exporting results  [default:
                                  2015-06-23]
  --end_date TEXT                 End date for exporting results  [default:
                                  2030-01-02]
  --frequency TEXT                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. e.g. 'M'
                                  (monthly), '3M' (three months), '15D'
                                  (fifteen days)  [default: M]
  --multiple_files                If True, one shapefile is exported for each
                                  period containing the areas in dieback at
                                  the end of the period. Else, a single
                                  shapefile is exported containing diebackd
                                  areas associated with the period of dieback
  -t, --conf_threshold_list FLOAT
                                  List of thresholds used as bins to
                                  discretize the confidence index into several
                                  classes
  -c, --conf_classes_list TEXT    List of classes names, if
                                  conf_threshold_list has n values,
                                  conf_classes_list must have n+1 values
  --help                          Show this message and exit.

fordead extract_cloudiness

Usage:

fordead extract_cloudiness [OPTIONS]

Options:

  --sentinel_dir TEXT        Path of the directory containing Sentinel-2 data.
  --export_path TEXT         Path to write csv file with extracted cloudiness
  -t, --tile_selection TEXT  List of tiles from which to extract reflectance
                             (ex : -t T31UFQ -t T31UGQ). If None, all tiles
                             are extracted.
  --sentinel_source TEXT     Source of data, can be 'THEIA' et 'Scihub' et
                             'PEPS'  [default: THEIA]
  --help                     Show this message and exit.

fordead extract_reflectance

Extracts reflectance from Sentinel-2 data using a vector file containing points, exports the data to a csv file. If new acquisitions are added to the Sentinel-2 directory, new data is extracted and added to the existing csv file.

Usage:

fordead extract_reflectance [OPTIONS]

Options:

  --obs_path TEXT              Path to a vector file containing observation
                               points, must have an ID column corresponding to
                               name_column parameter, an 'area_name' column
                               with the name of the Sentinel-2 tile from which
                               to extract reflectance, and a 'espg' column
                               containing the espg integer corresponding to
                               the CRS of the Sentinel-2 tile.
  --sentinel_source TEXT       Can be either 'Planetary', in which case data
                               is downloaded from Microsoft Planetary Computer
                               stac catalogs, or the path of the directory
                               containing Sentinel-2 data.
  --export_path TEXT           Path to write csv file with extracted
                               reflectance
  --cloudiness_path TEXT       Path of a csv with the columns
                               'area_name','Date' and 'cloudiness', can be
                               calculated by the [extract_cloudiness function]
                               (https://fordead.gitlab.io/fordead_package/docs
                               /Tutorials/Validation/03_extract_cloudiness/).
                               Can be ignored if sentinel_source is
                               'Planetary'
  -n, --lim_perc_cloud FLOAT   Maximum cloudiness at the tile scale, used to
                               filter used SENTINEL dates. Set parameter as -1
                               to not filter based on cloudiness  [default:
                               0.4]
  --name_column TEXT           Name of the ID column  [default: id]
  -b, --bands_to_extract LIST  Bands to extract ex : -b B2 -b  B3 -b B11
                               [default: B2, B3, B4, B5, B6, B7, B8, B8A, B11,
                               B12, Mask]
  -t, --tile_selection LIST    List of tiles from which to extract reflectance
                               (ex : -t T31UFQ -t T31UGQ). If None, all tiles
                               are extracted.
  --start_date TEXT            First date of the period from which to extract
                               reflectance.  [default: 2015-01-01]
  --end_date TEXT              Last date of the period from which to extract
                               reflectance.  [default: 2030-01-01]
  --help                       Show this message and exit.

fordead forest_mask

Compute forest mask from IGN's BDFORET or CESBIO's OSO map See details here : https://fordead.gitlab.io/fordead_package/docs/user_guides/english/04_compute_forest_mask/

Usage:

fordead forest_mask [OPTIONS]

Options:

  -o, --data_directory TEXT      Path of the output directory
  -f, --forest_mask_source TEXT  Source of the forest mask, can be 'vector' to
                                 use a vector file at vector_path, or the path
                                 to a binary raster of 10m resolution with the
                                 value 1 on the pixels of interest, 'BDFORET'
                                 to use the BD Foret of the IGN, 'OSO' to use
                                 the CESBIO's land use map, or None to not use
                                 a forest mask and to extend the area of
                                 interest to all pixels
  --dep_path TEXT                Path to shapefile containg departements with
                                 code insee. Optionnal, only used if
                                 forest_mask_source equals 'BDFORET'
  --bdforet_dirpath TEXT         Path to directory containing BD FORET.
                                 Optionnal, only used if forest_mask_source
                                 equals 'BDFORET'
  --list_forest_type TEXT        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'
                                 [default: FF2-00-00, FF2-90-90, FF2-91-91,
                                 FF2G61-61]
  --path_oso TEXT                Path to soil occupation raster, only used if
                                 forest_mask_source = 'OSO'
  --list_code_oso INTEGER        List of values used to filter the soil
                                 occupation raster. Only used if
                                 forest_mask_source = 'OSO'  [default: 17]
  --vector_path TEXT             path of shapefile whose polygons will be
                                 rasterized as a binary raster with
                                 resolution, extent and crs of the raster at
                                 path_example_raster. Only used if
                                 forest_mask_source = 'vector'
  --path_example_raster TEXT     Path to raster from which to copy the extent,
                                 resolution, CRS...
  --help                         Show this message and exit.

fordead graph_series

Export graphs of the time series of the vegetation index for each dates, the model and the detection, for a specific pixel, or a region of interest.

By specifying 'shape_path' and 'name_column' parameters, it can be used with a shapefile containing points with a column containing a unique ID used to name the exported image.

By specifying 'x' and 'y' parameters, it can be used with coordinates in the Sentinel-2 data CRS. If neither shape_path or x and y parameters are specified, the user will be prompted to give coordinates in the system of projection of the tile.

Graphs can also be plotted for random pixels inside the forest mask. The user can also choose to specify pixels by their indices from the top left hand corner of the computed area.

If only a small region of interest was computed (for example by using extent_shape_path parameter in the step 01_compute_masked_vegetationindex), then it creates a timelapse on this region of interest.

The graphs are exported in the data_directory/TimeSeries directory as png files.

See details here : https://fordead.gitlab.io/fordead_package/docs/user_guides/english/Results_visualization

Usage:

fordead graph_series [OPTIONS]

Options:

  -o, --data_directory TEXT  Path of the directory containing results from the
                             region of interest
  -x FLOAT                   x coordinate in the Sentinel-2 data CRS of the
                             pixel of interest. Not used if shape_path
                             parameter is used.
  -y FLOAT                   y coordinate in the Sentinel-2 data CRS of the
                             pixel of interest. Not used if shape_path
                             parameter is used.
  --shape_path TEXT          Path to shapefile containing points whose data
                             will be plotted. If None, indexes or coordinates
                             for x and y can be given
  --name_column TEXT         Name of the column containing the name of the
                             point, used to name the exported image. Not used
                             if pixel is selected from indexes or coordinates
  --ymin FLOAT               ymin limit of graph
  --ymax FLOAT               ymax limit of graph
  --chunks INTEGER           Chunk length to import data as dask arrays and
                             save RAM, advised if computed area in
                             data_directory is large
  --help                     Show this message and exit.

fordead masked_vi

Computes masks and masked vegetation index for each SENTINEL date under a cloudiness threshold. The mask includes pixels ouside satellite swath, some shadows, and the mask from SENTINEL data provider if the option is chosen. Also, if soil detection is activated, the mask includes bare ground detection and cloud detection, but the process might only be adapted to THEIA data in France's coniferous forests. If it is not activated, then the user can choose a mask of his own using the formula_mask parameter. Results are written in the chosen directory. See details here : https://fordead.gitlab.io/fordead_package/docs/user_guides/english/01_compute_masked_vegetationindex/

Usage:

fordead masked_vi [OPTIONS]

Options:

  -i, --input_directory TEXT     Path of the directory with Sentinel dates
  -o, --data_directory TEXT      Path of the output directory
  -n, --lim_perc_cloud FLOAT     Maximum cloudiness at the tile scale, used to
                                 filter used SENTINEL dates. Set parameter as
                                 -1 to not filter based on cloudiness
                                 [default: 0.4]
  --interpolation_order INTEGER  interpolation order for bands at 20m
                                 resolution : 0 = nearest neighbour, 1 =
                                 linear, 2 = bilinéaire, 3 = cubique
                                 [default: 0]
  --sentinel_source TEXT         Source of data, can be 'THEIA' et 'Scihub' et
                                 'PEPS'  [default: THEIA]
  --apply_source_mask            If True, applies the mask from SENTINEL-data
                                 supplier
  --soil_detection               If True, bare ground is detected and used as
                                 mask, but the process has not been tested on
                                 other data than THEIA data in France (see htt
                                 ps://fordead.gitlab.io/fordead_package/docs/u
                                 ser_guides/english/01_compute_masked_vegetati
                                 onindex/). If False, mask from formula_mask
                                 is applied.
  --formula_mask TEXT            formula whose result would be binary, as
                                 described here https://fordead.gitlab.io/ford
                                 ead_package/reference/fordead/masking_vi/#com
                                 pute_vegetation_index. Is only used if
                                 soil_detection is False.  [default: (B2 >=
                                 700)]
  --vi TEXT                      Chosen vegetation index  [default: CRSWIR]
  --compress_vi                  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
  --ignored_period TEXT          Period whose Sentinel dates to ignore (format
                                 'MM-DD', ex : --ignored_period 11-01
                                 --ignored_period 05-01
  --extent_shape_path TEXT       Path of shapefile used as extent of
                                 detection, if None, the whole tile is used
  --path_dict_vi TEXT            Path of text file to add vegetation index
                                 formula, if None, only built-in vegetation
                                 indices can be used (CRSWIR, NDVI)
  --help                         Show this message and exit.

fordead obs_to_s2_grid

Attributes intersecting Sentinel-2 tiles to observation points or polygons, adding their epsg and name. If polygons are used, they are converted to grid points located at the centroid of Sentinel-2 pixels. If points or polygons intersect several Sentinel-2 tiles, they are duplicated for each of them. If some intersect no Sentinel-2 tiles, they are removed and their IDs are printed.

Usage:

fordead obs_to_s2_grid [OPTIONS]

Options:

  --obs_path TEXT            Path to a vector file containing observation
                             points or polygons, must have an ID column
                             corresponding to name_column parameter
  --sentinel_source TEXT     Can be either 'Planetary', in which case the
                             Sentinel-2 grid is infered from Microsoft
                             Planetary Computer stac catalogs, or the path of
                             the directory containing Sentinel-2 data.
  --export_path TEXT         Path used to write resulting vector file, with
                             added 'epsg','area_name' and 'id_pixel' columns
  --name_column TEXT         Name of the ID column  [default: id]
  -t, --tile_selection LIST  A list of names of Sentinel-2 directories. (ex :
                             -t T31UFQ -t T31UGQ). If None, all tiles are
                             used.
  --overwrite                Overwrites file at obs_path
  --help                     Show this message and exit.

fordead preprocess_obs

Used as a preprocessing function for a vector file containing observation points or polygons. Can add an ID column if one does not already exist, and can also apply a buffer to erode or dilate observations.

Usage:

fordead preprocess_obs [OPTIONS]

Options:

  --obs_path TEXT     Path of vector file containing observation points or
                      polygons to preprocess
  --export_path TEXT  Path used to export the resulting preprocessed
                      observation points or polygons
  --buffer INTEGER    Length in meters of the buffer used to dilate (positive
                      integer) or erode (negative integer) the observations.
                      If None, no buffer is applied. Some observations may
                      disappear completely if a negative buffer is applied
  --name_column TEXT  Name of the column used to identify observations. If the
                      column doesn't already exists, it is added as an integer
                      between 1 and the number of observations  [default: id]
  --help              Show this message and exit.

fordead process_tiles

Apply full fordead processing to several tiles: compute_masked_vegetationindex > train_model > dieback_detection > compute_forest_mask > export_results

Usage:

fordead process_tiles [OPTIONS]

Options:

  -i, --sentinel_directory PATH   Path of the directory with a directory
                                  containing Sentinel data for each tile
                                  [required]
  -o, --output_directory PATH     Output directory  [required]
  -t, --tiles TEXT                List of tiles to process : -t T31UGP -t
                                  T31UGQ -t study_area  [required]
  Step 1: compute_masked_vegetationindex arguments: 
    -c, --lim_perc_cloud FLOAT    Maximum cloudiness at the tile or zone
                                  scale, used to filter used SENTINEL dates
    --vi TEXT                     Chosen vegetation index
    --sentinel_source [THEIA|Scihub|PEPS]
                                  Source of Sentinel data: 'THEIA', 'Scihub'
                                  or 'PEPS'
    --apply_source_mask           If activated, applies the mask from
                                  SENTINEL-data provider
    --extent_shape_path PATH      Path of shapefile used as extent of
                                  detection
    --soil_detection              If activated, detects bare ground
    --ignored_period TEXT         Period whose date to ignore (format 'MM-DD',
                                  ex : --ignored_period 11-01 05-01
    --compress_vi                 If activated, 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
  Step 2: train_model arguments: 
    --min_last_date_training TEXT
                                  First date that can be used for detection
    --max_last_date_training TEXT
                                  Last date that can be used for training
    --nb_min_date INTEGER         Minimum number of valid dates reqquired for
                                  modelling the vegetation index
    --correct_vi                  If True, corrects vi using large scale
                                  median vi
  Step 3: dieback_detection arguments: 
    -s, --threshold_anomaly FLOAT
                                  Minimum threshold for anomaly detection
    --max_nb_stress_periods INTEGER
                                  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 [mean|weighted_mean]
                                  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 information is saved
  Step 4: compute_forest_mask arguments: 
     -f, --forest_mask_source TEXT
                                  Source of the forest mask, accepts
                                  'BDFORET', 'OSO', the path to a vector file
                                  or 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 PATH               Path to shapefile containg departements with
                                  code insee. Optionnal, only used if
                                  forest_mask_source equals 'BDFORET'
    --bdforet_dirpath PATH        Path to directory containing BD FORET.
                                  Optionnal, only used if forest_mask_source
                                  equals 'BDFORET'
    --list_forest_type TEXT       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 PATH               Path to soil occupation raster, only used if
                                  forest_mask_source = 'OSO'
    --list_code_oso TEXT          List of values used to filter the soil
                                  occupation raster. Only used if
                                  forest_mask_source = 'OSO'
  Step 5: results_export arguments: 
    --start_date_results TEXT     Start date for results export
    --end_date_results TEXT       End date for results export
    --results_frequency TEXT      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. e.g. 'M'
                                  (monthly), '3M' (three months), '15D'
                                  (fifteen days)
    --multiple_files              If activated, 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
    --path_dict_vi PATH           Path of text file to add vegetation index
                                  formula, if None, only built-in vegetation
                                  indices can be used
    --threshold_list FLOAT        List of thresholds used to classify the
                                  levels of dieback by discretising the
                                  confidence index
    --classes_list TEXT           List of class names for discretising the
                                  confidence index. If threshold_list has
                                  length n, classes_list must have length n+1.
  --help                          Show this message and exit.

fordead read_tileinfo

Prints parameters, all dates used and last anomaly date computed to the console

Usage:

fordead read_tileinfo [OPTIONS]

Options:

  -o, --data_directory TEXT  Path of the output directory containing the saved
                             TileInfo object
  --help                     Show this message and exit.

fordead sensitivity_analysis

Allows the testing of many parameter combinations, running three detection steps mask_vi_from_dataframe, train_model_from_dataframe and dieback_detection_from_dataframe using default parameters as well as user defined parameter combinations. A 'test_info.csv' is written in 'testing_directory', where each test_id is associated with the value of all parameters used in the iteration. Each test results can be found in a newly created directory whose name is the test_id.

See additional information here

Usage:

fordead sensitivity_analysis [OPTIONS]

Options:

  --testing_directory TEXT  Directory where the results will be exported
  --reflectance_path TEXT   Path of the csv file with extracted reflectance.
  --cloudiness_path TEXT    Path of a csv with the columns 'area_name','Date'
                            and 'cloudiness', can be calculated by the
                            [extract_cloudiness function](https://fordead.gitl
                            ab.io/fordead_package/docs/Tutorials/Validation/03
                            _extract_cloudiness/). Not used if not given.
  --args_to_test TEXT       Path to a text file where each line begins
                            parameter name, then each value is separated with
                            a space. All combinations will be tested. See an
                            example [here](https://gitlab.com/fordead/fordead_
                            package/-/blob/master/docs/examples/ex_dict_args.t
                            xt)
  --update_masked_vi        If True, updates the csv at masked_vi_path with
                            the columns 'period_id', 'state', 'predicted_vi',
                            'diff_vi' and 'anomaly'
  --name_column TEXT        Name of the ID column  [default: id]
  --help                    Show this message and exit.

fordead theia_preprocess

Automatically downloads all Sentinel-2 data from THEIA between two dates under a cloudiness threshold. Then this data is unzipped, keeping only chosen bands from Flat REflectance data, and zip files can be emptied as a way to save storage space. Finally, if two Sentinel-2 directories come from the same acquisition date, they are merged by replacing no data pixels from one directory with pixels with data in the other, before removing the latter directory.

Usage:

fordead theia_preprocess [OPTIONS]

Options:

  -i, --zipped_directory TEXT     Path of the directory with zipped theia data
  -o, --unzipped_directory TEXT   Path of the output directory
  -t, --tiles TEXT                Name of the tiles to be downloaded (format :
                                  T31UFQ)
  -u, --login_theia TEXT          Login of your theia account
  -p, --password_theia TEXT       Password of your theia account
  -l, --level [LEVEL1C|LEVEL2A|LEVEL3A]
                                  Product level for reflectance products
                                  [default: LEVEL2A]
  -s, --start_date TEXT           start date, fmt('2015-12-22')  [default:
                                  2015-06-23]
  -e, --end_date TEXT             end date, fmt('2015-12-22'). If None, the
                                  current date is used.
  -n, --lim_perc_cloud INTEGER    Maximum cloudiness in SENTINEL dates
                                  downloaded (%)  [default: 50]
  -b, --bands TEXT                List of bands to extracted (B2, B3, B4, B5,
                                  B6, B7, B8, B8A, B11, B12, as well as CLMR2,
                                  CLMR2, EDGR1, EDGR2, SATR1, SATR2 for
                                  LEVEL2A data, and DTS1, DTS2, FLG1, FLG2,
                                  WGT1, WGT2 for LEVEL3A)  [default: B2, B3,
                                  B4, B5, B6, B7, B8, B8A, B11, B12, CLMR2]
  -c, --correction_type [SRE|FRE|FRC]
                                  Chosen correction type (SRE or FRE for
                                  LEVEL2A data, FRC for LEVEL3A)  [default:
                                  FRE]
  --empty_zip                     If True, the zip files are emptied as a way
                                  to save space.
  -r, --retry INTEGER             Number of retries when downloading data
                                  [default: 3]
  --help                          Show this message and exit.

fordead timelapse

Create timelapse allowing navigation through Sentinel-2 dates with detection results superimposed. By specifying 'shape_path' and 'name_column' parameters, it can be used with a shapefile containing one or multiple polygons or points with a column containing a unique ID used to name the export. By specifying 'x' and 'y' parameters, it can be used by specifying coordinates in the system of projection of the tile. The timelapse is exported in the data_directory/Timelapses directory as an html file.

See details https://fordead.gitlab.io/fordead_package/docs/user_guides/english/Results_visualization

Usage:

fordead timelapse [OPTIONS]

Options:

  -o, --data_directory TEXT     Path of the directory containing results from
                                the region of interest
  --shape_path TEXT             Path of the shapefile of the area, or points,
                                to convert to timelapse. Not used if timelapse
                                made from x and y coordinates
  --name_column TEXT            Name of the column containing the name of the
                                export. Not used if timelapse made from x and
                                y coordinates  [default: id]
  -x, --x INTEGER               Coordinate x in the crs of the Sentinel-2
                                tile. Not used if timelapse is made using a
                                shapefile
  -y, --y INTEGER               Coordinate y in the crs of the Sentinel-2
                                tile. Not used if timelapse is made using a
                                shapefile
  --buffer INTEGER              Buffer around polygons or points for the
                                extent of the timelapse  [default: 100]
  --vector_display_path TEXT    Path of the shapefile with ground observations
  -d, --hover_column_list TEXT  List of columns to display when hovering mouse
                                over vectors of vector_display_path
  --max_date TEXT               Last date used in the timelapse
  --show_confidence_class       If True, detected dieback is shown with the
                                confidence class at the last date used, as
                                vectorized in the step [05_export_results](htt
                                ps://fordead.gitlab.io/fordead_package/docs/us
                                er_guides/english/05_export_results/)
  --zip_results                 If True, puts timelapses in a zip file
  --help                        Show this message and exit.

fordead train_model

Uses first SENTINEL dates to train a periodic vegetation index model capable of predicting the vegetation index at any date. If there aren't nb_min_date at min_last_date_training, later dates between min_last_date_training and max_last_date_training can be used. See details here : https://fordead.gitlab.io/fordead_package/docs/user_guides/english/02_train_model/

Usage:

fordead train_model [OPTIONS]

Options:

  -o, --data_directory TEXT      Path of the output directory
  --nb_min_date INTEGER          Minimum number of valid dates to compute a
                                 vegetation index model for the pixel
                                 [default: 10]
  --min_last_date_training TEXT  First date that can be used for detection
                                 [default: 2018-01-01]
  --max_last_date_training TEXT  Last date that can be used for training
                                 [default: 2018-06-01]
  --correct_vi                   If True, corrects vi using large scale median
                                 vi
  --path_vi TEXT                 Path of directory containing vegetation
                                 indices for each date. If None, the
                                 information has to be saved from a previous
                                 step
  --path_masks TEXT              Path of directory containing masks for each
                                 date.  If None, the information has to be
                                 saved from a previous step
  --help                         Show this message and exit.