Sentinel-1 data access methods (x-cuben aws, ...)

For future readers, here is a correct implementation:

evalscript = """
//VERSION=3

var earliest_date = '2017-04-09'; var latest_date = '2017-04-30';
function setup() {
  return {
    input: [
      {
        bands: ["VV","VH","localIncidenceAngle","scatteringArea", "shadowMask","dataMask"],                  
      }
    ],
    output:[
        {
          id: "VV",
          sampleType: "FLOAT32",
          bands: 1
        },
        {
          id: "VH",
          sampleType: "FLOAT32",
          bands: 1
        },
        {
          id: "LocalIncidenceAngle",
          sampleType: "UINT8",
          bands: 1
        },
        {
          id: "ScatteringArea",
          sampleType: "UINT8",
          bands: 1
        },
        {
          id: "ShadowMask",
          sampleType: "UINT8",
          bands: 1
        }
    ],
      mosaicking : "ORBIT"
  };
}

function updateOutput(outputs, collection) {
  Object.values(outputs).forEach((output) => {
    output.bands = collection.scenes.length;
  });
}

function updateOutputMetadata(scenes, inputMetadata, outputMetadata) {
      var dds = [];
      for (i=0; i<scenes.length; i++){
        dds.push(scenes[i].date)
      }
      outputMetadata.userData = { "acquisition_dates":  JSON.stringify(dds) }
  }


function preProcessScenes (collections) {
  var allowedDates = []; 
  for(allowedDates,dt=new Date(earliest_date); dt<=new Date(latest_date); dt.setDate(dt.getDate()+12)){
    allowedDates.push(new Date(dt).toISOString().split('T')[0]);
  }
  collections.scenes.orbits = collections.scenes.orbits.filter(function (orbit) {
      var orbitDateFrom = orbit.dateFrom.split("T")[0];
      return allowedDates.includes(orbitDateFrom);
  })
  return collections
}

function evaluatePixel(samples) {
  var n_observations = samples.length;
  let vv = new Array(n_observations).fill(NaN);
  let vh = new Array(n_observations).fill(NaN);
  let localIncidenceAngle = new Array(n_observations).fill(NaN);
  let scatteringArea = new Array(n_observations).fill(NaN);
  let shadowMask = new Array(n_observations).fill(NaN);
    
  for(i=0; i<n_observations; i++){
    var sample = samples[i];
    if(sample.dataMask ==1){
      vv[i] = sample.VV ;
      vh[i] = sample.VH ;
      localIncidenceAngle[i] = sample.localIncidenceAngle ;
      scatteringArea[i] = sample.scatteringArea ;
      shadowMask[i] = sample.shadowMask ;
    }
  }
                       
    return {
      VV: vv,
      VH: vh,
      LocalIncidenceAngle: localIncidenceAngle,
      ScatteringArea: scatteringArea,
      ShadowMask: shadowMask
    };
  }

"""
bbox = BBox(bbox=[133.805, 48.201, 134.285, 48.391], crs=CRS.WGS84)

request = SentinelHubRequest(
    evalscript=evalscript,
    data_folder = "datasets",
    input_data=[
        SentinelHubRequest.input_data(
            data_collection=DataCollection.SENTINEL1_IW,          
            time_interval=('2017-04-09', '2017-04-30'),  
            mosaicking_order="leastRecent",
            other_args={"dataFilter": {"resolution": "HIGH"},"processing": {"backCoeff": "GAMMA0_TERRAIN","orthorectify": True,"demInstance": "COPERNICUS_30"}}
        ),
    ],
    responses=[
      SentinelHubRequest.output_response('VV', MimeType.TIFF),
      SentinelHubRequest.output_response('VH', MimeType.TIFF),
      SentinelHubRequest.output_response('LocalIncidenceAngle', MimeType.TIFF),
      SentinelHubRequest.output_response('ScatteringArea', MimeType.TIFF),
      SentinelHubRequest.output_response('ShadowMask', MimeType.TIFF),
      SentinelHubRequest.output_response('userdata', MimeType.JSON)
    ],
    bbox=bbox,
    size=[512, 304.068],
    config=config
)

I’ll try to add this script to the list of custom-scripts ASAP :slight_smile:

My last interrogation concerns this issue which was raised a couple of months ago here: Sentinel-1 Mosaicking order is always most recent, I’ll try to check on my side but if somebody from sentinel-hub can confirm whether the issue has been solved it would be great !