Band Maths ignoring nan

I’ve tried to calculate an average of 3 different products with the following statement:

avg(band1,$2.band1,$3.band1)

My problem is that each product has different pixel set to nan. Currently all pixel which have nan in one of the products is set to nan in the output product.

Now my question, is it possible to calculate the average ignoring the nan values? This would lead to a result where there is only nan if all products have the pixel set to nan.

You would have to go to the properties of each of the bands and uncheck
“use nodata value” and you may or may not need to save the products.

I will try, thanks for the answer.

Hi,

is it possible to give this option to the Write operator in an xml file for usage with gpt? In a sense that I use an operator and I want that the outputfile does not use the nodata for average calculations?

My intention is to use such an outputfile on the stack average and ignore nan values from some layers which might have data gaps.

Thanks in advance!

2 Likes