Sentinel -1 infinity value pixels

Hello,

Many times I encounter an issue with the sentinel-1 images, when I get infInity value pixels. I have tried in the past to avoid it by adding 0.00001 to the vh bands, however it is not real solution.
I wonder what is the cause of these values in sentinel-1 and if there is any efficient way to deal with this issue.
It may be that I do something wrong with the pre-processing of the image because I wrote it long time ago before the lee filter was added.

This is the evalscript I use

//VERSION=3

function setup() {
    return {
        input: ["VV", "VH"],
        output: {bands: 2, sampleType: "FLOAT32"}
    }
}

function evaluatePixel(sample) {
    const vv = 10 * Math.log(sample.VV) / Math.LN10;
    const vh = 10 * Math.log(sample.VH + 0.00001) / Math.LN10;
    return [vv, vh];
}

Best

Reut

Hi Reut,

In your Evalscript, you are converting the linear backscatter intensity to decibels. To do so, you use the formula:

VHdB = 10 * log(VH)

If the backscatter intensity of a pixel is equal to 0, you will get infinity in dB, because:

" log 0 is undefined . It’s not a real number, because you can never get zero by raising anything to the power of anything else. You can never reach zero, you can only approach it using an infinitely large and negative power." [Source: University of Minnesota].

If we look at an image and highlight the pixels where the intensity is zero, we see that there can be quite a lot over water or desert areas (example).

PS: our Evalscripts now support an easier method to convert to decibels: instead of having to do

let vv = 10 * Math.log(sample.VV) / Math.LN10;

you can do

let vv = 10 * Math.log10(sample.VV);

3 Likes

Hi, this is an old post but I think the question here is how to mask certain values (e.g., 0) in statistical API.
In other words, how to tell the statistical API - calculate min, max, mean, etc. only on “valid” values.

Hi @org_accounts ,

Please have a look at the example request in our documentation. To mask invalid values when making a statistical request, you can initiate a variable, valid_mask, with value 1 and reassign 0 to it whenever there’s an invalid value, e.g., if (!isFinite(vv_decibels)) {valid_mask=0}. Then, you just need to return {dataMask: [sample.dataMask * valid_mask]} in the evaluatePixel function and the Statistical API will treat invalid values as no data.