Google Earth Engine – Atmospheric Correction for Sentinel 2 Level 1-C

google-earth-enginesentinel-2

So there is a GitHub code by Sam Murphy for doing this: https://github.com/samsammurphy/gee-atmcorr-S2

But I have written all my codes in Java and I don't know python. Is there a way to implement the same code in java? Otherwise, is there a way to run my Java code on the atmospherically corrected images.

Best Answer

I've been looking for a way to correct S2 L1C datasets directly in the GEE code editor. I found this thread that can be of use: https://www.researchgate.net/post/Atmospheric_correction_code_in_Google_Earth_Engine_GEE

The direct link to the code editor from Elias Berra is: https://code.earthengine.google.com/096e7e851a50551463341bf64744324f

 // ---- Area of Interest (AOI) and User parameters
var ground_sensor = ee.Geometry.Point(-52.905090, -28.228550);
var polygon = ground_sensor.buffer(1000).bounds();//
var start_date = '2017-11-15';
var end_date   = '2017-11-30';

var criteria = ee.Filter.and(
    ee.Filter.bounds(ground_sensor), ee.Filter.date(start_date, end_date));
var cloud_perc = 60;//Max cloud percentile per scene.    

// -- Collections of Landsat 7, 8 and Sentinel 2 TOA data
var L8_col = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
                .filter(criteria)
                .filter(ee.Filter.lt('CLOUD_COVER', cloud_perc));

var L7_col = ee.ImageCollection('LANDSAT/LE07/C01/T1_TOA')
                .filter(criteria)
                .filter(ee.Filter.lt('CLOUD_COVER', cloud_perc));

var S2_col = ee.ImageCollection("COPERNICUS/S2")
                .filter(criteria)
                .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', cloud_perc));
                
                
// - Import the SIAC atmospheric correction module
var siac = require('users/marcyinfeng/utils:SIAC');

// - Apply SIAC and retrieve bottom of atmosphere (BOA) reflectance
var L7_boa = siac.get_l7_sur(L7_col.first());
var L8_boa = siac.get_l8_sur(L8_col.first()); 
var S2_boa = siac.get_sur(S2_col.first()); 


// - Check and visualization
var Color_comp_01 = {bands:"B4,B3,B2", min: 0.0, max: 0.2, gamma: 1};
var Color_comp =    {bands:"B4,B3,B2", min:200, max:2000, gamma: 1};
Map.addLayer(S2_col.first(), Color_comp, 'TOA');
Map.addLayer(S2_boa, Color_comp_01, 'BOA');
Map.centerObject(S2_col.first())

Then you can export the images and run your Java code.