I am new to JavaScript in GEE.

I am looking to do an atmospheric correction of Sentinel L1C images between 2016 and 2018, so I can complete my timeseries of BOA images of Sentinel. Using Atmospheric correction for Sentinel 2 level 1-c in the Google Earth Engine Java API) and @EliasBerra's code, I am able to apply a correct atmospheric correction to the first image in my Image Collection.

However, my goal is to achieve an atmospheric correction of my entire Image Collection.For this, I tried to use the map function instead of the first() function, but so far without success.

I would like to be able to make these atmospheric corrections only in GEE without having to download the images.

Here is my code for the moment :

// ---- Area of Interest (AOI) and User parameters
var geometry = ee.FeatureCollection('users/pierrelchn/Sites_Norm');
var start_date = '2016-01-01';
var end_date   = '2018-12-31';

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

// -- Collections of Sentinel 2 TOA data
var S2_col = ee.ImageCollection("COPERNICUS/S2")
                .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 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');

Or here https://code.earthengine.google.com/8a931e8e6e4c64a139cfaabd7161872f

1 Answer 1


If you can apply it to one image, you can apply it to all images with map:

var S2_boa = S2_col.map(function(image){ 
    return siac.get_sur(image);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.