Two if statements in Band Maths

I am working with Sentinel-1 imagery and I would like to cut off all values below 0.001 and above 0.3 using BandMaths in graph builder. The two if statements would look like this:
if Sigma0_HH>0.3 then 0.3 else Sigma0_HH
if Sigma0_HH<0.0001 then 0.0001 else Sigma0_HH.

However I can’t figure out a way to combine them so I would have one band that with all values above 0.3 assigned 0.3 and all values below 0.0001 assigned 0.0001.

Any suggestions would be much appreciated.

Thank you!

I have figured out this issue by using BandMaths twice. However NaN values are also being converted to 0.0001. How do I keep NaNs as NaNs? Thank you!

I figured out the whole issue now. I hope this is helpful to someone:

b1 == NaN? 9999: (b1 <= 0.0001? 0.0001:(b1 >= 0.3 && b1< 9998? 0.3: (b1==9999? NaN: b1)))

It goes like this: Is b1 is equal to NaN? then give it 9999. Otherwise, is b1 less than or equal to 0.0001? if yes, give 0.0001 otherwise, is b1 greater than 0.3 and less than 9998? if yes, give 0.3. Is b1 equal to 9999, if yes give NaN. Otherwise keep itself (b1).

3 Likes