0

I am trying to download time series ET. But the batch tool is not working. Error:

In users/fitoprincipe/geetools:batch
Line 133: collection.size is not a function
var batch = require('users/fitoprincipe/geetools:batch');
var extent = ee.FeatureCollection("users/waqas50125012/KPK");
var StartDate = '2010-01-01';
var EndDate = '2010-12-31';
var dataset = ee.ImageCollection('MODIS/006/MOD16A2').select('ET').filterDate(StartDate,EndDate);
function clp(img) {
  return img.clip(extent);
}

var clip = dataset.map(clp);
var ET = clip.select('ET');
Map.centerObject(extent);
var evapotranspirationVis = {
  min: 0.0,
  max: 300.0,
  palette: [
    'ffffff', 'fcd163', '99b718', '66a000', '3e8601', '207401', '056201',
    '004c00', '011301'
  ],
};
Map.addLayer(ET, evapotranspirationVis, 'ET');
Map.addLayer(extent);
batch.Download.ImageCollection.toDrive({
  image: ET.select('ET'),
  description: 'ET',
  scale: 30,
  region: extent,
  maxPixels: 1e13,
});
var plotET = ui.Chart.image.series(ET.select('ET'), extent)
            .setOptions({
                title: 'ET short-term time series',
                hAxis: {title: 'Date'},
                vAxis: {title: 'ET'}
});

// Display.
print(plotET);
2
  • The error message you shared states the error is on line 133 of your code, yet you only shared thirty-something lines, please run your snippet individually and see if the error recurs, if not post the whole code.
    – M. Nicolas
    Commented Aug 29, 2022 at 22:22
  • This export method is a 3rd party script module for the Earth Engine JavaScript Code Editor. For more information on the users/fitoprincipe/geetools:batch module, see: github.com/fitoprincipe/geetools-code-editor/wiki/Batch Commented Aug 29, 2022 at 23:33

1 Answer 1

1

You're passing incorrect arguments to batch.Download.ImageCollection.toDrive. The first argument needs to be the ee.ImageCollection; you're providing a JavaScript object literal. The function tries to call ee.ImageCollection.size on something that is not an ee.ImageCollection. The export should be more like this:


var ops = {
  scale: 30,
  region: an_extent,
  maxPixels: 1e13,
}

batch.Download.ImageCollection.toDrive(col, 'folder_name', ops)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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