I’m trying to create function to return cloud pixel percentage based on SCL Sentinel 2 L2A following these functions:
//VERSION=3
function setup() {
  return {
    input: ["B02", "B03", "B04", "SCL"],
    output: { bands: 1 }
  };
}
function calcCloudPercentage(SCL) {
  var cloudCount = 0;
  var totalPixels = SCL.length;
  for (var i = 0; i < totalPixels; i++) {
    if (SCL[i] === 3 || SCL[i] === 8 || SCL[i] === 9 || SCL[i] === 10) {
      cloudCount++;
    }
  }
  return cloudCount / totalPixels * 100;
}
function evaluatePixel(sample) {
  var cloudPercentage = calcCloudPercentage(sample.SCL);
  return [cloudPercentage];
}
However, the functions always return “null”. Anyone could help to understand why this return?
