Dear Reut,
the FLOAT32 does not only include values between 0 and 1, but all values between -2^32 to +2^32, including all the decimals in between. That’s why this format takes the most space.
The reason your values are not negative is that the visualization returned by the data product (return [Math.max(0, Math.log(linear) * 0.21714724095 + 1)]
) maps decibel values to a range of 0-1, which is most suitable for visualization using simple scripts or scripts with sampleType:AUTO
, such as for example in EO Browser.
To get decibel values from -20 to 0, you would have to return decibel values, and not a script optimized for visualization, with the following formula: return [10 * Math.log(linear) / Math.LN10]
(with linear being e.g. VV
).
The script to use to convert VV linear values to decibels would be:
//VERSION=3
function setup() {
return {
input: [{
bands: ["VV"]
}],
output: {
bands: 1,
sampleType: "FLOAT32"
}
}
}
function evaluatePixel(samples){
return [10 * Math.log(samples.VV) / Math.LN10]
The values of linear polarizations, such as VV and VH (if you were simply returning return [VV]
), would typically be between 0 and 0.5.
If we map these values using the equation for decibel conversion (10 * Math.log(samples.VV) / Math.LN10
), we get:
0.1 -> -9.999999999999998
0.2 -> -6.9897000433601875
0.3 -> -5.228787452803376
0.5 -> -3.0102999566398116
In radar, some pixels can have extreme reflectance values - either very high, or very low. So just as pixel values can be higher than 1 for VV, so can decibel values be higher than 0, or lower than -20. Let’s see what the following extreme values would return:
0.00001 -> -50
2 -> 3.0102999566398116
445 -> 26.483600109809313
However, typically, your decibel values will be in a general range -20 to 0, as that’s typical for most pixels.
On another note, the data product title does say “decibel visualization from -20 to 0”, which might be a bit confusing, but what is meant is that the equation converting values to decibels in a typical range from -20 and 0 is modified for the visualization - mapped to values from 0-1.
I hope this helps.
Best,
Monja