gdalraster icon indicating copy to clipboard operation
gdalraster copied to clipboard

Error from plot_raster() if called on a raster dataset with complex data type

Open ctoney opened this issue 1 year ago • 0 comments

If input to plot_raster() is a GDALRaster object for a raster with a complex data type (e.g., CFloat32):

plot_raster(ds)
#> Error in min(x, na.rm = TRUE) : invalid 'type' (complex) of argument

Can be worked around by first reading the pixel data and passing a representation of it to plot_raster(), e.g.,

r <- read_ds(ds)
r.angle <- Arg(r)
# the "gis" attributes may be needed
attributes(r.angle) <- attributes(r) 
plot_raster(r.angle)

Should at least document and return a useful error message from plot_raster(), or add a pixel function argument.

ctoney avatar Aug 13 '24 05:08 ctoney