The s2cloudless Python package provides automated cloud detection in Sentinel-2 imagery. The classification is based on a single-scene pixel-based cloud detector developed by Sentinel Hub's research team and is described in more details in this blog.
The package requires a Python version >= 3.5. The package is available on the PyPI package manager and can be installed with
$ pip install s2cloudless
To install the package manually, clone the repository and
$ python setup.py build
$ python setup.py install
The package requires the following Python packages: (versions listed are the versions that we have used):
- numpy version 1.13.3
- scipy version 0.19.1
- scikit-learn version 0.19.0
- scikit-image version 0.13.0
- matplotlib version 2.1.0
- LightGBM version 2.0.11
The versions listed above are the versions, which we have used for testing and for which we can confirm the cloud detector works properly. It's very likely that the cloud detector works with other versions of these packages. See the Test section below on how you can check your environment.
The input to cloud detector are Sentinel-2 images. In particular, the cloud detector requires the following 10
Sentinel-2 band reflectances: B01, B02, B04, B05, B08, B8A, B09, B10, B11, B12, which are obtained from raw
reflectance value in the following way: Bi/10000
.
You don't need to worry about any of this, if you're doing classification of scenes obtained using Sentinel Hub's WMS or WCS services (i.e. using ours Python library sentinelhub-py).
Please test the cloud detector after the installation by performing a classification on a test scene provided with this package. To execute it do the following:
>>> import s2cloudless
>>> s2cloudless.test_sentinelhub_cloud_detector()
In case your installation is fine and cloud detector works properly you should get the following output:
INFO:s2cloudless.test_cloud_detector:Test OK.
Cloud probabilities and cloud masks match templates.
Jupyter notebook on how to use the cloud detector to produce cloud mask or cloud probability map can be found in the examples folder.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.