Can you give an example of the request (masking instance ID) so that we can check it?
What happens in this case is that within the chosen polygon some VV values on some dates go to (exactly) 0. I figured this out by setting the configuration to
return [Math.log(VH/VV),VH,VV];
After running Statistical API, I noticed (looking at C1 and C2 components of the response) that some polygons have min value 0.
Log(0) is undefined, which then corrupts further processing of statistics.
The following Custom script works around this issue:
var vh_var = VH;
var vv_var = VV;
if (vh_var==0) vh_var=0.00000001;
if (vv_var==0) vv_var=0.00000001;
return [Math.log(vh_var/vv_var),VH,VV];
I configured S1-PRUEBA-DEBUG layer within your instance:
https://services.sentinel-hub.com/ogc/fis/<INSTANCE_ID>?LAYER=S1-PRUEBA-DEBUG&CRS=EPSG:4326&TIME=2017-07-01/2017-09-30&GEOMETRY=POLYGON((42.2761737982654±4.5769184322739,42.2776725087976±4.57599800560981,42.277313584786±4.57628383690692,42.2761737982654±4.5769184322739))&RESOLUTION=10m
Note: there is no point in using RESOLUTION=10m as S1 has natural resolution of 20m.
Actually, if you change the resolution to 20m, the original query will work as well, which means that 0 values probably come from interpolation.
https://services.sentinel-hub.com/ogc/fis/<INSTANCE_ID>?LAYER=S1-PRUEBA&CRS=EPSG:4326&TIME=2017-07-01/2017-09-30&GEOMETRY=POLYGON((42.2761737982654±4.5769184322739,42.2776725087976±4.57599800560981,42.277313584786±4.57628383690692,42.2761737982654±4.5769184322739))&RESOLUTION=20m
Thanks
There are values in every date now. But, just to double check, using the formula in S1-PRUEBA-DEBUG, the data I get is in decibels?
No, the VV and VH values are sensor values. See this page for more information.
To get values in decibels, check this thread
.
The S1 values (e.g. VV) are in linear gamma0.
So to convert to decibels you need the conversion formula in your first post:
var val = vh_var / vv_var;
var ratioDB = 10 * Math.log(val) / Math.LN10;
Then you can return the ratioDB value and that should be the value in decibels of the ratio. Note that the Math.log
in javascript is in base e
.
Thanks, that´s what I was looking for.