I'm trying to export a tiff map and gave the following error:
Error: Exported bands must have compatible data types; found inconsistent types: Float64 and Float32.
How can I solve this?
Code:
//Choose country using GEE Feature Collection
var region = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw').filterMetadata('Country', 'equals', 'Portugal');
//Add region outline to layer ‐ for selected countries
Map.addLayer(region,{}, 'Portugal');
// image collection pre 11/10/2017
var lt8_pre = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(region)
.filterDate(ee.Date("2017-08-01"),ee.Date("2017-10-11"));
Map.addLayer(lt8_pre, {bands: ['B4', 'B3', 'B2'],min: 1000, max: 1500}, 'image L8 pre');
var lt8_ndvi_pre = lt8_pre
.map(function(img){
return img.addBands(img.normalizedDifference(['B5', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));
});
// Create an NBR image using bands the nir and red bands (6 and 4)
var lt8_nbr_pre = lt8_pre
.map(function(img){
return img.addBands(img.normalizedDifference(['B7', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));
});
print(lt8_ndvi_pre);
print(lt8_nbr_pre);
// image collection pos 11/10/2017
var lt8_pos = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterBounds(region)
.filterDate(ee.Date("2017-10-18"),ee.Date("2018-02-10"));
Map.addLayer(lt8_pos, {bands: ['B4', 'B3', 'B2'], max: 1000}, 'image L8 pos');
var lt8_ndvi_pos = lt8_pos
.map(function(img){
return img.addBands(img.normalizedDifference(['B5', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));
});
// Create an NBR image using bands the nir and red bands (6 and 4)
var lt8_nbr_pos = lt8_pos
.map(function(img){
return img.addBands(img.normalizedDifference(['B7', 'B4'])).updateMask(img.select(['pixel_qa']).neq(5).neq(3).neq(2));
});
print(lt8_ndvi_pos);
print(lt8_nbr_pos);
//Clip to Specified Region
var NDVI_pre = lt8_ndvi_pre.mean().clip(region);
var NDVI_pos = lt8_ndvi_pos.mean().clip(region);
var NBR_pre = lt8_nbr_pre.mean().clip(region);
var NBR_pos = lt8_nbr_pos.mean().clip(region);
Map.centerObject(region, 10);
var ndvi_viz = {min:-0.8, max:1, palette:'000000,00FF00'};
Map.addLayer(NDVI_pre.select('nd'), ndvi_viz, "LT8 NDVI mean pre 11/10");
Map.addLayer(NDVI_pos.select('nd'), ndvi_viz, "LT8 NDVI mean pos 11/10");
// Display the NBRpost
var nbr_viz = {min: -1, max:1, palette: ['FFFFFF','CC9966','CC9900','996600', '33CC00', '009900','006600','000000']};
Map.addLayer(NBR_pre.select('nd'), nbr_viz, "LT8 NBR mean pre 11/10");
Map.addLayer(NBR_pos.select('nd'), nbr_viz, "LT8 NBR mean pos 11/10");
//Calcule dNBR and dNDVI
var dNBR = NBR_pre.subtract(NBR_pos);
var dNDVI = NDVI_pre.subtract(NDVI_pos);
//Map.addLayer(dNBR,nbr_viz, "dNBR");
Map.addLayer(dNDVI.select('nd'), ndvi_viz, "LT8 dNDVI");
Map.addLayer(dNBR.select('nd'), nbr_viz, "LT8 dNBR");
Export.image.toDrive({
image: NBR_pos,
description: 'NBR_pos',
scale: 30,
region: Pt,
maxPixels: 278466375,
});
Pt
,NBR_pos
andregion