Replace NaN and Infinity with GPT BandMaths

I’m getting a lot of infinity values output from a SNAP processor that are causing issues downstream. I can catch and fix them downstream but it is slow. I think it might be easier to fix them in GPT.

In the SNAP BandMath GUI I see an option to Replace NaN and infinity results by [ NaN].

I do not see an obvious GPT analog when I run gpt -h BandMaths. Is there an analog to this GUI option?

There is not such an option. But you can use the inf(@) function in an expression to test the value.
Something like:

inf(Band_0) ? NaN : Band_0

Is there a way to do this for all bands without knowning how many will be passed in to the processor? Many processors just take a source and operate on all bands. It doesn’t look like I can do that with BandMaths, is this correct?

Yes, this is correct. It can’t be done for all bands.