Setting use of no-data in snappy

Hello,

I am trying to run a postprocessing job on a custom S1 dataset.

For this, I need to specify the unit and no-data values (and use) of each band.
With SNAP, everything is working fine.

I am trying to loop in python /snappy, and while I manage to set the unit per band with:
p = ProductIO.readProduct(fn)
p.getBand(‘band_1’).setUnit(‘db’)

I can’t find the correct syntax to set the No-Data Value Used to ‘True’, as well as the No-Data Value

Thank you in advance for your answers
Benjamin

Hi,
The way to do is is like:

You have two options to set the no data value one is by setting the raw (unscaled) value.
p.getBand(‘band_1’).setNoDataValue(rawValue)

Or you use geophysical value.
p.getBand(‘band_1’).setGeophysicalNoDataValue(geophysicalValue)

The values which are shown in SNAP are the geophysical ones. So maybe you want to use this method.

You also need to switch one the usage of this value.
p.getBand(‘band_1’).setNoDataValueUsed(True)

Thank you very much, this is the solution I was looking for
Best