1

I am trying to calculate the temperature per district in Afghanistan with the following code. However, I receive the following error when trying to calculate the mean per district:

Unrecognized arguments (collection) to function: Image.reduceRegion(image, reducer, geometry, scale, crs, crsTransform, bestEffort, maxPixels, tileScale)


///Code

var region = ee.FeatureCollection('users/mm/countries')
.filterMetadata('COUNTRY', 'equals', 'Afghanistan');

var districts = ee.FeatureCollection('users/mm/AFG_districts')

var modisLSTday = ee.ImageCollection('MODIS/MOD11A2')
.select('LST_Day_1km');

var modLSTday = modisLSTday.map(function(img) {return img.multiply(0.02)
.subtract(273.15)
.copyProperties(img,['system:time_start','system:time_end']);});

var collectionday = ee.ImageCollection(modLSTday).filterDate('2014-01-01', '2015-01-01');

var clippedday = collectionday.mean().clip(region);

var clippedday_district =  clippedday.reduceRegion({
  collection: districts,
  reducer: ee.Reducer.mean(),
  scale: 400,
})

;

0

You need to change .reduceRegion to .reduceRegions if you want to extract the mean for multiple districts.

var clippedday_district =  clippedday.reduceRegions({
  collection: districts,
  reducer: ee.Reducer.mean(),
  scale: 400,
})

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.