TransWikia.com

GEE Tile error: Expected a homogeneous image collection, but an image with incompatible bands was encountered:

Geographic Information Systems Asked by Kenobi Obi-Wan on May 21, 2021

I’m having the problem of Tile error: Expected a homogeneous image collection, but an image with incompatible bands was encountered. Since number of total S-2 bands have changed during time, what can we do to solve this, when we don’t even need to use that 2 new ones?

std all: Tile error: Expected a homogeneous image collection, but an image with incompatible bands was encountered:
  First image type: 21 bands ([B1, B2, B3, B4, B5, B6, B7, B8, B8A, B9, B11, B12, AOT, WVP, SCL, TCI_R, TCI_G, TCI_B, QA10, QA20, QA60]).
Current image type: 23 bands ([B1, B2, B3, B4, B5, B6, B7, B8, B8A, B9, B11, B12, AOT, WVP, SCL, TCI_R, TCI_G, TCI_B, MSK_CLDPRB, MSK_SNWPRB, QA10, QA20, QA60]).
          Image ID: null
var datasetall = ee.ImageCollection('COPERNICUS/S2_SR')
                 .filterDate('2017-05-01', '2020-09-30')                  
                  .filterBounds(polygon);

var medall = datasetall.median();
var resultall = medall.select('B4', 'B8');
var ndviall = resultall.normalizedDifference(['B8', 'B4']);

var palette = ['FF0000', 'ffa500', 'FFFF00', '4CA64C', '207401'];

var stdall = medall.reduce(ee.Reducer.stdDev());

Map.addLayer(stdall.clip(polygon), {min: 0, max: 0.2, palette: palette}, 'std all');   

var ndvi_all = datasetall.map(
    function(img) {
         return img.normalizedDifference(['B8','B4'])
                  .rename('NDVI')
                  .copyProperties(img, ['system:time_start']);    });   
  
print(ui.Chart.image.series(ndvi_all, polygon, ee.Reducer.stdDev(), 10, 'system:time_start' ));

One Answer

Use .select(bandNames) to select only the bands you need before the reduction (in the definition of datasetall).

var datasetall = ee.ImageCollection('COPERNICUS/S2_SR')
    .filterDate('2017-05-01', '2020-09-30')                  
    .filterBounds(polygon)
    .select([
      // Make this list whichever bands you want to view or analyze
      'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8',
    ]);

Answered by Kevin Reid on May 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP