Corrija o erro no script do google earth engine : ImageCollection (Error) List.get,…
- User
Corrija o erro no script do google earth engine : ImageCollection (Error) List.get, argument 'list': Invalid type. Expected type: List. Actual type: ImageCollection. viz_raster . Aqui está o exemplo de script: Map.setOptions('SATELLITE')////"ROADMAP", "SATELLITE", "HYBRID" or "TERRAIN"
var Region = geometry
var runFire = ee.List([1985,1986, 2023, 2024]).map(function(i){
i = ee.Number(i).toInt().format()
// Define time interval to composite scenes var date_start= i.cat("-05-01"); var date_end= i.cat("-07-31");
// Define a function to scale the data and mask unwanted pixels. function maskL457sr(image) { // Bit 0 - Fill // Bit 1 - Dilated Cloud // Bit 2 - Unused // Bit 3 - Cloud // Bit 4 - Cloud Shadow var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0); //var saturationMask = image.select('QA_RADSAT').eq(0);
// Apply the scaling factors to the appropriate bands. var opticalBands = image.select('Red', 'NIR', 'SWIR1', 'SWIR2').multiply(0.0000275).add(-0.2); //var thermalBand = image.select('ST_B.*').multiply(0.00341802).add(149.0);
// Replace the original bands with the scaled ones and apply the masks. return image.addBands(opticalBands, null, true) //.addBands(thermalBand, null, true) .updateMask(qaMask) //.updateMask(saturationMask); }
//_________________________________________________________________________
// Define function to prepare OLI images. function prepOLI(img) { img = img.select([ 'SR_B4', 'SR_B5', 'SR_B6','SR_B7', 'QA_PIXEL'],[ 'Red', 'NIR', 'SWIR1','SWIR2', 'QA_PIXEL']); //img = applyScaleFactors(img); //img = prepSrL8(img); img = maskL457sr(img); //img = renameOLI(img); //img = addIndices(img); //img = addNBR(img); //img = addNDVI(img); //img = add_MIRBI(img); //img = add_NBR_mask(img); return ee.Image(img)//.copyProperties(img, img.propertyNames())) .set('data', ee.Number.parse(img.date().format("YYYYMMdd")).toInt()) .set('anomes', ee.Number.parse(img.date().format("YYYYMM")).toInt()) .set('year', ee.Number.parse(img.date().format("YYYY")).toInt()) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMMdd"))).toInt().rename('Date')) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMM"))).toInt().rename('Months')) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYY"))).toInt().rename('Years')); }
// Define function to prepare ETM+ images. function prepETM(img) { img = img.select([ 'SR_B3', 'SR_B4','SR_B5','SR_B7', 'QA_PIXEL'],[ 'Red', 'NIR', 'SWIR1','SWIR2','QA_PIXEL']); //img = applyScaleFactors(img); //img = prepSrL8(img); img = maskL457sr(img); //img = renameETM(img); //img = addIndices(img); //img = etm2oli(img); //img = addNBR(img); //img = addNDVI(img); //img = add_MIRBI(img); //img = add_NBR_mask(img); return ee.Image(img)//.copyProperties(img, img.propertyNames())) .set('data', ee.Number.parse(img.date().format("YYYYMMdd")).toInt()) .set('anomes', ee.Number.parse(img.date().format("YYYYMM")).toInt()) .set('year', ee.Number.parse(img.date().format("YYYY")).toInt()) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMMdd"))).toInt().rename('Date')) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMM"))).toInt().rename('Months')) .addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYY"))).toInt().rename('Years')); }
- Assistant
O erro que você está enfrentando está relacionado ao uso de
ee.List.get()em um objetoImageCollection, que é um tipo incompatível. Você está tentando transformar umListde coleções de imagens mapeando funções nelas, mas parece que a última parte do script, que tenta criar uma coleção de imagens a partir de uma lista, está incorreta.Vamos corrigir a parte do script onde isso ocorre:
O erro ocorre na parte onde você tenta montar
viz_rastercomo uma nova coleção a partir derunFire. Parece que o objetivo era concatenar os resultados de cada ano em uma coleção única. Vamos corrigir isso: