Last updated on 2025-04-22 19:52:09 CEST.
Package | ERROR | OK |
---|---|---|
rgrass | 1 | 12 |
Rsagacmd | 13 |
Current CRAN status: ERROR: 1, OK: 12
Version: 0.5-2
Check: examples
Result: ERROR
Running examples in 'rgrass-Ex.R' failed
The error most likely occurred in:
> ### Name: read_RAST
> ### Title: Read and write GRASS raster files
> ### Aliases: read_RAST write_RAST
> ### Keywords: spatial
>
> ### ** Examples
>
> # Run example only if GRASS settings file indicates that the
> # nc_basic_spm_grass7 location is active
> run <- FALSE
> GISRC <- Sys.getenv("GISRC")
>
> if (nchar(GISRC) > 0) {
+ location_name <- read.dcf(GISRC)[1, "LOCATION_NAME"]
+ if (location_name == "nc_basic_spm_grass7") {
+ run <- TRUE
+ }
+ }
>
> # store original environment variables before modifying
> GV <- Sys.getenv("GRASS_VERBOSE")
> Sys.setenv("GRASS_VERBOSE" = 0)
> original_ignore_stderr <- get.ignore.stderrOption()
> set.ignore.stderrOption(TRUE)
[1] FALSE
>
> if (run) {
+ # Retrieve GRASS metadata and creata a new mapset
+ meta <- gmeta()
+ location_path <- file.path(meta$GISDBASE, meta$LOCATION_NAME)
+ previous_mapset <- meta$MAPSET
+ example_mapset <- "RGRASS_EXAMPLES"
+ execGRASS("g.mapset", flags = "c", mapset = example_mapset)
+ }
>
> if (run) {
+ # List available mapsets and raster maps
+ mapsets <- unlist(
+ strsplit(execGRASS("g.mapsets", flags = "p", intern = TRUE), " ")
+ )
+ print(mapsets)
+ }
>
> if (run) {
+ execGRASS("g.list", type = "raster", pattern = "soils", flags = "m",
+ intern = TRUE)
+ }
>
> if (run) {
+ execGRASS("g.list", type = "raster", pattern = "soils@PERMANENT",
+ mapset = ".", flags = "m", intern = TRUE)
+ }
>
> if (run) {
+ execGRASS("g.list", type = "raster", pattern = "soils",
+ mapset = "PERMANENT", flags = "m", intern = TRUE)
+ }
> # Read/write the GRASS "landuse" dataset as a SpatRaster
> if (require("terra", quietly = TRUE)) {
+ if (run) {
+ v1 <- read_RAST("landuse", cat = TRUE, return_format = "terra")
+ print(v1)
+ print(inMemory(v1))
+ }
+
+ if (run) {
+ write_RAST(v1, "landuse1", flags = c("o", "overwrite"))
+ execGRASS("r.stats", flags = "c", input = "landuse1")
+ execGRASS("g.remove", flags = "f", name = "landuse1", type = "raster")
+ }
+ }
Flavor: r-release-windows-x86_64
Current CRAN status: OK: 13