0

I am trying to normalize a data set. But getting an error with

.map is not a function

How can I solve this issue?

var StRain = raindata.subtract(ltamean).divide(ltastd);

var SPI = StRain.map(function(image){
  var Imin = StRain.reduce(ee.Reducer.min())
  var Imax =StRain.reduce(ee.Reducer.max()) 
    return image.expression('1-(Ia-Imin)/(Imax-Imin)',
      {Ia: image,
       Imin: Imin,
       Imax:Imax
        }).clip(AOI).rename('SPI')
        .copyProperties(image, ['system:time_start'])
        .set('date', image.date().format('YYYY_MM_dd'))
})
2
  • as an aside, should StRain.reduce(...) inside the map function be image.reduce(...)? Currently, you are performing an identical operation for every image in the collection. Otherwise, it should be outside of map()
    – Matt
    Commented Sep 28, 2021 at 12:28
  • The behavior depends on the type of object raindata. Could you define it in the example code (perhaps using an asset from the Earth Engine public data catalog)? Commented Sep 1, 2022 at 23:08

1 Answer 1

1

I believe StRain is an Image and not an ImageCollection, and therefore has no map() method.

2
  • I derived from this collection ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD'). After that I standardized the data (StRain).
    – Chathu_T
    Commented Sep 28, 2021 at 12:15
  • 2
    Can you please include the code that results in StRain in your question? It would make it easier to see what is happening. (Namely, how raindata, ltamean and ltastd are created from the original ImageCollection)
    – Matt
    Commented Sep 28, 2021 at 12:21

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.