Skip to main content

Good day I recently changed my Evalscript for downloading S1 GRD images and since the change my PU usage has gone up exponentially. See below the Evalscript before the change:

evalscript = """
//VERSION=3

function setup() {
  return {
    input: [
      {
        bands: ["VV","VH"],                  
      }
    ],
    output: [
      {
        id: "default",
        bands: 2,
        sampleType: "FLOAT32",        
        noDataValue: 0,
      },    
    ],
    mosaicking: "SIMPLE",
  };
}


function evaluatePixel(samples) {
    // Your javascript code here
    return {
      default:[samples.VV, samples.VH],
    };
  }

function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
  // Write your code here
}
function preProcessScenes(collections) {
  return collections;
}
"""

See below the changed Evalscript which increased the PU usage, on the documentation it says dataMask does not count as a band.

evalscript = """
//VERSION=3

function setup() {
    return {
        input: [
        {
            bands: ["VV","VH","dataMask"],
        }
        ],
        output: [
        {
            id: "default",
            bands: 2,
            sampleType: "FLOAT32",        
            noDataValue: 0,
        },    
        ],
        mosaicking: "ORBIT",
    };
    }

     function evaluatePixel(samples) {
        // initial variables as the noDataValue
        let mosaic_vv = 0;
        let mosaic_vh = 0;
        
        // initial self-defined dataMask as 0 which means no data
        let mosaic_dataMask = 0;

        // for each pixel we check all available acquisitions and select the one having data
        for (let i = 0; i < samples.length; i++) {
          if (samples[i].dataMask === 1) {
            mosaic_vv = samples[i].VV;
            mosaic_vh = samples[i].VH;
            mosaic_dataMask = 1;
          }
        }
        return {
        default:[mosaic_vv, mosaic_vh, mosaic_dataMask],
        };
    }
   
    
"""

Hi,

Yes this is completely expected behaviour. In your new script, you are now using ORBIT mosaicking that means you are processing a time range of Sentinel-1 GRD acquisitions, whereas, before you were only processing a single acquisition using SIMPLE mosaicking.

You can read more about how mosaicking works in our documentation here. There is also a webinar about this feature here.


Hi

Thanks for the response, and clarification.

Appreciate it.