I have a code that creates image collection and then calculate what is the biggest number of pixels in image (e.g the image with maximum spatial data). I managed to calculte this number and to use it to create new image collection with relevant images. I want to create range of numebr of pixels that are needed in an image in order to join this image collection. I decided that I can "accept" images that are at least 75% size of the biggest image. I have a code for that, but whenever I try to compute max_number.multiply(0.75) I get error:
max_number.multiply is not a function
Those are therelevant parts from my code:
var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2013-01-01', '2019-12-02')
.select('B4', 'B5','pixel_qa')
.filterBounds(geometry)
.map(maskL8sr);
//clip the dataset according to the geometry
var clippedCol=dataset.map(function(im){
return im.clip(geometry);
});
// Get the number of images.
var count = clippedCol.size();
print('Count: ',count);
//here I do calculations -clip image collection, add NDVI so my new
//my new dataset called now "withNDVI"
//Filter according to number of pixels
var ndviWithCount = withNDVI.map(function(image){
var countpixels = ee.Number(image.reduceRegion({
reducer: ee.Reducer.count(),
geometry: geometry,
crs: 'EPSG:4326',
scale: 30,
}).get('NDVI'));
return image.set('count', countpixels);
});
print('NDVIwithCount:',ndviWithCount);
var max = ndviWithCount.reduceColumns(ee.Reducer.max(), ["count"]);
print(max.get('max'));
var max_number=(max.get('max'));
var almost_max=max_number.multiply(0.75);
My end goal is to be able to compute numbers with my var max_number so in the end my script knows automatically for every polygon to choose only the correct images