I am trying to extract the pixel value from the last image of an image collection. The problem is that when I do so, I get an error stating the following:
This is my code for extracting the pixel value of the image:
var precipCol = imageCollection5.select(['hourlyPrecipRateGC']) .filterBounds(geometry) .filterDate(getFirst(new Date()), currentDate); var lastPrecip = precipCol.reduce(ee.Reducer.last()); var precipNum = lastPrecip.reduceRegion(ee.Reducer.last(), geom) .getNumber('hourlyPrecipRateGC_last').getInfo();
When I click on the inspector tab, the code editor does display the number as it should. The value I get when I click in the inspector is what I need to get from the code above.
The variable geometry is a polygon consisting of the following vertices:
The variable geom is the coordinate: (-106.224911, 31.548092).
The variable currentDate holds a string with the current date in YYYY-MM-DD.
function getFirst(date) returns current week's first date.
imageCollection5 is the following source:
What can I do?