Skip to main content

Hello,

I am investigating soil moisture provided on the sentinel hub (custom-scripts/sentinel-1/soil_moisture_estimation at master · sentinel-hub/custom-scripts · GitHub)

I am getting RGB values, I am not looking for RGB values

Can anyone help me to get images with no RGB values?

Thanks in advance

Regards,
 

Hello,


Looking at the content of the script we can see that it is built in 2 parts within the evaluatePixel function. The first part calculates the Soil Moisture Mv (up to line 69) and the second part assigns RGB colours to the Soil Moisture values.


To obtain the actual values and not a visual representation of them, you need to adjust the script in 3 places:



  1. In the setup function, return 1 band. We don’t need to return 3 bands for R, G, and B anymore.




  2. To return the float values of your index, add the sampleType to the setup function and set it to FLOAT32. For information about how to do this, you can refer to the dedicated documentation page.




  3. Remove the part of the evaluatePixel function that converts Mv to RGB values (lines 70 - 128) and return nMv];



The steps above will allow you to return the actual Soil Moisture values.


Hello!

I tried evalscript by changing the code according to the above suggestions. I am getting float values

But, in function evaluate pixel i am getting value for only one sample and sample length is one

Can you help me to get data for all the samples?

Geocoordinates: [
[
[
22.15824272207999,
47.81500659533405
],
[
22.15352182669814,
47.81309449976609
],
[
22.15831496640176,
47.80774285437486
],
[
22.16309230445743,
47.80964243580001
],
[
22.15824272207999,
47.81500659533405
]
]
]

Thank you in advance

Regards,
 


I am not sure what you mean about getting multiple samples.


Indeed, “The algorithm relates the change in backscatter intensity to the change in moisture” by computing the minimum, maximum and sum of VV values over the time range. Then it uses the latest acquisition in your time-range, as well as the min and sensitivity to compute soil moisture:


Mv = ((samplesp0].VV) - min)/(sensitivity);

If you pull out Mv for earlier acquisitions in the script you will be computing your values with different time-ranges, and I am not sure that would be a robust method.


If you want to do this nevertheless, you can modify Mv = ((samplesp0].VV) - min)/(sensitivity); for it to read different acquisitions, for example samplesp1].VV and return the response to a different variable. Then you would return these variables as bands.


Thank you,

I apologize for not making it clear

I tried modifying Mv = ((samples[0].VV) - min)/(sensitivity); samples[1].VV`but i am getting nan values for samples[1].VV.

But for samples[1].VV we are getting nan values


Can you state the time-range you are using, or better the request you are trying to run? I’m asking because for me it works with samplese1].


I got the result samples[1].VV by following the sentinel hub document

Thank you for guiding me

Regards,
 


Reply