Write a new band to a subfolder in Sentinel tree

Hi everyone,

I have created a new band based on a Sentinel band and then saved it to a new Product using snappy in Python. As I want to maintain the original bands in the Sentinel image, I read in the bands to a new product, write the band using newband.setPixels, then save my product with ProductIO.writeProduct.

This works well, but it saves my band in the Bands folder of the new Product (see screenshot). I would like to create a new subfolder where I can store my bands; for it to be easier to use in SNAP. For example in the attached image, I would like my new band to go in a new subfolder similar to the radiance an, rather than below the flags at the bottom.

How can I specify this in my python code?

Cheers,

Max

For the groups is the so called auto-grouping responsible.
You can define a pattern which defines the the group.
call for example:

product.setAutoGrouping(“TOA_REFL:TOC_REFL:VAA:VZA”);

This will create the groups TOA_REFL, TOC_REFL, VAA, VZA.
Have also a look at the javadoc, please.

You can experiment with it in the GUI.
Open the context menu of the product and choose Properties.
There you can edit the Band Grouping.

1 Like