Create a new band in a BEAM-DIMAP product from another product's band

Hi,

Is it possible with the BEAM-DIMAP format inside Snap to add a band to a certain product from another product’s band (or merge two products inside the same product containing the aggregation of both products’ bands)?

Is it required to manually modify the product.dim xml file to add the new band to it, and copy the band.img and band.hdr from the other product inside the product.data folder? or is there an automatic way to do it?

Please note that if I add the band manually to the metadata xml file (product.dim) and copy its files (band.hdr, band.img) into product.data/, it’s getting recognized by Snap but I don’t know if there is a more efficient to add the band.

Thanks.

2 Likes

Hi hakim,
in the SNAP Desktop App you can use the Band Maths. Select the target product and in the expression editor you can choose the other product as source (if compatible). Make sure to uncheck the option 'Virtual (save expression only, don’t store data)’. This makes the new band a real band and independent from its source.

The same is also possible from the command line with gpt. Here you would need to use the BandMaths opertator and merge its result with your source product by using the Merge operator.

Cheers

2 Likes

Thanks.

It’s working on the GUI and from the command line when the two products are compatible.
However, I cannot guess what’s the criteria of compatibility? it doesn’t seem to be the type of the product.

They are compatible when they have the same width and height.

2 Likes

Hello,

How do I create a new product from others?
I have bands (B1, B2, B3, B4 …) in one product and other indices separated in other products, I would put them all in just one product. Can someone help me?
This is possible?

image

depends on their geocoding. If the data is georeferenced, you can use the “create stack” tool. Based on your file names, your products are optical imagery, so I would give it a try.

I’m not sure if the stack tool works because it has been developed for SAR data.

If you want to do this only once, you can create new bands in one of your products (perhaps the first one).
Select the product and then go to Raster / Band Maths.

Create a new band each of your indices and reference the band in the expression. You can reference other products if they are compatible (same image dimentions).

Make sure that you unmark the option Virtual (save expression only, don’t store data), otherwise you can’t use the band later.

If you want to do this regularly you can use the Merge operator and define a graph for it.
I attach an example of such a graph. Maybe it is already of value for you.
merge.xml (768 Bytes)

1 Like