Rename/delete bands from product using a GRAPH-file

Hi all,

what would be the recommended way to rename or delete one or several bands from a product from within a graph-file processed with the GPT?

Thanks a lot for any suggestions.

Or, even better, I would like to replace an existing band in a product with a result coming from a BandMath operation.


This is not so easy, or maybe it is.
Create the new band with the BandMath operator as usual.
As next step you use the Subset operator to create a product without the band to be replaced.
Afterwards you merge the both results.
I’ve attached an example graph which shows how it should work.

Unfortunately you have to name all bands in the subset step except the one you want to replace.
In future releases it will be possible to define excludes in Merge operator.

math_subset_merge.xml (1.4 KB)

1 Like

Thanks! At the same time it seems that I also managed something similar using the BandSelect operator combined with a Merge. Nevertheless, it would be nice if future versions would indeed make life a bit simpler here :wink:


Is there a Rename function in Snap I can call with Python by any chance?
I need to rename a band labelled “band_1” to “B1” with Python. I can do it manually using the Snap software but I don’t find the Snap function I can call with Python.



1 Like

Hey @chloe. I am looking for a way to rename a band using snappy. Have you figured out a way by any chance?
( I know this is two years later )

You call


But you have to write a new product. The name is not changed in the original file.

1 Like

Just to add a useful little snippet for if you want to rename a product with a single band that you do not know the name.

inputfile = snappy.ProductIO.readProduct(“productIn.dim”)
snappy.ProductIO.writeProduct(inputfile, “productOut.dim”)