Statistical API BYOC type don't works

Hi,
I have tried from the request-builder to get the NVDI data of my own layer, but I always get the same error: “Output dataMask requested but missing from function setup()”.

I don’t understand why this error, I select the OGC Layer evalscript (provides by default, no change)

Hi Vicente,

Thanks for the question, when using Statistical API, you should always use a dataMask as an input and as an output into your evalscript. This is documented in the Statistical API documentation here.

An example of this in action can be found here and also below:

//VERSION=3
function setup() {
  return {
    input: [{
      bands: [
        "B04",
        "B08",
        "SCL",
        "dataMask"
      ]
    }],
    output: [
      {
        id: "data",
        bands: 3
      },
      {
        id: "scl",
        sampleType: "INT8",
        bands: 1
      },
      {
        id: "dataMask",
        bands: 1
      }]
  };
}

function evaluatePixel(samples) {
    let index = (samples.B08 - samples.B04) / (samples.B08+samples.B04);
    return {
        data: [index, samples.B08, samples.B04],
        dataMask: [samples.dataMask],
        scl: [samples.SCL]
    };
}

Note how the dataMask is an input in the setup() function and is also defined as a separate output in the EvaluatePixel() function. You should be able to adapt this example with your own data collection that you have imported using BYOC.

If you are still stuck then please let me know, and I will help you solve the issue :slight_smile:

I created a subscription for planetscope with dates between 2022-10-01 and 2023-05-30, it works with dates after 2023_01_01, but with dates between 2022-10-01 and 2022-12-31 it shows the same error

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.