I have a MODIS image that I'd like to resample to 12km resolution. For each 12km pixel, I'd like two pieces of information: (1) the mean of the MODIS pixels within the 12km pixel and (2) the standard deviation of the MODIS pixels within the 12km pixel.
Consider the following example:
var imageCollection = ee.ImageCollection("UMT/NTSG/v2/MODIS/NPP");
var data = imageCollection.first().select("annualNPP")
var data_mean =data .reproject({ crs: 'EPSG:4326', scale: 12000})
.reduceResolution({
reducer: ee.Reducer.mean(),
maxPixels: 65535 }).rename("mean")
var data_stdev =data .reproject({ crs: 'EPSG:4326', scale: 12000})
.reduceResolution({
reducer: ee.Reducer.stdDev(),
maxPixels: 65535 }).rename("stdev")
Map.addLayer(data_mean,{},"mean")
Map.addLayer(data_stdev,{},"stdev")
This gives me an image with the mean of the MODIS pixels within the 12km pixel but the standard deviation at each 12km pixel is zero.
I thought maybe the standard deviation was small, so I tried multiplying the data_stdev image by 1,000, but that did not solve the problem.
Perhaps there is another way to approach this?