#I cant export the layer to my google drive because of this error:Exported bands must have compatible data types; found inconsistent types: Float64 and Float32. (Error code: 3). can anyone help me with this problem.
var band = ['B11','B8', 'B4', 'B3', 'B2'];
var image = ee.ImageCollection("COPERNICUS/S2_SR_HARMONIZED").select(band).filterBounds(table)
.filterDate('2023-12-01','2023-12-31').filter(ee.Filter.lt("CLOUDY_PIXEL_PERCENTAGE",20)).median()
.clip(table);
var visparams = {min:0.0, max:3000, bands:['B8','B4', 'B3']};
print(image, visparams,'image');
Map.addLayer(image,visparams, 'image');
var nd= function(image){
var ndwi= image.normalizedDifference(['B3','B8']).rename('NDWI');
return image.addBands(ndwi);
};
var nd1 = nd(image);
Map.addLayer(nd1.select('NDWI'),{palette: ['red', 'yellow', 'green', 'cyan', 'blue']},'nd2');
Export.image.toDrive({
image: nd1,
description: "NDWI_2023",
region: table,
maxPixels:380681498 ,
scale: 10,
})
2
Answers
you need to cast the bands in the image to the same type. Since your NDWI band is likely Float64, you can cast all bands in the image to Float64
This should help