This might be intentional/documented behaviour? I ran into this through a Raster where that is not really obvious.
using ArchGDAL
out = "/tmp/jl_u5ihOBCFCl.tif"
width, height = 100, 100
data = fill(-1, width, height) # (rows, cols)
driver = ArchGDAL.getdriver("GTiff")
ArchGDAL.create(out; driver, width, height, nbands = 1, dtype= UInt8) do ds
band = ArchGDAL.getband(ds, 1)
ArchGDAL.write!(band, data)
end
# similarly
ds = ArchGDAL.readraster(out; flags = ArchGDAL.OF_UPDATE)
ds[1] === 0x00
ds[1,2] = 1e10 # no error
ds[1,2] === typemax(UInt8) # value is clamped to max
close(ds)
Values that cannot be represented by the eltype of a data silently clamped to
typeminandtypemax, where I would expect anInexactErroras with other array types.This might be intentional/documented behaviour? I ran into this through a Raster where that is not really obvious.
MWE