New units and NDVI NDMI values


I have read the new units that are used and I feel a bit confused,
I used to have script to get raster with two bands: NDVI and NDMI, with values range between -1 to 1. However, now I’m getting the raster with values that seems to be between 0-255, despite the fact it is NDVI and NDMI.
I don’t know if it’s because I use the “CLM” band, and that’s has different units based on the documentation (UINT8 and UINT16 for the optical bands). Maybe there is nothing to do with the new units, but I thought maybe it related.

This is my evalscript:

evalscript_sen2 = """

function setup() {
  return {
    input: ["B04", "B08", "B11","CLM"],
    output: { bands: 2 },

function evaluatePixel(sample) {
    if (sample.CLM == 1) {
        return [null]
    const ndvi = index(sample.B08, sample.B04);
    const ndmi = index(sample.B08, sample.B11);
    return [ndvi,ndmi];

My goal is to get raster with two bands with values between -1 to 1, float.

Hi @reutkeller,
you are probably referring to unit improvements thread, but do note that:

  • these changes have not been enforced yet (planned end of November)
  • when enforcement is done, improper requests will fail, so there will be no automatic changes of the units
  • we have proactively analysed requests coming in and are contacting users, who might be impacted with the introduction of changes; if you have not been contacted, this should not impact you unless we missed some of your request.

That said, I believe the reason why you are getting INT values is due to the sampleType setting in your evalscript. If you change this to FLOAT32 (from UINT16), you should get a desired output.
There have not been any changes in this respect in the past, so I believe your script was acting like this from the very beginning.