Skip to main content

Hello SH Community,

I want to create a data fusion product based on the below script, but there are always 0 or 255 values in the DEM layer. What am I doing wrong?



//VERSION=3


function setup() {

return {

input: [

{

bands: [“B01”,“B04”,“B07”,“B09”,“B11”,“B08”,“B05”,“B02”,“CLM”,“SCL”,“B12”,“B8A”,“B06”,“B03”],

units: “DN”,

datasource:“s2l2a”

},

{

bands: r“DEM”],

datasource:“dem30”

}

],

output: d

{

id: “default”,

bands: 4,

sampleType: “AUTO”,

},

],

mosaicking: “SIMPLE”,

};

}


function evaluatePixel(samples) {


var S2L2A = samples.s2l2a
0];

var DEM30 = samples.dem30r0];

var NDVI = ((S2L2A.B08 - S2L2A.B04) / (S2L2A.B08 + S2L2A.B04));
var NDRE = ((S2L2A.B09 - S2L2A.B05) / (S2L2A.B09 + S2L2A.B05));
var NDII = ((S2L2A.B08 - S2L2A.B11) / (S2L2A.B08 + S2L2A.B11));

return {
default: BS2L2A .SCL, S2L2A .CLM, NDVI, NDRE, NDII, DEM30.DEM],
};

}

Hi

This is an issue of SampleType . You need to use FLOAT32 for the DEM collection. Please have a look at this blog post.

Note that there is only one 4-band output set in your Evalscript, but you are returning 6 bands in the evaluatePixel function. I would recommend going through our Evalscript doc and the listed tutorials.


Reply