1

I'm trying to compute chlorophyll-a concentration of the Tanganyika Lake with Sentinel 3. I'm facing an issue when trying : my results are constant values all over the study time. Here is my code :

var dataset = ee.ImageCollection('COPERNICUS/S3/OLCI')
                  .filterDate('2017-10-17', '2018-03-16')
                  .filterBounds(geometry2);

// Select bands for visualization and apply band-specific scale factors.
var rgb = dataset.select(['Oa08_radiance', 'Oa06_radiance', 'Oa04_radiance'])
              .median()
              // Convert to radiance units.
              .multiply(ee.Image([0.00876539, 0.0123538, 0.0115198]));

var visParams = {
  min: 0,
  max: 6,
  gamma: 1.5,
};

Map.setCenter(46.043, 1.45, 5);
Map.addLayer(rgb, visParams, 'RGB');

var dataset_mosaic = dataset.mosaic()
print(dataset)
//BRI
var chl_BRI = dataset_mosaic.expression(
  'B9/B11', {
    'B9': dataset_mosaic.select('Oa09_radiance'),
    'B11' : dataset_mosaic.select('Oa11_radiance')
  }).rename('BRI');
  
var BRI = dataset.map(
  function adddate (image){
  var date = image.get('system:time_start');
  var dA = chl_BRI
  return dA.set('system:time_start', date);
});

var title_BRI = {
  title: 'Chlorophyll-a Concentration BRI',
  hAxis: {title: 'Time'},
  vAxis: {title: 'mg/m^3'},
};

var chart_BRI = ui.Chart.image.series
(BRI, geometry2, ee.Reducer.mean(), 30)
    .setOptions(title_BRI)
    .setChartType('ColumnChart');
print('Chlorophyll-a Concentration');
print(chart_BRI);
  
//NDCI
var chl_NDCI = dataset_mosaic.expression(
  '(B11-B9)/(B11+B9)', {
    'B9': dataset_mosaic.select('Oa09_radiance'),
    'B11' : dataset_mosaic.select('Oa11_radiance')
  }).rename('NDCI');
 
var NDCI = dataset.map(
  function adddate (image){
  var date = image.get('system:time_start');
  var dA = chl_NDCI
  return dA.set('system:time_start', date);
});

var title_NDCI = {
  title: 'Chlorophyll-a Concentration NDCI',
  hAxis: {title: 'Time'},
  vAxis: {title: 'mg/m^3'},
};

var chart_NDCI = ui.Chart.image.series
(NDCI, geometry2, ee.Reducer.mean(), 30)
    .setOptions(title_NDCI)
    .setChartType('ColumnChart');
print('Chlorophyll-a Concentration');
print(chart_NDCI);

//NFHI
var chl_NFHI = dataset_mosaic.expression(
  'B10/B9', {
    'B9': dataset_mosaic.select('Oa09_radiance'),
    'B10' : dataset_mosaic.select('Oa10_radiance')
  }).rename('NFHI');
  
var NFHI = dataset.map(
  function adddate (image){
  var date = image.get('system:time_start');
  var dA = chl_NFHI
  return dA.set('system:time_start', date);
});

var title_NFHI = {
  title: 'Chlorophyll-a Concentration NFHI',
  hAxis: {title: 'Time'},
  vAxis: {title: 'mg/m^3'},
};

var chart_NFHI = ui.Chart.image.series
(NFHI, geometry2, ee.Reducer.mean(), 30)
    .setOptions(title_NFHI)
    .setChartType('ColumnChart');
print('Chlorophyll-a Concentration');
print(chart_NFHI);

//TBI
var chl_TBI = dataset_mosaic.expression(
  '(1/B9-1/B11)*B12', {
    'B9': dataset_mosaic.select('Oa09_radiance'),
    'B11' : dataset_mosaic.select('Oa11_radiance'),
    'B12' : dataset_mosaic.select('Oa12_radiance')
  });
  
var TBI = dataset.map(
  function adddate (image){
  var date = image.get('system:time_start');
  var dA = chl_TBI
  return dA.set('system:time_start', date);
});

var title_TBI = {
  title: 'Chlorophyll-a Concentration TBI',
  hAxis: {title: 'Time'},
  vAxis: {title: 'mg/m^3'},
};

var chart_TBI = ui.Chart.image.series
(TBI, geometry2, ee.Reducer.mean(), 30)
    .setOptions(title_TBI)
    .setChartType('ColumnChart');
print('Chlorophyll-a Concentration');
print(chart_TBI);

//Add layers
Map.addLayer(BRI, visParams, 'BRI');
Map.addLayer(NDCI, visParams, 'NDCI');
Map.addLayer(NFHI, visParams, 'NFHI');
Map.addLayer(TBI, visParams, 'TBI');

And here are the results I got : enter image description here

enter image description here

enter image description here

enter image description here

1 Answer 1

0

This probably doesn't do what you want it too:

var BRI = dataset.map(
  function adddate(image) {
    var date = image.get('system:time_start')
    var dA = chl_BRI
    return dA.set('system:time_start', date)
  }
)

You are mapping over dataset, but instead of calculating BRI for each image, you replace each image with the pre-calculated chl_BRI. You end up with a time-series with the same value. You are doing this with the other indexes too.

With out knowing the details, I'm guessing you want to do something like this:

var BRI = dataset.map(
  function (image) {
    var date = image.get('system:time_start')
    var dA = image.expression(
      'B9/B11', {
        'B9': image.select('Oa09_radiance'),
        'B11': image.select('Oa11_radiance')
      }).rename('BRI')
    return dA.set('system:time_start', date)
  }
)

https://code.earthengine.google.com/e87bad9da7b1a42863141bae1c09705b

1
  • Thanks a lot ! It's very helpfull. But now when I change the time_start and the time_end I have the following error : Error generating chart: Projection error: Unable to compute intersection of geometries in projections EPSG:32649: affine [246.95965156838372, 0.0, -131336.00551900768, 0.0, -246.95965156838372, 9649107.998250436] and EPSG:4326: affine [1.0, 0.0, 0.0, 0.0, 1.0, 0.0] (abstract projection) Do you have any idea why ? Aug 29, 2023 at 7:27

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.