![COPERNICUS/S2_CLOUD_PROBABILITY](https://developers.google.com/earth-engine/datasets/images/COPERNICUS/COPERNICUS_S2_CLOUD_PROBABILITY_sample.png)

Dataset Availability
:   2015-06-27T00:00:00Z--2026-11-11T13:12:41Z

Dataset Producer
:


    [European Union/ESA/Copernicus/SentinelHub](https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/processing-levels/level-1)

Revisit Interval
:   5 Days

Tags
:
    [cloud](https://developers.google.com/earth-engine/datasets/tags/cloud.md.txt) [copernicus](https://developers.google.com/earth-engine/datasets/tags/copernicus.md.txt) [esa](https://developers.google.com/earth-engine/datasets/tags/esa.md.txt) [eu](https://developers.google.com/earth-engine/datasets/tags/eu.md.txt) [msi](https://developers.google.com/earth-engine/datasets/tags/msi.md.txt) [radiance](https://developers.google.com/earth-engine/datasets/tags/radiance.md.txt) [satellite-imagery](https://developers.google.com/earth-engine/datasets/tags/satellite-imagery.md.txt) [sentinel](https://developers.google.com/earth-engine/datasets/tags/sentinel.md.txt) sentinelhub

#### Description

The S2 cloud probability is created with the
[sentinel2-cloud-detector](https://github.com/sentinel-hub/sentinel2-cloud-detector)
library (using [LightGBM](https://github.com/microsoft/LightGBM)).
All bands are upsampled using bilinear interpolation to 10m resolution
before the gradient boost base algorithm is applied. The resulting
`0..1` floating point probability is scaled to `0..100` and stored as
an UINT8. Areas missing any or all of the bands are masked out.
Higher values are more likely to be clouds or highly reflective surfaces
(e.g. roof tops or snow).

Sentinel-2 is a wide-swath, high-resolution, multi-spectral
imaging mission supporting Copernicus Land Monitoring studies,
including the monitoring of vegetation, soil and water cover,
as well as observation of inland waterways and coastal areas.

The Level-2 data can be found in the collection
[COPERNICUS/S2_SR_HARMONIZED](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_SR_HARMONIZED.md.txt). The Level-1B data can be found in the collection
[COPERNICUS/S2_HARMONIZED](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_HARMONIZED.md.txt). Additional metadata is available on assets in those
collections.

See
[this tutorial](https://developers.google.com/earth-engine/tutorials/community/sentinel-2-s2cloudless.md.txt)
explaining how to apply the cloud mask.

### Bands

**Bands**

Pixel size: 10 meters (all bands)

| Name | Min | Max | Pixel Size | Description |
|---|---|---|---|---|
| `probability` | 0 | 100 | 10 meters | Probability that the pixel is cloudy. |

### Terms of Use

**Terms of Use**

The use of Sentinel data is governed by the [Copernicus
Sentinel Data Terms and Conditions.](https://scihub.copernicus.eu/twiki/pub/SciHubWebPortal/TermsConditions/Sentinel_Data_Terms_and_Conditions.pdf)

### Explore with Earth Engine

> [!NOTE]
> **Important:** Earth Engine is a platform for petabyte-scale scientific analysis and visualization of geospatial datasets, both for public benefit and for business and government users. Earth Engine is free to use for research, education, and nonprofit use. To get started, please [register for Earth Engine access.](https://console.cloud.google.com/earth-engine)

### Code Editor (JavaScript)

```javascript
var s2Sr = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED');
var s2Clouds = ee.ImageCollection('COPERNICUS/S2_CLOUD_PROBABILITY');

var START_DATE = ee.Date('2019-01-01');
var END_DATE = ee.Date('2019-03-01');
var MAX_CLOUD_PROBABILITY = 65;
var region =
    ee.Geometry.Rectangle({coords: [-76.5, 2.0, -74, 4.0], geodesic: false});
Map.setCenter(-75, 3, 12);

function maskClouds(img) {
  var clouds = ee.Image(img.get('cloud_mask')).select('probability');
  var isNotCloud = clouds.lt(MAX_CLOUD_PROBABILITY);
  return img.updateMask(isNotCloud);
}

// The masks for the 10m bands sometimes do not exclude bad data at
// scene edges, so we apply masks from the 20m and 60m bands as well.
// Example asset that needs this operation:
// COPERNICUS/S2_CLOUD_PROBABILITY/20190301T000239_20190301T000238_T55GDP
function maskEdges(s2_img) {
  return s2_img.updateMask(
      s2_img.select('B8A').mask().updateMask(s2_img.select('B9').mask()));
}

// Filter input collections by desired data range and region.
var criteria = ee.Filter.and(
    ee.Filter.bounds(region), ee.Filter.date(START_DATE, END_DATE));
s2Sr = s2Sr.filter(criteria).map(maskEdges);
s2Clouds = s2Clouds.filter(criteria);

// Join S2 SR with cloud probability dataset to add cloud mask.
var s2SrWithCloudMask = ee.Join.saveFirst('cloud_mask').apply({
  primary: s2Sr,
  secondary: s2Clouds,
  condition:
      ee.Filter.equals({leftField: 'system:index', rightField: 'system:index'})
});

var s2CloudMasked =
    ee.ImageCollection(s2SrWithCloudMask).map(maskClouds).median();
var rgbVis = {min: 0, max: 3000, bands: ['B4', 'B3', 'B2']};

Map.addLayer(
    s2CloudMasked, rgbVis, 'S2 SR masked at ' + MAX_CLOUD_PROBABILITY + '%',
    true);
```
Python setup

See the [Python Environment](https://developers.google.com/earth-engine/guides/python_install.md.txt) page for information on the Python API and using
`geemap` for interactive development.

```python
import ee
import geemap.core as geemap
```

### Colab (Python)

```python
s2_sr = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
s2_clouds = ee.ImageCollection('COPERNICUS/S2_CLOUD_PROBABILITY')

start_date = ee.Date('2019-01-01')
end_date = ee.Date('2019-03-01')
max_cloud_probability = 65
region = ee.Geometry.Rectangle(
    coords=[-76.5, 2.0, -74, 4.0], geodesic=False, proj='EPSG:4326'
)


def maskClouds(img):
  clouds = ee.Image(img.get('cloud_mask')).select('probability')
  is_not_cloud = clouds.lt(max_cloud_probability)
  return img.updateMask(is_not_cloud)


# The masks for the 10m bands sometimes do not exclude bad data at
# scene edges, so we apply masks from the 20m and 60m bands as well.
# Example asset that needs this operation:
# COPERNICUS/S2_CLOUD_PROBABILITY/20190301T000239_20190301T000238_T55GDP
def maskEdges(s2_img):
  return s2_img.updateMask(
      s2_img.select('B8A').mask().updateMask(s2_img.select('B9').mask())
  )


# Filter input collections by desired data range and region.
criteria = ee.Filter.And(
    ee.Filter.bounds(region), ee.Filter.date(start_date, end_date)
)
s2_sr = s2_sr.filter(criteria).map(maskEdges)
s2_clouds = s2_clouds.filter(criteria)

# Join S2 SR with cloud probability dataset to add cloud mask.
s2_sr_with_cloud_mask = ee.Join.saveFirst('cloud_mask').apply(
    primary=s2_sr,
    secondary=s2_clouds,
    condition=ee.Filter.equals(
        leftField='system:index', rightField='system:index'
    ),
)

s_2_cloud_masked = (
    ee.ImageCollection(s2_sr_with_cloud_mask).map(maskClouds).median()
)

rgb_vis = {'min': 0, 'max': 3000, 'bands': ['B4', 'B3', 'B2']}

m = geemap.Map()
m.set_center(-75, 3, 12)
m.add_layer(
    s_2_cloud_masked,
    rgb_vis,
    'S2 SR masked at ' + str(max_cloud_probability) + '%',
    True,
)
m
```
[Open in Code Editor](https://code.earthengine.google.com/?scriptPath=Examples:Datasets/COPERNICUS/COPERNICUS_S2_CLOUD_PROBABILITY) [Sentinel-2: Cloud Probability](https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_CLOUD_PROBABILITY.md.txt) The S2 cloud probability is created with the sentinel2-cloud-detector library (using LightGBM). All bands are upsampled using bilinear interpolation to 10m resolution before the gradient boost base algorithm is applied. The resulting 0..1 floating point probability is scaled to 0..100 and stored as an UINT8. Areas missing any or all ... COPERNICUS/S2_CLOUD_PROBABILITY, cloud,copernicus,esa,eu,msi,radiance,satellite-imagery,sentinel 2015-06-27T00:00:00Z/2026-11-11T13:12:41Z -56 -180 83 180 Google Earth Engine https://developers.google.com/earth-engine/datasets

- [](https://doi.org/https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/processing-levels/level-1)
- [](https://doi.org/https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_CLOUD_PROBABILITY)