corrija o seguinte erro no script do google earth engine: LULC: Layer error: No valid…
- User
corrija o seguinte erro no script do google earth engine: LULC: Layer error: No valid training data were found. Print apenas a solução indicada. Aqui está o script de exemplo: Map.setOptions('SATELLITE')////"ROADMAP", "SATELLITE", "HYBRID" or "TERRAIN"
var Region = geometry//geometry2
var mascaraOtto = ee.Image(100).toInt().clip(Region)
var runFire = ee.List([1985,1987, 2022, 2024]).map(function(i){
i = ee.Number(i).toInt().format()
// Define time interval to composite scenes var date_start= i.cat("-06-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
Para corrigir o erro "No valid training data were found," é importante garantir que os dados de treinamento estejam disponíveis e que a preparação da sua coleção de imagens esteja correta. Uma solução possível para isso pode ser adicionar verificações para pressionar se as imagens estão vazias. Além disso, modifique o script para criar dados de treinamento, se necessário. Aqui, vou esboçar uma solução genérica:
- Verifique se as coleções de imagens não estão vazias.
- Assegure-se de que há dados de treinamento no script.
Aqui está o que você pode ajustar: