Skip to contents

The value a COG holds for a source value: "trunc" is what terra does when it writes a double into INT1U (verified on 512,073 pixels of an AquaMaps model: every pixel equals trunc(val), only 54% equal round(val)); "round_trunc" rounds half-to-even first, as ingest_aquax.qmd and the suitability-only merged paint do (round() in R is half-to-even, so round_even here); "none" keeps the value (a Float32 as-delivered raster). Integer modes cap at 255.

Usage

pixel_quant_sql(expr = "val", quant = c("trunc", "round_trunc", "none"))

Arguments

expr

SQL expression for the source value (default "val")

quant

"trunc", "round_trunc" or "none"

Value

a SQL expression string yielding a DOUBLE

Examples

pixel_quant_sql("val", "trunc")
#> [1] "CAST(trunc(LEAST(val, 255)) AS DOUBLE)"