0

I want to apply atmospheric correction on Sentinel-2 imagery in Google Earth Engine(GEE). I saw the Sammurphy code which is written in Python and unfortunately it did not work for me. I tried the dark pixel subtraction method using the code(Java) below but it results in a total dark image over my region of interest.

I am new to both Earth Engine and JavaScript. Has anyone tried using the dark pixel subtraction or any other atmospheric correction on Sentinel 2 imagery in GEE (preferably a code written in Java)?

var toa=maskedComposite1;
var thresh= 0.5;

var dark=findDarkPixels(toa, thresh)
print(dark);


//Function to find dark pixels from threshold on sum of NIR, SWIR1, & SWIR2 bands
//Returns classified image with binary [0,1] 'dark' band
// toa: Sentinel 2 image converted to surface radiance
// thresh: threshold (0.2 - 0.5) value for sum of NIR, SWIR1 & SWIR2 bands
function findDarkPixels(toa, thresh) {
  var darkPixels1 = toa.select(['B8','B11','B12']);
  var darkPixels = darkPixels1.reduce(ee.Reducer.sum()).lt(thresh);
  var filtered = darkPixels.focal_mode(0.1, 'square', 'pixels');
  Map.addLayer(filtered,{},'darkPixel');
  return filtered.rename(['dark']);
}
Sandu
  • 9
  • 2

1 Answers1

0

If you do not need specific atmospheric correction then you can use the Level-2A Sentinel-2 data already available in GEE. Here is the link to dataset info. The atmospheric correction for this data set is performed by sen2cor. Note the time period the data are available for as Level-2A data is not available for the entire data archive.

Agris
  • 16
  • 1
  • Thanks Agris for your comment. Currently, I am trying to implement atmospheric correction on S2 imagery(using Level 1C -TOA) of varying spatial and temporal scales. So, I assume it is best to apply the atmospheric correction myself instead of using the surface reflectance (Level 2A- BOA) directly due to image unavailability at interested regions and time periods as you pointed out. – Sandu Jul 07 '20 at 19:20