# Google Earth Engine scaling behavior of discrete vs continuous image data

I have a simple question related to how GEE determines continuous vs discrete data, specifically during scaling operations as described here.

I am unable to find a proper description of this, but my assumption is that float data is always treated as continuous and integer always as discrete. So that an integer image would need to be recast to float to be scaled as continuous and vice versa.

Can anyone confirm this?

In any case, there are a couple of things that confuse me in the example I give below.

First, the printAtScale function (taken and adapted from here) gives the same results (integers) for the integer and the float data. I would expect decimal numbers representing the mean of the area for the latter.

Second, a histogram of integer data shows discrete x-axis values when plotting a single image band, but value ranges when plotting two images together, which suggests continuous values (maybe just a glitch in the plotting?).

Third, the n-counts are decimal numbers (data not shown), which makes no sense in a histogram.

I realize the histogram issues are not necessarily related to the scale question, but the latter came up while creating the histograms.

``````// Test behavior of scaling

var geometry = /* color: #0B4A8B */ee.Geometry.Point([-99.6759033203125, 47.77185170705089]);

var COL_FILTER = ee.Filter.and(
ee.Filter.bounds(geometry),
ee.Filter.date('2021-05-01', '2021-05-15'));

print(dwCol.getInfo());

var dwImList = dwCol.toList(dwCol.size());
var dwLab1 = ee.Image(dwImList.get(0)).select('label');
var dwLab2 = ee.Image(dwImList.get(1)).select('label');
var dwLab1cont = dwLab1.toFloat();

print(dwLab1.getInfo());
print(dwLab1cont.getInfo());
// print(dwLab2.getInfo());
// print(dwLab.getInfo());

var printAtScale = function(image, scale) {
print('Pixel value at '+scale+' meters scale',
image.reduceRegion({
reducer: ee.Reducer.first(),
geometry: image.geometry().centroid(),
// The scale determines the pyramid level from which to pull the input
scale: scale
}).get('label'));
};

printAtScale(dwLab1, 10);
printAtScale(dwLab1, 50);
printAtScale(dwLab1, 100);
printAtScale(dwLab1, 500);

printAtScale(dwLab1cont, 10);
printAtScale(dwLab1cont, 50);
printAtScale(dwLab1cont, 100);
printAtScale(dwLab1cont, 500);

var chart =
ui.Chart.image.histogram({image: dwLab, scale: 500})
.setSeriesNames(['Land Cover 1', 'Land Cover 2'])
.setOptions({
title: 'Two Dates',
hAxis: {
title: 'Cover Class',
titleTextStyle: {italic: false, bold: true},
},
vAxis:
{title: 'Count', titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e', '1d6b99']
});
print(chart);

var chart2 =
ui.Chart.image.histogram({image: dwLab1, scale: 500})
.setSeriesNames(['Most Likely Land Cover'])
.setOptions({
title: 'One date. Integer',
hAxis: {
title: 'Cover Class',
titleTextStyle: {italic: false, bold: true},
},
vAxis:
{title: 'Count', titleTextStyle: {italic: false, bold: true}},
colors: ['cf513e']
});
print(chart2);
``````

• `my assumption is that float data is always treated as continuous and integer always as discrete`. If this were true, wouldn't it mean SRTM elevation data (integer meters) would be treated as discrete? I don't think it is though Aug 2, 2022 at 12:57
• @BarryCarter as I wrote above, I find no reference to clarify this. I think it should be better described in the guide (link in post), with examples for both discrete and continuous. Aug 3, 2022 at 12:43

The pyramiding policy is specified when the images are ingested, on a per-band basis. It has nothing to do with the pixel type (although the discrete bands like `label` are ingested with a 'mode' policy, so pixels aren't averaged at lower levels of the pyramid).