Currently trying to perform Band Maths on a image using snappy.
When I do the maths in the SNAP Gui it works fine, however when I run it in python I get:
RuntimeError: org.esa.snap.core.gpf.OperatorException: Could not parse expression: '255*(Sigma0_VV<2.22E-2)'. Numeric operands expected for binary '*' operator.
This seems to be a bug, but not really.
There is a little difference between the expression parsing in the GUI and in the operator.
In the operator the type checking is enabled. It is checked if the arguments to the operators, like β*β, are of the expected data type.
The multiply expects numerical values. The expression within the braces evaluates to a boolean. Thatβs the reason why the error occurs. In the GUI the boolean is automatically converted to a numerical value and therefore it works.
So it is not really a bug, but it should be investigated why the operator does the type checking. Maybe there is some reason for it. I donβt know at the moment.
You could change your expression to
i try to do the following band math command:
threshold.expression = βif savi_indices_differencing >= 0.15 <= 0.35 then 1 else 0β
I get the message Numeric operands expected for binary β>=β operator.
I am experiencing a similar issue with band names that have a math symbol in them such as β-β. Is there a way to stop the bandmath parser evaluating for variable names?