Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDAL colour table warnings in test-save.R #261

Closed
achubaty opened this issue Oct 1, 2023 · 0 comments · Fixed by #262
Closed

GDAL colour table warnings in test-save.R #261

achubaty opened this issue Oct 1, 2023 · 0 comments · Fixed by #262

Comments

@achubaty
Copy link
Contributor

achubaty commented Oct 1, 2023

In attempting to address problems in saveSimList(), I am hitting multiple warnings emitted from GDAL.

══ Warnings ════════════════════════════════════════════════════════════════════
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
GDAL Error 6: /tmp/RtmpiATGsS/working_dir/Rtmph2K7Sm/reproducible/nKIe15aZ/file3961b4486b8363/0VMmKi67/file3961b419e323f5.tif, band 1: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─x@pnt$writeRaster(opt)
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
[writeRaster] change datatype to INT1U to write the color-table
could not write the color table
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─terra:::messages(x, "writeRaster")
 8.             └─terra:::warn(f, paste(unique(x@pnt$getWarnings()), collapse = "\n"))
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
GDAL Error 6: /tmp/RtmpiATGsS/working_dir/Rtmph2K7Sm/reproducible/nKIe15aZ/file3961b4486b8363/file3961b435b4e9ae.tif, band 1: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─x@pnt$writeRaster(opt)
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
[writeRaster] change datatype to INT1U to write the color-table
could not write the color table
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─terra:::messages(x, "writeRaster")
 8.             └─terra:::warn(f, paste(unique(x@pnt$getWarnings()), collapse = "\n"))
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
GDAL Error 6: /tmp/RtmpiATGsS/working_dir/Rtmph2K7Sm/reproducible/nKIe15aZ/file3961b4486b8363/file3961b44891dc7b.tif, band 1: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─x@pnt$writeRaster(opt)
── Warning ('test-save.R:316:3'): saveSimList with file backed objs ────────────
[writeRaster] change datatype to INT1U to write the color-table
could not write the color table
Backtrace:1. └─base::Map(...) at test-save.R:316:2
 2.   └─base::mapply(FUN = f, ..., SIMPLIFY = FALSE)
 3.     └─SpaDES.core (local) `<fn>`(nam = dots[[1L]][[4L]], i = dots[[2L]][[4L]])
 4.       ├─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S") at test-save.R:316:68
 5.       └─terra::writeRaster(mySim$landscape[[nam]], tmpfile[i + 1], datatype = "FLT4S")
 6.         └─terra (local) .local(x, filename, ...)
 7.           └─terra:::messages(x, "writeRaster")
 8.             └─terra:::warn(f, paste(unique(x@pnt$getWarnings()), collapse = "\n"))
d> sf::sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H           PROJ 
      "3.10.2"        "3.4.3"        "8.2.0"         "true"         "true"        "8.2.0" 

Additionally, none of these tests appear to be cleaning up after themselves. At the very least, working directories need to be reset and tempfiles deleted.

@achubaty achubaty changed the title GDAL warnings in test-save.R GDAL colour table warnings in test-save.R Oct 1, 2023
@achubaty achubaty linked a pull request Oct 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant