Get Sentinel 1 Images with sigma nought backscatter values in dB

Actually, I am working with GLF-CR neuronal network with my own SAR images. I tried all ways to download data in that format but it was no posible for me.

The neuronal networks data works in this way:
-Load de SAR image with values in dB btw -34 or more to 0 in float32 format. Sentinel-1 Global Backscatter Model
-Them clipped btw [-35,0] and [-25,0] the VV and VH bands respectily.
-In the last step, normalize the image btw [0,1]

I have this code:

evalscript = """
//VERSION=3
function setup() {
  return {
    input: ["VV","VH"],
    output: { id: "default", bands: 2, sampleType: "FLOAT32" },
  }
}

function evaluatePixel(samples) {
  var vvdB = toDb(samples.VV)
  var vhdB = toDb(samples.VH)
  return [vvdB, vhdB]
}

// displays VV in decibels from -20 to 0
function toDb(linear) {
  // the following commented out lines are simplified below
  // var log = 10 * Math.log(linear) / Math.LN10
  // var val = Math.max(0, (log + 20) / 20)
  return Math.max(0, Math.log(linear) * 0.21714724095 + 1)
}
"""

bbox = BBox(bbox=[xx,xy,yy,yx], crs=CRS.WGS84)
def get_alldata(time_interval):
    return SentinelHubRequest(
        evalscript=evalscript,
        input_data=[
            SentinelHubRequest.input_data(
                data_collection=DataCollection.SENTINEL1_IW_DES.define_from("sd", service_url=config.sh_base_url),
                time_interval=time_interval,
                other_args={"dataFilter": {"resolution": "HIGH"},"processing": {"backCoeff":"SIGMA0_ELLIPSOID","orthorectify": True,"demInstance": "COPERNICUS"}}
            ),
        ],
        responses=[SentinelHubRequest.output_response("default", MimeType.TIFF),],
        bbox=bbox,
        size=aoi_size,
        config=config,
    )

I get the images btw 0 and 2 but no in dB.

How can i download the data in that format?

Hi Juan,

I’m not exactly sure what you are trying to do but if you are trying to obtain all the Sentinel-1 imagery for a certain time period then the following evalscript should help you out:

//VERSION=3

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

var timestamps = []

function updateOutputMetadata(scenes, inputMetadata, outputMetadata){
    outputMetadata.userData = {
          "Dates":  [...new Set(timestamps)]
    }
}

function preProcessScenes (collections) {
  // Sort scenes by dateFrom in ascending order
  collections.scenes.orbits.sort(function (s1, s2) {
    var date1 = new Date(s1.dateFrom)
    var date2 = new Date(s2.dateFrom)
    return date1 - date2
  })
  return collections
}

function updateOutput (outputs, collections) {
  outputs.VV.bands = collections.scenes.length
  outputs.VH.bands = collections.scenes.length
  outputs.Ratio.bands = collections.scenes.length
}

function toDb(linear) {
        return 10 * Math.log(linear) / Math.LN10
    }   

function evaluatePixel(samples, scenes) {

  var VV_bands = []
  var VH_bands = []
  var Ratio_bands = []

  for (let i = 0; i < scenes.length; i++){
    if (samples[i].dataMask === 1){
      VV_bands.push(toDb(samples[i].VV))
      VH_bands.push(toDb(samples[i].VH))
      Ratio_bands.push((toDb(samples[i].VH))/(toDb(samples[i].VV)))

    } else {
      // No data = - 9999
      VV_bands.push(-9999)
      VH_bands.push(-9999)
      Ratio_bands.push(-9999)
    }
    //throw new Error (JSON.stringify(scenes[i]))
    timestamps.push(JSON.stringify(scenes[i].date))
  }
  return {
    VV: VV_bands,
    VH: VH_bands,
    Ratio: (Ratio_bands),
  }
}

Please do ask more questions if you are still not getting your desired result.

No, I just wanna get the Sentinel 1 data values like Sentinel-1 Global Backscatter Model btw -18dB to -4.5dB or like the values of SEN12MS-CR dataset where described: Sentinel-1 SAR: 2 channels corresponding to sigma nought backscatter values in dB scale for VV and VH polarization.

The posted code is an example of parameters that how I’m download the data.

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