I am working with the Global Forest Cover Change (GFCC) rasters for 2000 to create a forest quality score for 0.01 degree tiles (the percent of the tile with +50% forest cover, divided by the percent of the tile with +10% forest cover).
var gfcc00 = ee.ImageCollection('NASA/MEASURES/GFCC/TC/v3')
.filter(ee.Filter.date('2000-01-01', '2000-12-31'))
.select('tree_canopy_cover');
var gfcc2000 = gfcc00.reduce(ee.Reducer.mean());
For simplicity, I wanted to produce per-tile counts of pixels with +50% FC and +10% FC. I did so by reclassifying the raster so that only the values that fall in this range are 1s, else zero.
var fifty00 = ee.Image(1)
.where(gfcc2000.gte(50).and(gfcc2000.lte(100)), 1)
.where(gfcc2000.lt(50), 0)
.where(gfcc2000.gt(100), 0);
Then I used a reducer function, to sum up the pixel values.
var count50 = tiles1.map(function(feature) {
return feature.set(fifty002.reduceRegion({
reducer: ee.Reducer.sum(),
geometry: feature.geometry(),
scale: 30
}));
});
I expected the image reducer to give me an integer value for each tile, but instead, it's a decimal value. Why is that? How do I get an integer value? Full code here.