0

I'm having a problem with the export of results in GEE. Is there a solution to this problem?

Here's my GEE script:

var cloudMaskL457 = function(image) {
  var qa = image.select('pixel_qa');
  // If the cloud bit (5) is set and the cloud confidence (7) is high
  // or the cloud shadow bit is set (3), then it's a bad pixel.
  var cloud = qa.bitwiseAnd(1 << 5)
                  .and(qa.bitwiseAnd(1 << 7))
                  .or(qa.bitwiseAnd(1 << 3));
  // Remove edge pixels that don't occur in all bands
  var mask2 = image.mask().reduce(ee.Reducer.min());
  return image.updateMask(cloud.not()).updateMask(mask2);
};

// This function clips images to the AOI feature collection
var clipToCol = function(image){
  return image.clip(aoi);
};

var dataset = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
                  .filterDate('2000-01-01', '2003-12-31').map(clipToCol)
                  .map(cloudMaskL457)
                  .filterBounds(aoi);

print(dataset)

var evi = dataset.expression(
  '2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', {
    'NIR' : dataset.select('B5'),
    'RED' : dataset.select('B4'),
    'BLUE' : dataset.select('B2')
});
print(evi)

var EVIcolor = {
  min: -1.0,
  max: 1.0,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
  ],
};

Map.addLayer(evi, EVIcolor, 'EVI');


// Export the image, specifying scale and region.
Export.image.toDrive({
  image: evi,
  description: 'LANDSAT-8_EVI',
  folder: 'GEE',
  scale: 30,
  maxPixels: 1e9,
  fileFormat: 'GeoTIFF',
  region: aoi
});

1 Answer 1

1

In Line25 you are applying a ee.Image.expression to a imageCollection. You should use the map function to map the expression over the entire imageCollection as following:

var computeEvi = function(image){
  var landsatBands = {
    'NIR' : image.select('B5'),
    'RED' : image.select('B4'),
    'BLUE' : image.select('B2')};
  var evi = image.expression('2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', landsatBands);
  return evi
};

var eviCol = dataset.map(computeEvi);
print(eviCol)

Finally yo have to reduce the imageCollection into a single image before to export or export the entire imageCollection using 'batch' https://github.com/fitoprincipe/geetools-code-editor

var batch = require('users/fitoprincipe/geetools:batch');
batch.Download.ImageCollection.toDrive(eviCol, 'folder', 
{name: '{system:id}_' + 'EVI',
                 scale: 30,
                 region: aoi,
                 type: 'float'});

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