javascriptgoogle-mapsgoogle-earth-enginelandsatsentinel2

Why is Sentinel-2 Map coming out Black on Google Earth Engine


I am taking a look at the FIRMS dataset on the Google Earth Engine and I'd like to see Sentinel-2 images corresponding to forest fires on FIRMS, but for some reason it comes out either very dark or, when I filter the date to September 10-13th, completely black, as in the picture below (the blue square is the geometry polygon). I've changed the bands on the Sentinel-2 layer to B2, B3, and B4 (which are Blue, Green, and Red).

What am I doing wrong? When I followed a GEE tutorial with Landsat-8 the map also looked very dark, but at least it was visible.

var S2 = ee.ImageCollection("COPERNICUS/S2");
var geometry = ee.Geometry.Polygon(
        [[[-120.810853515625, 48.516417129055526],
          [-120.810853515625, 47.25667221452654],
          [-118.00933984375, 47.25667221452654],
          [-118.00933984375, 48.516417129055526]]], null, false);
var dataset = ee.ImageCollection('FIRMS').filter(
    ee.Filter.date('2020-09-12', '2020-09-13'));
var fires = dataset.select('T21');
var firesVis = {
  min: 325.0,
  max: 400.0,
  palette: ['red', 'orange', 'yellow'],
};
Map.setCenter(-119.086, 47.295, 6);
Map.addLayer(fires, firesVis, 'Fires');
var S2_selection = S2.filterBounds(geometry)
                     .filterDate('2020-09-10', '2020-09-13');
Map.addLayer(S2_selection);

enter image description here


Solution

  • The bands of S2 have 16-bit integer values, which means the default visualization range is the full numerical range of 0 to 65535 (216 − 1), but the actual values in this region are much smaller than that. You need to set visualization parameters with a more appropriate minimum and maximum. You can do this in the Range section of the layer options you already found, but if you specify them in the script they'll stick around:

    Map.addLayer(S2_selection, {
      bands: ['B4', 'B3', 'B2'], 
      min: 0,
      max: 2000,
    });