Add bands together in snappy

In SNAP Desktop, I can form an RGB image of Sentinel-1 bands by choosing

RED: Amplitude_VH_S
GREEN: Amplitude_VV_S
BLUE: Amplitude_VH_S+Amplitude_VV_S

I know how to read in bands and form RGB imageswith snappy in python.
What I don’t know, how to add together bands Amplitude_VH_S+Amplitude_VV_S ?

You can either us the Band Maths operator to create a new band which contains the sum of both or you read the data and iterate over the pixels and you add the values.
How you can read and calculate with band data is shown in this example:

Don’t overlook the gpt command line tool for bandmaths: SNAP command-line tutorial; pconvert is used to convert a BEAM DIMAP file with the new bands to RGB images.

Thank you!
Could you give me a code snippet, how is Band Maths operator used? I’m sorry, I’m so new to using snappy :slight_smile:

The default location for snappy examples is %USERPROFILE%\.snap\snap-python\snappy\examples for Windows CMD, $env:USERPROFILE\.snap\snap-python\snappy\examples for Windows PowerShell, $HOME\.snap\snap-python\snappy\examples for Linux and macOS:

PS C:\> dir $env:USERPROFILE\.snap\snap-python\snappy\examples\*.py

    Directory: C:\Users\xxxxx\.snap\snap-python\snappy\examples

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          2021-02-03  3:36 PM           2127
-a---          2021-02-03  3:36 PM           1461
-a---          2021-02-03  3:36 PM           1507
-a---          2021-02-03  3:36 PM           1891
-a---          2021-02-03  3:36 PM           2087
-----          2020-06-22  1:38 PM           2236
-a---          2021-02-03  3:36 PM            784
-a---          2021-02-03  3:36 PM            784
-a---          2021-02-03  3:36 PM           3186