Area under the curve of Sentinel-2 time-serie using GEE

Smoothed values (73; as number of elements in smoothed Image Collection) from CSV file were converted in a list variable at the beginning of following code. As these values have a spacing of 5 days then, the value of h is 5 in following lines.

var smoothed = [0.3,0.317,0.379,0.452,0.519,0.573,0.61,0.629,0.628,0.613,0.587,0.556,0.521,
                0.485,0.448,0.411,0.363,0.317,0.273,0.227,0.185,0.148,0.12,0.103,0.093,0.086,
                0.082,0.079,0.076,0.071,0.066,0.059,0.053,0.051,0.052,0.057,0.067,0.081,0.103,
                0.129,0.165,0.209,0.252,0.292,0.328,0.363,0.398,0.431,0.459,0.479,0.491,0.494,
                0.488,0.475,0.457,0.43,0.397,0.357,0.316,0.285,0.254,0.227,0.206,0.189,0.181,
                0.171,0.157,0.151,0.162,0.192,0.239,0.302,0.397];

var n = ee.List(smoothed).size().subtract(1);
print("number of values", n.add(1));

var h = 5;

var serverList = ee.List.sequence(1, n, 2);

print(serverList);

serverList = serverList.map(function(n){

  n = ee.Number(n).int();
  var n_sub = n.subtract(1);
  var n_add = n.add(1);

  var sum = ee.Number.expression(
      '(h/3)*(v1 + 4*v2 + v3)',{
      'v1': ee.List(smoothed).get(n_sub),
      'v2': ee.List(smoothed).get(n),
      'v3': ee.List(smoothed).get(n_add),
      'h': h
      }
    );
  
  return sum;
  
});

var area = ee.List(serverList).reduce(ee.Reducer.sum());

print("area under the curve (AUC)", ee.Number(area).format('%.2f'));
This entry was posted in Google Earth Engine. Bookmark the permalink.

3 Responses to Area under the curve of Sentinel-2 time-serie using GEE

  1. Hello, sir. I am a beginner in GEE. You helped me a lot with my SEBAL model which I need for my work. It is uncomfortable for me to ask all the time via gisstack. I need some guidance to complete my model. DO you do online consultation for money? Said Baha

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s