In order to study the growth pattern of crops, I tried to smoothen the Sentinel-1 time series graph using the following code but got the error.


ImageCollection (Error)
ImageCollection.reduce: Error in map(ID=null):
Image.select: Can't add a band named 'VV' to image because a band with this name already exists. Existing bands: [VV].


Map.addLayer(Bhagwanpur, {}, 'Bhagwanpur', false)
Map.centerObject(Bhagwanpur, 12)
Map.addLayer(GT, {}, 'March GT', false)

var CreateBuffer = function(feature, buffer_size) {
  return feature.buffer(buffer_size)

var buffer_size= 20

var GT_Buffer = GT.map(function(ft){return CreateBuffer(ft, buffer_size)});
Map.addLayer(GT_Buffer, {}, 'GT_Buffer')
Map.centerObject(GT_Buffer, 15)


// Importing the Sentinel-1 Images:
var Sen= ee.ImageCollection("COPERNICUS/S1_GRD")
          .filterDate('2021-05-01', '2022-07-15')
          .select (['VV','VH'])
          .filter(ee.Filter.eq('instrumentMode', 'IW'))


var addVVbyVH = function(image) {
  var vv = image.select('VV');
  var vh = image.select('VH');
  var VVbyVH = (vv).divide(vh).rename('VVbyVH');
  return image.addBands(VVbyVH);

var Sen = Sen.map(addVVbyVH);

//Visualization of Images: 
Map.addLayer(Sen.first().clip(Bhagwanpur), {'min': [-25, -20, 0], 'max': [5, -10, 5]}, 'S1 RGB', false)

/*------------------------------------------Smoothen the Sentinel-1 graph------------------------------------------------------------------*/

function smoother(t){
  // helper function to apply linear regression equation
  function applyFit(img){
      return img.select('VV').multiply(fit.select('scale')).add(fit.select('offset'))
  t = ee.Date(t);
  var window = Sen.filterDate(t.advance(-windowSize,'month'),t.advance(windowSize,'month'));
  var fit = window.select(['VV','VV'])
  return window.map(applyFit).toList(5);

// function to reduce time stacked linear regression results
// requires that a variable 'fitIC' exists from the smooter function

function reduceFits(t){
  t = ee.Date(t);
  return fitIC.filterDate(t.advance(-windowSize,'day'),t.advance(windowSize,'day'))

var dates = Sen.aggregate_array('system:time_start');

var windowSize = 1; //days on either sides

var fitIC = ee.ImageCollection(dates.map(smoother).flatten());

var smoothed = ee.ImageCollection(dates.map(reduceFits));
// print('smoothed',smoothed)

// var smooth_mos = smoothed.mosaic()

// merge original and smoothed data into one image collection for plotting
// var joined = ee.ImageCollection(smoothed.select(['vv'],['smoothed'])
//                 .merge(Sen.select(['vv'],['original'])));

/*------------------------------------// Plot the Graph----------------------------------------*/

var scale = smoothed.first().projection().nominalScale();

print("scale", scale);

var chartvv = ui.Chart.image.seriesByRegion(
     GT_Buffer.filter(ee.Filter.eq('Field_ID', 5)),
var chartv2 = chartvv.setSeriesNames(['VV'])
          title: 'Sentinel-1 time series',
          hAxis: {title: 'Date', titleTextStyle: {italic: false, bold: true}},
          vAxis: {
            title: 'dB values',
            titleTextStyle: {italic: false, bold: true}
          lineWidth: 5,
          colors: ['#fc0303', '#17fc03','#0324fc'],
          curveType: 'function'

Code link: https://code.earthengine.google.co.in/6f7665b85f5fe82319ebdb9e04141c74

1 Answer 1


Line 57:

var fit = window.select(['VV','VV'])

You can't select the same band twice. Perhaps you meant to use 'VH' for the second band.

  • I'm not able to remove that noise in the graph.
    – Reflex_180
    Aug 8, 2022 at 16:49

Your Answer

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

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