3

I am trying to extract rainfall (CHIRPS) values for a set of locations but I got the following error:

Image.reduceRegions: Unable to find a crs

This does not happens with other datasets (such as terraclimate)

The error arise when i start downloading the table from Tasks.

Here is the link to the code I have run https://code.earthengine.google.com/c27f2156e81824b0990dcfe0b0a6f455

The error should be here:

// do extraction 
var ft = ee.FeatureCollection(ee.List([]));

//Function to extract values from image collection based on point file and export as a table 
var fill = function(img, ini) {
  var inift = ee.FeatureCollection(ini);
  var scale = ee.Image(MM.first()).projection().nominalScale().getInfo()
  var ft2 = img.reduceRegions(pts, ee.Reducer.first(),scale);
  var date = img.date().format("YYYYMM");
  var ft3 = ft2.map(function(f){return f.set("date", date)});
return inift.merge(ft3);
};

// Iterates over the ImageCollection
var profile = ee.FeatureCollection(MM.iterate(fill, ft));
  • May I ask what does the 'ini' mean in the function(img,ini),and why should I transfer this 'ini' into featurecollection? – Zhou XF Apr 15 at 2:40
3

Some of your images inside the collection do not contain bands. Therefore, the error is thrown. Filter out images which do not contain a band using (assuming the first images correctly contains a band):

// Filter out empty images
MM = MM.filter(ee.Filter.listContains('system:band_names', MM.first().bandNames().get(0)))

Furthermore, I think you will need to get the scale using the following, based on this post:

// get scale 
var scale = MM.first().projection().nominalScale().multiply(0.05); print(scale)

As your feature collection was not shared, I drew a simple feature collection: Link script

  • it works perfectly.Thanks – Gianca Apr 5 at 10:02

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.