eolearn.mask.snow_mask

Module for snow masking

class eolearn.mask.snow_mask.BaseSnowMaskTask(*args, **kwargs)[source]

Bases: eolearn.core.eotask.EOTask

Base class for snow detection and masking

Parameters
  • data_feature (tuple(FeatureType, str)) – EOPatch feature represented by a tuple in the form of (FeatureType, ‘feature_name’)

  • band_indices (list(int)) – A list containing the indices at which the required bands can be found in the data_feature.

  • dilation_size (int) – Size of the disk in pixels for performing dilation. Value 0 means do not perform this post-processing step.

execute(eopatch)[source]

Implement execute function

class eolearn.mask.snow_mask.SnowMaskTask(*args, **kwargs)[source]

Bases: eolearn.mask.snow_mask.BaseSnowMaskTask

The task calculates the snow mask using the given thresholds.

The default values were optimised based on the Sentinel-2 L1C processing level. Values might not be optimal for L2A processing level

Parameters
  • data_feature (tuple(FeatureType, str)) – EOPatch feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the bands 2, 3, 7, 11, i.e. (FeatureType.DATA, ‘BANDS’)

  • band_indices (list(int)) – A list containing the indices at which the required bands can be found in the data_feature. The required bands are B03, B04, B08 and B11 and the indices should be provided in this order. If the ‘BANDS’ array contains all 13 L1C bands, then band_indices=[2, 3, 7, 11]. If the ‘BANDS’ are the 12 bands with L2A values, then band_indices=[2, 3, 7, 10]

  • ndsi_threshold (float) – Minimum value of the NDSI required to classify the pixel as snow

  • brightness_threshold (float) – Minimum value of the red band for a pixel to be classified as bright

NDVI_THRESHOLD = 0.1
execute(eopatch)[source]

Implement execute function

class eolearn.mask.snow_mask.TheiaSnowMaskTask(*args, **kwargs)[source]

Bases: eolearn.mask.snow_mask.BaseSnowMaskTask

Task to add a snow mask to an EOPatch. The input data is either Sentinel-2 L1C or L2A level

Original implementation and documentation available at https://gitlab.orfeo-toolbox.org/remote_modules/let-it-snow

ATBD https://gitlab.orfeo-toolbox.org/remote_modules/let-it-snow/blob/master/doc/atbd/ATBD_CES-Neige.pdf

This task computes a snow mask for the input EOPatch. The data_feature to be used as input to the classifier is a mandatory argument. If all of the needed features exist already, the classifier is run. linear interpolation is used for resampling of the data_feature and cloud probability map, while nearest interpolation is used to upsample the binary cloud mask.

Parameters
  • data_feature (tuple(FeatureType, str)) –

    EOPatch feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the bands B3, B4, and B11

    Example: (FeatureType.DATA, ‘ALL-BANDS’)

  • band_indices (list(int)) – A list containing the indices at which the required bands can be found in the bands feature. If all L1C band values are provided, band_indices=[2, 3, 11]. If all L2A band values are provided, then band_indices=[2, 3, 10]

  • cloud_mask_feature (tuple(FeatureType, str)) – EOPatch CLM feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the cloud mask

  • dem_feature (tuple(FeatureType, str)) – EOPatch DEM feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the digital elevation model

  • b10_index (int) – Array index where the B10 band is stored in the bands feature. This is used to refine the initial cloud mask

  • dem_params ((float, float)) – Tuple with parameters pertaining DEM processing. The first value specifies the bin size used to group DEM values, while the second value specifies the minimum snow fraction in an elevation band to define z_s. With reference to the ATBD, the tuple is (d_z, f_t)

  • red_params ((float, float, float, float, float)) – Tuple specifying parameters to process the B04 red band. The first parameter defines the scaling factor for down-sampling the red band, the second parameter is the maximum value of the down-sampled red band for a dark cloud pixel, the third parameter is the minimum value to return a non-snow pixel to the cloud mask, the fourth is the minimum reflectance value to pass the 1st snow test, and the fifth is the minimum reflectance value to pass the 2nd snow test. With reference to the ATBD, the tuple is (r_f, r_d, r_b, r_1, r_2)

  • ndsi_params ((float, float, float)) – Tuple specifying parameters for the NDSI. First parameter is the minimum value to pass the 1st snow test, the second parameter is the minimum value to pass the 2nd snow test, and the third parameter is the minimum snow fraction in the image to activate the pass 2 snow test. With reference to the ATBD, the tuple is (n_1, n_2, f_s)

B10_THR = 0.015
DEM_FACTOR = 1e-05
execute(eopatch)[source]

Run multi-pass snow detection

class eolearn.mask.snow_mask.SnowMask(*args, **kwargs)[source]

Bases: eolearn.mask.snow_mask.SnowMaskTask

A deprecated version of SnowMaskTask

Parameters
  • data_feature (tuple(FeatureType, str)) – EOPatch feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the bands 2, 3, 7, 11, i.e. (FeatureType.DATA, ‘BANDS’)

  • band_indices (list(int)) – A list containing the indices at which the required bands can be found in the data_feature. The required bands are B03, B04, B08 and B11 and the indices should be provided in this order. If the ‘BANDS’ array contains all 13 L1C bands, then band_indices=[2, 3, 7, 11]. If the ‘BANDS’ are the 12 bands with L2A values, then band_indices=[2, 3, 7, 10]

  • ndsi_threshold (float) – Minimum value of the NDSI required to classify the pixel as snow

  • brightness_threshold (float) – Minimum value of the red band for a pixel to be classified as bright

class eolearn.mask.snow_mask.TheiaSnowMask(*args, **kwargs)[source]

Bases: eolearn.mask.snow_mask.TheiaSnowMaskTask

A deprecated version of TheiaSnowMaskTask

Parameters
  • data_feature (tuple(FeatureType, str)) –

    EOPatch feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the bands B3, B4, and B11

    Example: (FeatureType.DATA, ‘ALL-BANDS’)

  • band_indices (list(int)) – A list containing the indices at which the required bands can be found in the bands feature. If all L1C band values are provided, band_indices=[2, 3, 11]. If all L2A band values are provided, then band_indices=[2, 3, 10]

  • cloud_mask_feature (tuple(FeatureType, str)) – EOPatch CLM feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the cloud mask

  • dem_feature (tuple(FeatureType, str)) – EOPatch DEM feature represented by a tuple in the form of (FeatureType, ‘feature_name’) containing the digital elevation model

  • b10_index (int) – Array index where the B10 band is stored in the bands feature. This is used to refine the initial cloud mask

  • dem_params ((float, float)) – Tuple with parameters pertaining DEM processing. The first value specifies the bin size used to group DEM values, while the second value specifies the minimum snow fraction in an elevation band to define z_s. With reference to the ATBD, the tuple is (d_z, f_t)

  • red_params ((float, float, float, float, float)) – Tuple specifying parameters to process the B04 red band. The first parameter defines the scaling factor for down-sampling the red band, the second parameter is the maximum value of the down-sampled red band for a dark cloud pixel, the third parameter is the minimum value to return a non-snow pixel to the cloud mask, the fourth is the minimum reflectance value to pass the 1st snow test, and the fifth is the minimum reflectance value to pass the 2nd snow test. With reference to the ATBD, the tuple is (r_f, r_d, r_b, r_1, r_2)

  • ndsi_params ((float, float, float)) – Tuple specifying parameters for the NDSI. First parameter is the minimum value to pass the 1st snow test, the second parameter is the minimum value to pass the 2nd snow test, and the third parameter is the minimum snow fraction in the image to activate the pass 2 snow test. With reference to the ATBD, the tuple is (n_1, n_2, f_s)