Expand description
Arithmetic band-math expression: parse (b5-b4)/(b5+b4) → RPN, eval per-pixel.
Grammar is arithmetic-only: + - * /, unary minus, parens, float literals, b<N>.
Numbers are plain decimals (2.5, 0.5); scientific notation (1e3) is not supported.
Enums§
- Token
- RPN token.
Band(i)is 0-indexed (sourceb1→Band(0)).
Functions§
- eval_
rpn - Evaluate RPN given per-pixel band values (
bands[i]= value of source band i+1). Caller must validatemax_band_ref < bands.len()once before the pixel loop; an out-of-range band defensively yields NaN (never panics). - max_
band_ ref - Highest 0-indexed band referenced, or None if no band refs.
- parse_
expression - Parse arithmetic and one-based band references (
b1,b2, …) into RPN.