Snappy: BandMaths 'validExpression' does not work

Hello all

I have been learning to apply GPF tools using snappy module and have been struggling a little in figuring out the syntax of different GPF operators. For example, when I use BandMaths operator in python, I encounter a problem.

The following is the code I used:

targetBand = BandDescriptor() = ‘CI’
targetBand.type = ‘float32’
targetBand.expression = ‘water ? (reflec_7-reflec_8) + (reflec_9 - reflec_7)*(680-664)/(708-664): NaN’

targetBands = jpy.array(‘org.esa.snap.core.gpf.common.BandMathsOp$BandDescriptor’, 1)
targetBands[0] = targetBand

params = HashMap()
params.put(‘targetBands’, targetBands)
result = GPF.createProduct(‘BandMaths’, params, product)

I noticed that the ‘target.validExpression’ line is not working. Can someone please provide guidance as to what is the appropriate way to use validExpression by using snappy?