Dear all
I am having problems to translate an expression from GUI to snappy for Bandmaths operator.
Unfortunately, reading on the old topics, where @marpet suggested some solution, I couldn’t find a way to solve out that.
I have this expression in GUI
“if sr_b2 < 0 then sr_b2 == 0 else sr_b2”
and it put just the negative values of sr_b2 to 0, without changing the positive ones. For GUI, it works well and I get the values as expected.
How can I translate this expression in BandMathsOp in snappy?
My code for snappy is (following one of your examples):
parameters = HashMap()
BandDescriptor = snappy.jpy.get_type('org.esa.snap.core.gpf.common.BandMathsOp$BandDescriptor')
targetBand1 = BandDescriptor()
targetBand1.name = 'test'
targetBand1.type = 'float32'
targetBand1.expression = ??????
targetBand1.noDataValue = 0.0
targetBands = snappy.jpy.array('org.esa.snap.core.gpf.common.BandMathsOp$BandDescriptor', 1)
targetBands[0] = targetBand1
parameters.put('targetBands', targetBands)
output = snappy.GPF.createProduct("BandMaths", parameters, input)
Thank you in advance for your help.
S Savastano