Coder Social home page Coder Social logo

Comments (6)

gmilcinski avatar gmilcinski commented on August 26, 2024

To the first question, the answer is "linear in the chosen backscatter coefficient", see this part of the documentation.

Second one is a bit tricky as it depends... This script is of type "Simple script", where the specifics of the output are "auto-magically" set based on the output format of the APi or OGC request. This is probably best described in this FAQ.
In this specific script, band1/2/3 would be numbers from 0-1, which are then scaled based on the output format. E.g. for 8-bit PNG 0 goes to 0 and 1 goes to 255. Similarly for 16-bit. With 32-bit float, the output remains as it is.
As we have realised that this "auto-magic" approach is not the best option, due to confusions like this issue, we have introduced V3 Evalscripts, which are much more strict in this respect. Check this post on why we are doing it and V3 documentation.

from custom-scripts.

akerosenqvist avatar akerosenqvist commented on August 26, 2024

from custom-scripts.

gmilcinski avatar gmilcinski commented on August 26, 2024

Thanks for the feedback. I have to say it represents very well our thinking behind moving from "simple for users" to "let's be strict and transparent in how data are processing", as discussed in this forum post.

With the "Simple script", as it is currently implemented in the repository, there are many things happening behind the scenes, without user knowing (for the purpose not to burden them....):

  • many parameters of the processing are stored in the Configuration utility (which backscatter coefficient is used, whether it works for IW or EW modes, whether orthorectification is "on", whether data in HIGH or MEDIUM resolution are used as an input,...). Sentinel Hub's "target user" is the application developer, who has access to Configuration utility and makes all these settings him/herself. The end-users (in this case EO Browser users) have no access to this.
  • mapping of the script outputs to the appropriate output format - e.g. in case of PNG, the outputs need to be [0,255], in 16-bit tiff [0,65535], in 32-float tiff it can be almost anything.
  • handling of the overflows and underflows
    ...

With EVALSCRIPT V3 and process API this is now all packed in the request itself, so that it should be perfectly clear.

For this specific script, as configured/executed in EO Browser, the request would be:


{
    "input": {
        "bounds": {
            "bbox": [
              -8120669.885017127,-6359560.753326664,-8110885.9453966245,-6349776.813706162
            ],
           "properties": {
                "crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
            }
        },
        "data": [
            {
                "type": "S1GRD",
                "dataFilter": {
                    "timeRange": {
                        "from": "2017-03-20T00:00:00Z",
                        "to": "2017-03-20T23:59:59Z"
                    },
                    "mosaickingOrder":"mostRecent",
                    "acquisitionMode":"IW",
                    "polarisation":"DW",
                    "orbitDirection": "ASCENDING",
                     "resolution": "HIGH"
                },
                "processing": {
                    "orthorectify": "true",
                   "backCoeff": "GAMMA0_ELLIPSOID",
                   "upsampling":"NEAREST"
                }
            }
        ]
    },
    "output": {
        "width": 512,
        "height": 512,
        "responses": [
            {
                "identifier": "default",
                "format": {
                    "type": "image/png"
                }
            }
        ]
    }
}

And EVALSCRIPT:

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

  function clamp(num, min=0, max=255) {
    return num <= min ? min : num >= max ? max : num;
  }

function evaluatePixel(samples) {
// script SAR false colors.
c1 = 10e-4;
c2 = 0.01;
c3 = 0.02;
c4 = 0.03;
c5 = 0.045;
c6 = 0.05;
c7 = 0.9;
c8 = 0.25;

band1 = c4 + Math.log (c1 - Math.log (c6 / (c3 + 2 * samples.VV)));
band2 = c6 + Math.exp (c8 * (Math.log (c2 + 2 * samples.VV) + Math.log (c3 + 5 * samples.VH)));
band3 =  1 - Math.log (c6 / (c5 - c7 * samples.VV));
return [clamp(255*band1),clamp(255*band2),clamp(255*band3)]; 
}

I hope this makes it clearer?

Note that you could very easily change the output format to UINT16 if you want more detailed results, you would just need to then also change the relevant parts of the EVALSCRIPT.

from custom-scripts.

akerosenqvist avatar akerosenqvist commented on August 26, 2024

from custom-scripts.

gmilcinski avatar gmilcinski commented on August 26, 2024

Hi Ake,
I talked with our SAR expert and he explained to me that:
-the gamma0 backscatter coefficient is unitless
-the "input" values in the script (sample.VV and sample.VH) are linear values (we have examples on how to conver them to dB values)
-the values are on the range of 0, most often being under 1, but sometimes going higher, e.g. above 100

I hope this helps?

If not, i would recommend a telecon between you and our expert so that you directly discuss potential questions.

Best,
Grega

from custom-scripts.

akerosenqvist avatar akerosenqvist commented on August 26, 2024

from custom-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.