Change values of 0 to NaN to apply BandMaths

Hi all,

I am currently trying to generate mean maps of turbidity for each month of a year. I am working with outputs from ACOLITE which I am importing into SNAP to show turbidity values per pixel.

My problem is as follows: When using band maths I am applying a simple equation to generate an output showing the mean turbidity values ((a) + (b) + (c))/3.

My problem is, that when a pixel has a value of 0 because it was not processed in Acolite due to cloud cover the value of 0 is included in the equation and lowers the mean value output.

For example, when having the following values input in the equation: (0 + 1 + 2)/3

The mean value generated by SNAP is 1, because it calculates the equation exactly as it is put in.

To have accurate results however, I need SNAP to not count the pixels with no value as 0’s but as not available numbers. Referring back to the example in the equation above, the equation would need to change to (NAN + 1 + 2)/ 2 with an output of 1.5.

Does anyone know how to put this into the band math/ graph builder tab correctly to get a correct output ?

Any help is very much appreciated !

Hi,

that 0 is considered as NaN is easily doable. You can go to the properties of the band (context menu) and the specify a no-data value. This will make all 0 values look transparent in the image view.
But If you do so, the result of your calculation will be NaN too, if one of band values is NaN.

Have you thought about to use the L3 Binning processor (Raster / Geometric) for your monthly averages? It is inteded for such a use case.