I'm trying to normalize a collection of images, each to it's own mean value (over a certain region), but I keep getting an error inside the map()
function that I can't find anywhere else in documentation or online.
Internal error: function argument not initialized.
Here is my code:
var col = ee.ImageCollection('COPERNICUS/S1_GRD')
.select(['VV'])
.filterBounds(PolyOfInterest)
.filterDate(StartDate,EndDate);
var normalize = function(image) {
var tmp = image.clip(PolyOfInterest);
var stats = tmp.reduceRegion({
geometry: roi,
reducer: ee.Reducer.mean(),
bestEffort: true,
});
print(stats); // I don't know how stats will be structured, so I haven't yet applied it to the image in the next line.
return image; // Scale the image so that the mean value is mapped to 1 (values above the mean are clipped)
};
var scaledCollection = col.map(normalize);
Has anyone else encountered/solved this problem before, or could help me?
The problem persists even if the entirety of the normalize function is replaced with simply print(image);
.