Thank you @ dorothyrono
I read the link you sent, It was helpful.
Further I will use the next code to assure the reflectance as output of the code
Making a polygon and running the code will result in a downloadable csv (using the Feature Info Service Chart tool).
The csv output have three issues:
1- The output gives the min, max, and the mean for every band. How could I add the Median? The Median could provide more statistical insight if the data skewed.
2- The output of SCL (Scene Classification Data) value will be the mean value as a number. For example, I will get the number 3 as an output because it is the mean. How could I obtain full data instead? I mean to get a result like this
33.3% of the pixels have the value of 1
33.3% of the pixels have the value of 3
33.3% of the pixels have the value of 5
And the mean is 3
3- There are three empty columns (C0/median, C0/p10, C0/p90) After each band. The bug is in the next column (C0/cloudCoveragePercent) which is always 100%. Is it a bug in the system that the cloud cover is always 100% for polygons?
//VERSION=3
function setup() {
return {
input: ["B01","B02","B03","B04","B05","B06","B07","B08","B8A","B09","B11","B12","SCL","CLP","CLM", "dataMask"], units: "Reflectance",
output: { bands: 16, sampleType: "FLOAT32" }
};
}
function evaluatePixel(sample) {
return [sample.B01, sample.B02, sample.B03, sample.B04, sample.B05,sample.B06,sample.B07, sample.B08, sample.B8A, sample.B09, sample.B11, sample.B12, sample.SCL, sample.CLP, sample.CLM, sample.dataMask];
}
sincerely