if (FALSE) {
caim <- read_caim() %>% normalize_minmax(0, 255)
write_caim(caim * (2^8 - 1), file.path(tempdir(), "test_8bit"), 8)
write_caim(caim * (2^16 - 1), file.path(tempdir(), "test_16bit"), 16)
# Note: values are scaled by (2^bit_depth - 1) to avoid the maximum bin,
# which read_caim() might turn NA.
}
Run the code above in your browser using DataLab