Visualization / Statistical Info


#1

Dear colleagues.

I have a couple of questios that I would be pleased to solve. First of all, I am Forestry Engineer without knowledge on IT; just a basic knowledge. Sorry in advance.

Question 1
I am managing to visualize a script, found at Github web, on a color scale, such as red (lower values) to green (higher values). The script is made for grey scale (dark for lower values and light to higher). The script is: https://github.com/sentinel-hub/custom-scripts/tree/master/sentinel-2/fapar

How could I modify the script to get a red to green visualization?

Question 2

Another question is regard to how to get statistic info (graphs) at EO-BROWSER. What are the system requirements to enable it? I guess that I need to make changes at script. I realized that statistical info is available when I type the script as custom instead use a layer.

Thanks in advance.


#2

For red/green visualization of FAPAR you need to change two parts of the script:

  1. Change output settings from “1-band” (e.g. gray scale) to “3-band” (red,green,blue).
    You do this by changing
    componentCount: 1
    to
    componentCount: 2
    in setup part.

  2. Use colorBlend function for the output

I am not familiar with FAPAR algorithm as such so I do not know, what are typical output values. But assuming that you would like to map “0” to red and “1” to green (and everything in between proportionally), you have to replace
return {
default: [fapar]
}

with
return {
default: colorBlend(fapar, [0, 1], [[1,0,0],[0,1,0]]);
}

See this page for more information:
https://www.sentinel-hub.com/develop/documentation/api/custom-evaluation-script


#3

Hi unap,

as of your 2nd question:

To get statistical info for a layer in EO Browser a corresponding “FIS” layer needs to be configured as explained here: https://www.sentinel-hub.com/develop/documentation/faq#t34n451

For your own (i.e. custom) layers, you will have to configure FIS layers in your Configuration Utility.

For some of the default layers in EO Browser, we have configured FIS layers (where we thought it makes sense to display statistical info). If you miss statistical info for any of the default layers, please let us know for which particular and we will check and add it.


#4

I have a question when using custom layers FIS.

According to your instructions they display the values for the NDVI, but how ca i specify another INDEX layer?
I want to get statistical information from the PSRI layer, what code do I need to put in my FIS layer?

Thanks!


#5

Hi nilsfernquist,

based on https://www.indexdatabase.de/db/i-single.php?id=69 , we assume that Sentinel-2’s bands B02, B04 and B06 (note that we used to use B05 in the predefined product) shall be used to calculate Plant Senescence Reflectance Index (PSRI) as:

PSRI = (B04 - B02) / B06

Custom script for a corresponding FIS layer shall then be:

return [(B06 > 0) ? (B04 - B02) / B06 : JAVA_DOUBLE_MAX_VAL];

If prefer custom scripts v2 (https://www.sentinel-hub.com/develop/documentation/api/custom-evaluation-script) you could use the code below:

//VERSION=2
function setup(ds) {
return {
        components: [ds.B02, ds.B04, ds.B06], 
        output: [ 
            {
                id: "default",
                sampleType: SampleType.AUTO,
                componentCount: 1
            }
         ],
        normalization: false 
    };
}

function evaluatePixel(samples) {
    return {
        default: [(samples[0].B06 > 0) ? (samples[0].B04 - samples[0].B02) / samples[0].B06 : JAVA_DOUBLE_MAX_VAL],   
    }; 
}

Both scripts shall return identical results.