How to Merge two mask bands?

I have two mask bands from two products obtained from the BandMath. How can I combine or merge them into one mask band?
If I multiply or sum those two bands, the result doesnt seem correct.


if 1 is water and 0 is non-water a multiplication should find spots where both scenes are 1. If they do not cover the same area this could lead to problems. Have you tried an addition?

Why do you think the result is not correct?

1 Like

The first problem is that each bandmath operation works for one Product. If I have two products for the same area, I am not able to use the bandmath obtained from each product at the same time.

Product1> band1

Product2>band 2

In bandmath, I can work only on One Target Product at the time. So, saying sth like band1+band2 is not possible

you could make a layer stack: Raster > Geometric Operations > Collocation
And afterwards, you have one Product with both bands.

1 Like

Thanks a lot. Do you know by any chance the python or snappy codes for the Collocation? And also for Calibration? Thanks again

personally not, but some of it is explained here:

sorry for the formatting in the source.

1 Like

It was a great help. Thanks again

I want to get the difference of two products in band maths but in target product I can load only one product is there any way?

to combine rasters of two products in the band maths, they should

  • either have the same extent and pixel numbers (rows/columns), then you can use the extended band maths (see Figure 23 of this tutorial)
  • be merged into one product using the collocation tool (see Figure 21 of this tutorial)