pack_minmax: Helper function to define packed data exports by min / max values
Description
This function can be used to define packed exports in write_ncdf
and write_tif. It will generate scale and offset values with maximum precision (unless simplify=TRUE).
target data type of packed values (one of "uint8", "uint16", "uint32", "int16", or "int32")
min
numeric; minimum value(s) of original values, will be packed to the 2nd lowest value of the target data type
max
numeric; maximum value(s) in original scale, will be packed to the highest value of the target data type
simplify
logical; round resulting scale and offset to power of 10 values
Details
Nodata values will be mapped to the lowest value of the target data type.
Arguments min and max must have length 1 or length equal to the number of bands of the data cube to be exported. In the former
case, the same values are used for all bands of the exported target cube, whereas the latter case allows to use different
ranges for different bands.