rio_tiler.expression
rio_tiler.expression ¶
rio-tiler.expression: Parse and Apply expression.
apply_expression ¶
Apply rio-tiler expression.
Args:
blocks (sequence): expression for a specific layer.
bands (sequence): bands names.
data (numpy.array): array of bands.
Returns:
-
MaskedArray
–numpy.array: output data.
get_expression_blocks ¶
parse_expression ¶
Parse rio-tiler band math expression.
Parameters:
-
expression
(str
) –band math/combination expression.
-
cast
(bool
, default:True
) –cast band names to integers (convert to index values). Defaults to True.
Returns:
-
tuple
(Tuple
) –band names/indexes.
Examples:
>>> parse_expression("b1;b2")
(2, 1)
>>> parse_expression("B1/B2", cast=False)
("2", "1")