could not parse expression: 'if "cloud_in" < 1 then 1 else 0'. Numeric operands expected for binary '<' operator

Hi there,
I tried to use BandMath for cloud masking using the following equation:
‘if “cloud_in” < 1 then 1 else 0’
But an error occurred:
<…Could not parse expression: ‘if “cloud_in” < 1 then 1 else 0’. Numeric operands expected for binary ‘<’ operator.>
Anyone experienced the same error?

Thanks

have you tried with brackets?

IF (“cloud_in” < 1) THEN 1 ELSE 0

or without quotes:
if cloud_in < 1 then 1 else 0

@marpet @ABraun neither brackets nor without quotes change anything unfortunately

This works:

But it might be easier to directly use the mask ‘cloud_in_visible’.
To invert its value simply use
!cloud_in_visible

Dear Mr. Peters. I do appreciate your reply, but it looks like there’s an issue with using the band math operator inside the graph builder, which is solvable by using the Band-math operator separately.

That’s true that there are issues with the Graph Builder. This wasn’t yet mentioned in this thread

1 Like