Skip to main content

EnMAP Improved Cloud and Cloud Shadow (EnICCS) masking pipeline

Project description

EniCCS banner
DOI License Python GitHub release

EnICCS is a tool for generating improved cloud and cloud shadow masks for EnMAP L2A scenes over land surfaces.

For details please refer to the accompanying paper.

Table of Contents


Background

Current operational cloud and cloud shadow masks often fail to detect small clouds and cloud shadows and lack proper cloud boundary delineation. Residual clouds and cloud shadows can significantly distort spectral signatures, such that the recorded signal no longer corresponds to the expected ‘clear-sky’ measurement of the observed surface. This, in turn, compromises any downstream analysis.

About EnICCS

EnICCS intends to improve existing cloud and cloud shadow masks through a series of steps.

  1. Operational masks are refined using a combination of narrowband indices, thresholding and masking.
  2. The refined masks are then used to fit a simple PLS-DA model to classify the respective scene.
  3. Predictions are post-processed with a simple cloud-to-shadow matching routine.

The overall workflow is illustrated below: workflow

EnICCS is simple to use with a single function call and requires only the directory path of the EnMAP L2A data as input.

Various parameters can be adjusted to improve performance while implementation level changes can help adapt the tool to different regions and surface types. For more details see the paper and customization section.

Example

Some exemplary pairs of EnMAP images with operational (left) and EnICCS masks (right) respectively:

Example Mask comparison

Installation

You can install EnICCS from GitHub or using pip:

pip install eniccs
# or
pip install git+https://github.com/leleist/eniccs.git

Usage

To use EnICCS, you can import it and run the main wrapper function with default parameters.
Just provide the directory path of the EnMAP L2A data on a tile-by-tile basis, i.e., as provided by DLR.

from eniccs import run_eniccs

dir_path = r"path/to/your/EnMAP/TIFFS"  

# simple call with default parameters
run_eniccs(dir_path)

# new cloud and cloudshadow masks will be saved to "dir_path"

Please note: EnICCS currently accepts two file types, TIFF and BSQ, with extensions (.TIFF, .TIF, .tiff, .tif, .BSQ, .bsq)

Note on Transferability:

EnICCS was developed and tested on EnMAP scenes over tropical western Kenya. Application to regions with differing surface characteristics may require adjustments. The code structure allows for some optimization with available parameters and simple adaptation, leveraging expert knowledge and/or visual inspection. For more details see the accompanying paper and Customization.

Customization

EnICCS has two points of contact for customization:

1. Parameter Adjustments

The following parameters can be adjusted when calling the run_eniccs function:

run_eniccs(
     dir_path: str,                     # path to EnMAP L2A data
     save_output: bool = True,          # save output masks
     return_mask_obj: bool = False,     # return mask object
     auto_optimize: bool = False,       # optimize the number of latent variables for PLS-DA automatically
     verbose: bool = False,             # print progress messages
     plot: bool = False,                # plot informative plots
     smooth_output: bool = True,        # apply conservative morphological processing for smooting the output masks
     contamination: float = 0.25,       # contamination parameter for LOF outlier detection
     percentile: int = 85,              # percentile for cloud-to-shadow matching routine distance threshold
     num_samples: int = 3000,           # number of samples for PLS-DA training
     buffer_size: int = 1,              # Buffer size for dilation of CCS mask outputs.
     n_jobs: int = -1,                  # number of parallel jobs (CPU)
     random_state: int = 42,            # random state for class balancing and data splitting
     output_dir: str = None,            # alterbative output directory for saving the new masks (if None, saves to dir_path)
)

2. Implementation Level Changes

The main module contains functions for mask refinement i.e. improve_cloud_mask_over_land and improve_cloud_shadow_mask as well as a wrapper refine_ccs_masks that integrates the two prior functions into the overall workflow. These functions can be modified. Here, bands, indices and thresholds can be changed to suit the surfaces of interest. Classification and post-processing steps can stay untouched in this scenario.

In the context of supervised ML classification, we recall the garbage-in-garbage-out principle. Thus, the quality of the refined masks used for training is crucial for the performance of the PLS-DA model, despite the available post-processing steps.

Contributions

Contributions are welcome!
Specifically regarding band indices and thresholds for different surface types (Desert, Snow, Urban).

Planned Features

  • "no reference data" mode for using EnICCS as a standalone cloud masking tool, without existing operational masks.
  • Selectable surface-type presets (e.g., tropical, desert, snow, urban) with band indices and thresholds for mask refinement.

EnMAP Cloud and Cloud Shadow Benchmarking Dataset

We provide the hand-drawn "gold standard" reference masks for five EnMAP scenes used in the accompanying paper as a benchmarking dataset on Zenodo 10.5281/zenodo.17350339.
For tile-wise performance metrics, please consult the paper supplemental information.

Citation

Please cite the accompanying paper and Zenodo sources:

Leander Leist, Boris Thies, Jörg Bendix, Evaluation and improvement of EnMAP’s cloud and cloud-shadow masks – An application in tropical western Kenya, International Journal of Applied Earth Observation and Geoinformation, Volume 144, 2025, 104914, ISSN 1569-8432, https://doi.org/10.1016/j.jag.2025.104914, https://www.sciencedirect.com/science/article/pii/S1569843225005618.

Funding and Acknowledgements

This work was funded by the German Space Agency at DLR via the German Federal Ministry of Economic Affairs and Climate Action under Grant 50EE2303A.

Illustrations contain EnMAP data and modified EnMAP data © DLR [2023, 2024]. All rights reserved.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eniccs-0.2.4.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eniccs-0.2.4-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file eniccs-0.2.4.tar.gz.

File metadata

  • Download URL: eniccs-0.2.4.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for eniccs-0.2.4.tar.gz
Algorithm Hash digest
SHA256 f0c8f92962671f6c03c51c88d3654c5898caf9f083484baeba02caf3544671f2
MD5 4910ec7d19c79fa7629d2a4b91c0a0cc
BLAKE2b-256 6d93f6ca53128f365aac4071cc4240f9b93e6502357d9d31349313f96b24d05c

See more details on using hashes here.

File details

Details for the file eniccs-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: eniccs-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for eniccs-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 96f8c1c6fc8c6c831eb2227dd89073f92c500ad003c114289b48ae46ba547311
MD5 d531094930dd6dc3eb044e42847f5118
BLAKE2b-256 62220a4cccf6411d28a89c63b58fc8416f4d6984aa75b2a9357fa1010d1e5eec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page