Here's my code:
function getSentinel2(){
var cloudSat2 = ee.ImageCollection("COPERNICUS/S2_SR_HARMONIZED") //Get Satelite
.filterBounds(polygonGeoJSON) //Filter to the right place
.filterDate('2018', new Date().getFullYear().toString() + "12" + "31") //Filter from 2018 to current
.sort('system:time_start') //Sort by in chronological order
.map(function(img){
var cloudBit = img.reduceRegion({reducer: ee.Reducer.median(), geometry: polygonGeoJSON}).get('QA60');
print(cloudBit);
if(cloudBit !== 0){
return ee.Feature(null, {
//data: img.normalizedDifference(['B8','B4']).multiply(ee.Image.constant(1.37)).subtract(ee.Image.constant(0.086)).reduceRegion({reducer: ee.Reducer.mean(), geometry: polygonGeoJSON}).get('nd'), //Kc
data: cloudBit,
time: img.get('system:time_start') //Time
});
} else {
return null;
}
}, true);
return cloudSat2;
}
The main thing to focus on is the cloudBit variable. If it is equal to 0, I return null. So, when I chart this FeatureCollection, why do I still have 0 values (among other values)? I can't figure out why 0 and 0 aren't equal to each other. Even if I only get the 0 values, it gives me no values at all.
I'd assume this is something weird with things being shown to me on the front end differently than they are on the backend, but I can't figure it out.