Comments (3)
When I ran the same location on code.earthengine.google.com using the code boilerplate from https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_S2_SR, the cloud was not masked at all. Is this a bug or am I missing something?
Thanks,
Daniel
/**
* Function to mask clouds using the Sentinel-2 QA band
* @param {ee.Image} image Sentinel-2 image
* @return {ee.Image} cloud masked Sentinel-2 image
*/
function maskS2clouds(image) {
var qa = image.select('QA60');
// Bits 10 and 11 are clouds and cirrus, respectively.
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
.and(qa.bitwiseAnd(cirrusBitMask).eq(0));
return image.updateMask(mask).divide(10000);
}
var point = ee.Geometry.Point([150.5773, -28.1182])
var dataset = ee.ImageCollection('COPERNICUS/S2_SR')
.filterDate('2022-04-01', '2022-04-06')
.filterBounds(point)
// Pre-filter to get less cloudy granules.
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',50))
.map(maskS2clouds);
var visualization = {
min: 0.0,
max: 0.3,
bands: ['B4', 'B3', 'B2'],
};
Map.setCenter(150.5773, -28.1182,15);
Map.addLayer(dataset.mean(), visualization, 'RGB');
from eemont.
Apparently I added unmask() after clipping the imagecollection to an ROI that was why the mask was replaced by zero.
from eemont.
Don't worry! :)
from eemont.
Related Issues (20)
- Extended methods for the ee.Image class cannot be thrown to map HOT 4
- Would it be nice to expose the s2cloudless algorithm to Sentinel-2 Level 1C data? HOT 1
- ee.Geometry.Point does not accept varargs after importing eemont HOT 4
- COPERNICUS/S2_HARMONIZED HOT 3
- MODIS/061/MOD09A1 HOT 4
- What visParams should i use for al lthe indices available in spectral indices? HOT 1
- index() function not working HOT 1
- getTimeSeriesByRegion returns empty and repeated dates in dataframe HOT 1
- MODIS/061/MOD09A1 HOT 2
- tasseled cap transformation for COPERNICUS/S2_SR HOT 1
- Support for computing indices for Sentinel-1 HOT 3
- "system:id" disappears following maskClouds() that subsequently leads to the error of scaleAndOffset() HOT 1
- some methods and modules do not work HOT 5
- getTimeSeriesByRegion returns repeated and empty dates in time series HOT 2
- preprocess() left quite a few cloud shaddow HOT 1
- Timeseries in Sentinel S1 Index HOT 11
- .preprocess() failed for the new COPERNICUS/S2_SR_HARMONIZED HOT 4
- Add HLSL30 Data HOT 1
- Incomplete exports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eemont.