2

I am trying to download a specific Landsat scene (since the USGS EROS site is down from the government shutdown) using the imageToCOGeoTiff task to save to my Google Drive. I am using the USGS Landsat 8 Collection 1 Tier 1 TOA Reflectance data. I get the error message:

Error: Exported bands must have compatible data types; found inconsistent types: Float32 and UInt16.

I understand that all bands are "float" except for the BQA band which is "int16". I only need bands 1 - 11, not the BQA. Is there any way to select the bands I want (or to remove the BQA band)?

This is what I have so far (I am very new to GEE and most of this code was derived from elsewhere):

var lsat = ee.Image(landsat.filterDate('2016-06-27','2016-06-29').filterBounds(point).first());

// Print the image to the console
print(lsat);

// Define vis parameter
var trueColor = {
  bands: ['B4','B3','B2'],
  min: 6000,
  max: 13000,
};

// Add the image to the map
Map.addLayer(lsat,trueColor,'True Color Image');

// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({
  image: lsat,
  description: 'imageToCOGeoTiffExample',
  scale: 30,
  fileFormat: 'GeoTIFF',
  maxPixels: 11629187501,
  formatOptions: {
    cloudOptimized: true
  }
});
1

You could use the following to select the first 11 bands:

// select the first 11 bands
var lsat = lsat.select(ee.List.sequence(0,10)); // or e.g. select([0,3,7]) for some other bands 

You could also cast the bands to the same data type:

// cast image to same data type
var toFloat = lsat.toFloat();
  • Thank you! Selecting the first 11 bands worked. – apple Jan 11 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.