I have raster with NDVI values and I would like to use reducer in order to know how many pixels in the raster are smaller than 0.2, between 0.2-0.4 , betwen 0.4-0.6 and gt than 0.6.
i'm not sure that the way I have been that gives me true results, because I have difference between the total number of pixels to the sum of the differnt categories pixel counts.
var c0406 = image.gt(0.4).lt(0.6).selfMask().reduceRegion({
reducer: ee.Reducer.count(),
geometry: geometry,
crs: 'EPSG:4326',
//maxPixels:1310361348,
scale: 20,
}).values().get(0);
when each time I have change the condition in image.gt
I'm not sure it's correct because when I calculte the total number of pixels, I get 17,748 , but when I calculte the categories pixels I get around 45k:
var total = image.reduceRegion({
reducer: ee.Reducer.count(),
geometry: geometry,
crs: 'EPSG:4326',
//maxPixels:1310361348,
scale: 30,
}).values().get(0);
*i'm not sure what is systen asset size and if it's also suppose to be number of pixels
My end goal is to count correctly the number of pixels between different ranges (0.2-0.4 ect.)