# Ratio VH/VV from Sentinel1

Hello all,
I am interested in retrieving the ratio VH/VV from Sentinel1 in decibels using FIS. I have tried different ways to get these values but I didn´t succeed.
In the first place, I tried to get them straightaway using this code `return[10*Math.log(VH/VV)];` but I got a bunch of NA values.
Later on, I tried to make it in two steps. First, I get the linear ratio using `return [(VH/VV)];` and then I apply locally the conversion formula `𝜎0(𝑑𝐵)=10∗𝑙𝑜𝑔10𝜎0`. However the values I get doesn´t make sense.
Please, can anybody help me with this?
Cheers.

Note: I am using IW acquisition mode and DV polarization.

Can you give an example of the request (masking instance ID) so that we can check it?

It is something like this (I shortened the geometry for readability sake)

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?

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`.

1 Like

Thanks @marko.repse , that´s what I was looking for.