From 21bfbb0bc77934f62603e34cd82bc5f329317360 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 12:43:35 -0500 Subject: [PATCH 01/14] Update citation --- README.md | 4 ++-- inst/CITATION | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index bb8b2609..53009fe8 100644 --- a/README.md +++ b/README.md @@ -189,8 +189,8 @@ Note that the `M1.M2` and `S1.S2` increment independently. For example, if the v * The Wiki on [how to run `GRASS` in `R` or `R` in `GRASS`](https://grasswiki.osgeo.org/wiki/R_statistics/rgrass) will help you to become a power-user of `GRASS` in `R`. # Citation -A publication is forthcoming! In the meantime, please see and cite: +Please see and cite: -Smith, A.B. 2025. `fasterRaster`: GIS in `R` using `GRASS` for large vectors and rasters. EarthArXiv preprint doi: 10.31223/X52R0M +Smith, A.B. 2025. `fasterRaster`: GIS in `R` using `GRASS` for large vectors and rasters. *Transactions in GIS* 30:e70238. 10.1111/tgis.70238, EarthArXiv open-access preprint doi: 10.31223/X52R0M ~ Adam diff --git a/inst/CITATION b/inst/CITATION index dd231a73..deffe198 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,15 +1,18 @@ -key <- paste0("R-", meta$Package) -year <- sub("-.*", "", meta$Date) note <- sprintf("R package version %s", meta$Version) -title <- paste0(meta$Package, ": ", meta$Title) citHeader("To cite fasterRaster in publications use:") -bibentry(bibtype = "Manual", - key = key, - title = title, +bibentry( + bibtype = "Article", + title = "fasterRaster: GIS in R using GRASS for large vectors and rasters", author = person(given = "Adam B.", family = "Smith", - comment = c(ORCID = "0000-0002-8215-2053")), - year = year, - note = note + email = "adam.smith@mobot.org", + comment = c(ORCID = "0000-0002-8215-2053") + ), + journal = "Transactions in GIS", + year = "2026", + volume = "30", + pages = "e70238", + doi = "10.1111/tgis.70238", + note = note ) From 0e099e605ff9f1e334b869342a61253fd71deae5 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 12:43:54 -0500 Subject: [PATCH 02/14] Fix bug where now was forced to ceiling(ncol) --- R/resample.r | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/resample.r b/R/resample.r index d990cf90..71c643a4 100644 --- a/R/resample.r +++ b/R/resample.r @@ -62,7 +62,7 @@ methods::setMethod( } else { tbres <- t <- b <- NA_real_ } -### NEED TO EXTENT TO ENCOMPASS x IF ITS EXTENT IS OUTSIDE THIS +### NEED TO EXTEND TO ENCOMPASS x IF ITS EXTENT IS OUTSIDE THIS w <- W(y) e <- E(y) s <- S(y) @@ -92,7 +92,7 @@ methods::setMethod( rows <- (n - s) / nsres if (!omnibus::is.wholeNumber(cols)) cols <- ceiling(cols) - if (!omnibus::is.wholeNumber(rows)) cols <- ceiling(rows) + if (!omnibus::is.wholeNumber(rows)) rows <- ceiling(rows) e <- w + cols * ewres s <- n - rows * nsres From 41e477a60bff94b987f757ba4109eec78d4a8e28 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 12:44:00 -0500 Subject: [PATCH 03/14] Fix help --- R/subset_single_bracket.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/subset_single_bracket.r b/R/subset_single_bracket.r index 01756314..9c79ee05 100644 --- a/R/subset_single_bracket.r +++ b/R/subset_single_bracket.r @@ -44,7 +44,7 @@ methods::setMethod( .message( msg = "subset_square_bracket", message = -"The GVector returned by `[` (subset_single_bracket) may have the order of items in\n its data table changed from the order they appear in the index used to select features.\n For example, if you use `vector[3:1]`, the results will be as per`vector[1:3]`. If this\n message appeared after you called a function other than `[`, you can probably ignore it." +"The GVector returned by `[` (subset_single_bracket) may have the order of items in\n its data table changed from the order they appear in the index used to select features.\n For example, if you use `vector[3:1]`, `vector[1:3]`. If this\n message appeared after you called a function other than `[`, you can probably ignore it." ) } From 1b66d5f1e46f7f1ef116f695f5518b0af06d6eb5 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 12:54:39 -0500 Subject: [PATCH 04/14] Expose previously-private `makeGRaster()` and `makeGVector()` Changed `.makeGRaster()` and .makeGVector()` to public functions (and lost the "dot" before the function names). --- R/00d_GRaster_class.r | 16 ++++++++++------ R/00e_GVector_class.r | 14 +++++++++----- R/04_arithmetic.r | 2 +- R/05_GRaster_functions_by_layer.r | 16 ++++++++-------- R/06_GRaster_functions_across_layers.r | 12 ++++++------ R/07_comparison.r | 4 ++-- R/aggregate.r | 4 ++-- R/app.r | 2 +- R/as.contour.r | 2 +- R/as.int.r | 2 +- R/as.lines.r | 2 +- R/as.points.r | 4 ++-- R/as.polygons.r | 2 +- R/bioclims_GRaster.r | 2 +- R/buffer.r | 6 +++--- R/cellSize.r | 2 +- R/centroids.r | 4 ++-- R/classify.r | 2 +- R/cleanGeom.r | 2 +- R/clump.r | 2 +- R/compositeRGB.r | 2 +- R/concats.r | 2 +- R/connectors.r | 2 +- R/convHull.r | 4 ++-- R/copyGSpatial.r | 2 +- R/crds.r | 2 +- R/crop.r | 4 ++-- R/delaunay.r | 2 +- R/denoise_noise.r | 2 +- R/disagg.r | 2 +- R/distance.r | 4 ++-- R/erase.r | 2 +- R/extend.r | 2 +- R/extract.r | 2 +- R/fast.r | 8 ++++---- R/fasterRaster.r | 2 ++ R/fillHoles.r | 2 +- R/fillNAs.r | 2 +- R/flow.r | 2 +- R/flowPath.r | 2 +- R/focal.r | 2 +- R/fractalRast.r | 2 +- R/fragmentation.r | 2 +- R/geomorphons.r | 2 +- R/grid.r | 2 +- R/hexagons.r | 2 +- R/hillshade.r | 2 +- R/horizonHeight.r | 2 +- R/init.r | 2 +- R/interpIDW.r | 2 +- R/interpSplines.r | 4 ++-- R/intersect.r | 2 +- R/kernel.r | 2 +- R/longlat.r | 2 +- R/mask.r | 4 ++-- R/maskNA.r | 2 +- R/match.r | 6 +++--- R/merge.r | 2 +- R/multivarEnvSim.r | 2 +- R/plot.r | 4 ++-- R/predict.r | 2 +- R/princomp.r | 2 +- R/project.r | 4 ++-- R/rSpatialDepRast.r | 2 +- R/rWalkRast.r | 2 +- R/rasterize.r | 2 +- R/rbind.r | 2 +- R/reorient.r | 2 +- R/replace_single_square_bracket.r | 4 ++-- R/resample.r | 10 +++++----- R/rnormRast.r | 2 +- R/ruggedness.r | 2 +- R/runifRast.r | 2 +- R/sampleRast.r | 4 ++-- R/scale.r | 8 ++++---- R/segregate.r | 2 +- R/selectRange.r | 2 +- R/simplifyGeom.r | 2 +- R/sineRast.r | 2 +- R/smoothGeom.r | 2 +- R/spatSample.r | 8 ++++---- R/streams.r | 2 +- R/stretch.r | 2 +- R/subset_single_bracket.r | 8 ++++---- R/subst.r | 2 +- R/sun.r | 10 +++++----- R/terrain.r | 18 +++++++++--------- R/thinLines.r | 2 +- R/thinPoints.r | 2 +- R/tiles.r | 4 ++-- R/trim.r | 2 +- R/union.r | 2 +- R/update.r | 4 ++-- R/vegIndex.r | 2 +- R/voronoi.r | 2 +- R/wetness.r | 2 +- R/xor.r | 2 +- _pkgdown.yml | 2 ++ man/copyGSpatial.Rd | 2 +- man/dot-makeGRaster.Rd | 8 ++++---- man/dot-makeGVector.Rd | 8 ++++---- vignettes/hidden_functions.Rmd | 1 - 102 files changed, 185 insertions(+), 174 deletions(-) diff --git a/R/00d_GRaster_class.r b/R/00d_GRaster_class.r index bb10ce7c..f22f7d2a 100644 --- a/R/00d_GRaster_class.r +++ b/R/00d_GRaster_class.r @@ -144,22 +144,26 @@ methods::setValidity("GRaster", } # EOF ) -#' Create a GRaster +#' Create a GRaster from a GRASS raster #' #' @description Create a `GRaster` from a raster existing in the current **GRASS** session. #' -#' @param src Character (name of the raster in **GRASS) or a `rastInfo` object. -#' @param names Character: Name of the raster. +#' @param src Character: The name of the raster in **GRASS**. +#' @param names Character: Name of the raster (cf. [names()]). #' @param levels `NULL` (default), a `data.frame`, `data.table`, an empty string (`""`), or a list of `data.frame`s, `data.table`s, and/or empty strings: These become the raster's [levels()]. If `""`, then no levels are defined. #' @param ac Vector of numeric/integer values >=1, or `NULL` (default): Active category column (offset by 1, so 1 really means the second column, 2 means the third, etc.). A value of `NULL` uses an automated procedure to figure it out. #' @param fail Logical: If `TRUE` (default), and the raster either has a 0 east-west or north-south extent, then exit the function with an error. If `fail` is `FALSE`, then display a warning and return `NULL`. #' #' @returns A `GRaster`. #' -#' @seealso [.makeGVector()] +#' @seealso [makeGVector()] #' -#' @keywords internal -.makeGRaster <- function(src, names = "raster", levels = "", ac = NULL, fail = TRUE) { +#' @example man/examples/ex_fast.r +#' +#' @aliases makeGRaster +#' @rdname makeGRaster +#' @exportMethod makeGRaster +makeGRaster <- function(src, names = "raster", levels = "", ac = NULL, fail = TRUE) { if (inherits(src, "rastInfo")) { info <- src diff --git a/R/00e_GVector_class.r b/R/00e_GVector_class.r index 55470b72..6fff2d34 100644 --- a/R/00e_GVector_class.r +++ b/R/00e_GVector_class.r @@ -46,7 +46,7 @@ methods::setValidity("GVector", } # EOF ) -#' Create a GVector +#' Create a GVector from a GRASS vector #' #' @description Create a `GVector` from a vector existing in the current **GRASS** session. #' @@ -58,16 +58,20 @@ methods::setValidity("GVector", #' #' @param extensive Logical: If `TRUE`, do extensive topological checks using `v.build`. The default is `FALSE`. #' -#' @param cats `NULL` (default) or an integer vector: Values of the "cats" (categories) of the vector in **GRASS**. This is useful *only* for speeding up the `GVector` creation process when the "cats" have already been ascertained. +#' @param cats `NULL` (default) or an integer vector: Values of the "cats" (categories) of the vector in **GRASS**. This is useful *only* for speeding up the `GVector` creation process when the "cats" have already been ascertained. For most users, this will be better left as `NULL`. #' #' @param fail Logical: If `TRUE` (default), and the vector either has a 0 east-west or north-south extent, then exit the function with an error. If `fail` is `FALSE`, then display a warning and return `NULL`. #' #' @returns A `GVector` (or `NULL` if `fail` is `TRUE` and the `GVector` would be invalid). #' -#' @seealso [.makeGRaster()] +#' @seealso [makeGRaster()] #' -#' @keywords internal -.makeGVector <- function(src, table = NULL, build = TRUE, extensive = FALSE, cats = NULL, fail = TRUE) { +#' @example man/examples/ex_fast.r +#' +#' @aliases makeGVector +#' @rdname makeGVector +#' @exportMethod makeGVector +makeGVector <- function(src, table = NULL, build = TRUE, extensive = FALSE, cats = NULL, fail = TRUE) { if (inherits(table, "GVector")) table <- table@table if (is.null(table)) table <- data.table::data.table(NULL) diff --git a/R/04_arithmetic.r b/R/04_arithmetic.r index 01cdc02d..5579df79 100644 --- a/R/04_arithmetic.r +++ b/R/04_arithmetic.r @@ -462,7 +462,7 @@ methods::setMethod( .genericArithRast <- function(name, src, ex) { rgrass::execGRASS(cmd = "r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) - .makeGRaster(src, name) + makeGRaster(src, name) } diff --git a/R/05_GRaster_functions_by_layer.r b/R/05_GRaster_functions_by_layer.r index 36f1f9e1..d95dc605 100644 --- a/R/05_GRaster_functions_by_layer.r +++ b/R/05_GRaster_functions_by_layer.r @@ -65,7 +65,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) @@ -101,7 +101,7 @@ methods::setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } ) @@ -251,7 +251,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) @@ -278,7 +278,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) @@ -404,7 +404,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } @@ -430,7 +430,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } @@ -459,7 +459,7 @@ setMethod( ) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } @@ -488,6 +488,6 @@ setMethod( flags = c(.quiet(), "overwrite") ) } - .makeGRaster(srcs, fx) + makeGRaster(srcs, fx) } diff --git a/R/06_GRaster_functions_across_layers.r b/R/06_GRaster_functions_across_layers.r index 3cfc37fb..38a959f0 100644 --- a/R/06_GRaster_functions_across_layers.r +++ b/R/06_GRaster_functions_across_layers.r @@ -248,7 +248,7 @@ setMethod( .rm(c(srcSS, srcCount), type = "raster", warn = FALSE) - out <- .makeGRaster(src, "sd") + out <- makeGRaster(src, "sd") # population standard deviation } else { @@ -307,7 +307,7 @@ setMethod( ) .rm(c(srcSS, srcCount), type = "raster", warn = FALSE) - .makeGRaster(src, "var") + makeGRaster(src, "var") } # EOF ) @@ -401,7 +401,7 @@ setMethod( if (na.rm) args$flags <- c(args$flags, "n") do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, fxName) + makeGRaster(src, fxName) } # EOF ) @@ -424,7 +424,7 @@ setMethod( ex <- paste(ex, collapse = " | ") ex <- paste0(src, " = ", ex) rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) - .makeGRaster(src, "layer") + makeGRaster(src, "layer") } # EOF ) @@ -448,7 +448,7 @@ setMethod( ex <- paste(ex, collapse = " & ") ex <- paste0(src, " = ", ex) rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) - .makeGRaster(src, "layer") + makeGRaster(src, "layer") } # EOF ) @@ -487,7 +487,7 @@ setMethod( } else { levels <- NULL } - out <- .makeGRaster(src, fxName, levels = levels) + out <- makeGRaster(src, fxName, levels = levels) } else if (return == "source") { out <- src } else { diff --git a/R/07_comparison.r b/R/07_comparison.r index 9baed62d..62f79381 100644 --- a/R/07_comparison.r +++ b/R/07_comparison.r @@ -354,7 +354,7 @@ methods::setMethod( } } # next layer - out <- .makeGRaster(srcs, "logical", levels = cats(e1), ac = activeCats(e1)) + out <- makeGRaster(srcs, "logical", levels = cats(e1), ac = activeCats(e1)) out } # EOF @@ -446,7 +446,7 @@ methods::setMethod( } } # next layer - out <- .makeGRaster(srcs, "logical", levels = cats(e2), ac = activeCats(e2)) + out <- makeGRaster(srcs, "logical", levels = cats(e2), ac = activeCats(e2)) out } # EOF diff --git a/R/aggregate.r b/R/aggregate.r index 592b5dbe..ea789dd3 100644 --- a/R/aggregate.r +++ b/R/aggregate.r @@ -136,7 +136,7 @@ methods::setMethod( levs <- NULL } - this <- .makeGRaster(srcs[i], names = names(x)[i], levels = levs) + this <- makeGRaster(srcs[i], names = names(x)[i], levels = levs) if (i == 1L) { out <- this } else { @@ -210,7 +210,7 @@ methods::setMethod( } # if data table has >= 2 rows - .makeGVector(src, table = aggTable) + makeGVector(src, table = aggTable) } # EOF ) diff --git a/R/app.r b/R/app.r index 2edaaf57..5d929801 100644 --- a/R/app.r +++ b/R/app.r @@ -112,7 +112,7 @@ methods::setMethod( args$seed <- seed } do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, "layer") + makeGRaster(src, "layer") } # EOF ) diff --git a/R/as.contour.r b/R/as.contour.r index 5f113745..b089b745 100644 --- a/R/as.contour.r +++ b/R/as.contour.r @@ -48,7 +48,7 @@ setMethod( ) do.call(rgrass::execGRASS, args=args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/as.int.r b/R/as.int.r index 6fd039ad..d597a0d0 100644 --- a/R/as.int.r +++ b/R/as.int.r @@ -55,7 +55,7 @@ methods::setMethod( ex <- paste0(src, " = ", fx, "(", sources(x)[i], ")") rgrass::execGRASS(cmd = "r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) - this <- .makeGRaster(src, names(x)[i]) + this <- makeGRaster(src, names(x)[i]) if (i == 1L) { out <- this } else { diff --git a/R/as.lines.r b/R/as.lines.r index b7698318..be583b9f 100644 --- a/R/as.lines.r +++ b/R/as.lines.r @@ -34,7 +34,7 @@ methods::setMethod( intern = TRUE ) do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/as.points.r b/R/as.points.r index 121fbe49..71ece499 100644 --- a/R/as.points.r +++ b/R/as.points.r @@ -75,7 +75,7 @@ methods::setMethod( # } # next layer - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) @@ -106,7 +106,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) do.call(rgrass::execGRASS, args = args) - .makeGVector(src, table = NULL) + makeGVector(src, table = NULL) } # E#OF ) diff --git a/R/as.polygons.r b/R/as.polygons.r index bc6a34fb..d7867324 100644 --- a/R/as.polygons.r +++ b/R/as.polygons.r @@ -42,7 +42,7 @@ methods::setMethod( ) if (smooth) args$flags <- c(args$flags, "s") do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/bioclims_GRaster.r b/R/bioclims_GRaster.r index ea6f0629..fa57e8c5 100644 --- a/R/bioclims_GRaster.r +++ b/R/bioclims_GRaster.r @@ -1374,7 +1374,7 @@ methods::setMethod( # return names <- names(out) - out <- .makeGRaster(out, names = names) + out <- makeGRaster(out, names = names) if (verbose | faster("verbose")) { tasks <- tasks + 1 diff --git a/R/buffer.r b/R/buffer.r index f85ff273..2e750054 100644 --- a/R/buffer.r +++ b/R/buffer.r @@ -120,9 +120,9 @@ methods::setMethod( on.exit(.rm(srcBuffer, type = "raster", warn = FALSE), add = TRUE) if (nlyr(x) > 1L) { - group[[i]] <- .makeGRaster(src, names(x[[i]])) + group[[i]] <- makeGRaster(src, names(x[[i]])) } else { - out <- .makeGRaster(src, names(x[[i]])) + out <- makeGRaster(src, names(x[[i]])) } } # next layer @@ -193,7 +193,7 @@ methods::setMethod( # # # } - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/cellSize.r b/R/cellSize.r index 4a873ce1..f2dbab72 100644 --- a/R/cellSize.r +++ b/R/cellSize.r @@ -93,7 +93,7 @@ methods::setMethod( } # next raster layer - .makeGRaster(srcs, paste0("area_", unit, "_", seq_len(nLayers))) + makeGRaster(srcs, paste0("area_", unit, "_", seq_len(nLayers))) } # EOF ) diff --git a/R/centroids.r b/R/centroids.r index 674597a2..c8bb1f04 100644 --- a/R/centroids.r +++ b/R/centroids.r @@ -86,7 +86,7 @@ methods::setMethod( table <- as.data.table(x) } - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) @@ -140,7 +140,7 @@ methods::setMethod( } - out[[i]] <- .makeGVector(srcs[i], table = table) + out[[i]] <- makeGVector(srcs[i], table = table) } diff --git a/R/classify.r b/R/classify.r index 2d5a2bd7..9edda548 100644 --- a/R/classify.r +++ b/R/classify.r @@ -169,7 +169,7 @@ methods::setMethod( } - out <- .makeGRaster(srcs, names = names(x), levels = levs, ac = 1L) + out <- makeGRaster(srcs, names = names(x), levels = levs, ac = 1L) out } # EOF diff --git a/R/cleanGeom.r b/R/cleanGeom.r index eea39ecb..3ded9c1f 100644 --- a/R/cleanGeom.r +++ b/R/cleanGeom.r @@ -191,7 +191,7 @@ methods::setMethod( if (!is.null(tolerance)) args$threshold <- tolerance do.call(rgrass::execGRASS, args = args) - out <- .makeGVector(src) + out <- makeGVector(src) if (!is.null(table)) { if (ngeom(out) == nrow(table)) out@table <- table diff --git a/R/clump.r b/R/clump.r index 55a1b247..e8ed18d4 100644 --- a/R/clump.r +++ b/R/clump.r @@ -47,7 +47,7 @@ methods::setMethod( args$output <- srcs[i] do.call(rgrass::execGRASS, args=args) - this <- .makeGRaster(srcs[i]) + this <- makeGRaster(srcs[i]) if (i == 1L) { out <- this diff --git a/R/compositeRGB.r b/R/compositeRGB.r index 7bc746f8..8059223c 100644 --- a/R/compositeRGB.r +++ b/R/compositeRGB.r @@ -61,7 +61,7 @@ methods::setMethod( if (dither) args$flags <- c(args$flags, "d") do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, "compositeRGB") + makeGRaster(src, "compositeRGB") } # EOF ) diff --git a/R/concats.r b/R/concats.r index b3606f8d..55e5fc24 100644 --- a/R/concats.r +++ b/R/concats.r @@ -134,7 +134,7 @@ methods::setMethod( table <- NULL } - .makeGRaster(src, names = "combineCats", levels = table) + makeGRaster(src, names = "combineCats", levels = table) } # EOF ) diff --git a/R/connectors.r b/R/connectors.r index 4f9a9194..88767e8e 100644 --- a/R/connectors.r +++ b/R/connectors.r @@ -59,7 +59,7 @@ methods::setMethod( table <- .vAsDataTable(x) table <- table[ , "TEMPTEMP_minDist_meters"] names(table) <- "length_meters" - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) diff --git a/R/convHull.r b/R/convHull.r index 92ce4fbf..d7e2d96a 100644 --- a/R/convHull.r +++ b/R/convHull.r @@ -30,7 +30,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) - out <- .makeGVector(src) + out <- makeGVector(src) } else { @@ -65,7 +65,7 @@ methods::setMethod( ) do.call(rgrass::execGRASS, args=args) - vects[[i]] <- .makeGVector(srcs[i]) + vects[[i]] <- makeGVector(srcs[i]) } diff --git a/R/copyGSpatial.r b/R/copyGSpatial.r index dabdd36f..add5651d 100644 --- a/R/copyGSpatial.r +++ b/R/copyGSpatial.r @@ -1,6 +1,6 @@ #' @title Make a copy of an object in GRASS #' -#' @description Create a copy of a `GRaster` or `GVector` in **GRASS**. This function is used internally and is of little use to most users. This only creates a copy of the object in the **GRASS** session--to make a `GRaster` or `GVector`, [.makeGRaster()] or [.makeGVector()] need to be called after making the copy. Note that if the object is multi-layered, then a copy is made of each layer. +#' @description Create a copy of a `GRaster` or `GVector` in **GRASS**. This function is used internally and is of little use to most users. This only creates a copy of the object in the **GRASS** session--to make a `GRaster` or `GVector`, [makeGRaster()] or [makeGVector()] need to be called after making the copy. Note that if the object is multi-layered, then a copy is made of each layer. #' #' @param x `GRaster`, `GVector`, or character: The object or the [sources()] name(s) of the object(s) to be copied. Can take multi-layered objects or multiple `sources`. #' diff --git a/R/crds.r b/R/crds.r index f7165e03..0ef75c77 100644 --- a/R/crds.r +++ b/R/crds.r @@ -107,7 +107,7 @@ st_coordinates <- function(x) { # src <- .makeSourceName("points", "vect") # rgrass::execGRASS("v.to.points", input=sources(x), output=src, use="vertex", flags=c(.quiet(), "overwrite"), intern=TRUE) - # pts <- .makeGVector(src) + # pts <- makeGVector(src) # pts <- vect(pts) # out <- terra::crds(pts) diff --git a/R/crop.r b/R/crop.r index 55b3980f..c1b9aff3 100644 --- a/R/crop.r +++ b/R/crop.r @@ -112,7 +112,7 @@ methods::setMethod( ### crop by creating copy of focal raster srcs <- .copyGSpatial(x, reshapeRegion = FALSE) - .makeGRaster(srcs, names(x), levels = cats(x), ac = activeCats(x), fail = fail) + makeGRaster(srcs, names(x), levels = cats(x), ac = activeCats(x), fail = fail) } # EOF ) @@ -168,7 +168,7 @@ methods::setMethod( } do.call(rgrass::execGRASS, args = args) - .makeGVector(src, fail = fail) + makeGVector(src, fail = fail) } # EOF ) diff --git a/R/delaunay.r b/R/delaunay.r index 6502981e..18190445 100644 --- a/R/delaunay.r +++ b/R/delaunay.r @@ -29,7 +29,7 @@ methods::setMethod( ) do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/denoise_noise.r b/R/denoise_noise.r index 6b7b6322..e7ad0e26 100644 --- a/R/denoise_noise.r +++ b/R/denoise_noise.r @@ -56,7 +56,7 @@ methods::setMethod( info <- do.call(rgrass::execGRASS, args = args) layers <- 1L:nlyr(x) srcs <- paste0(src, ".", layers) - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/disagg.r b/R/disagg.r index 03ff71c6..4449b08c 100644 --- a/R/disagg.r +++ b/R/disagg.r @@ -103,7 +103,7 @@ methods::setMethod( # flags = c(.quiet(), "overwrite", "o") # ) - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) diff --git a/R/distance.r b/R/distance.r index a4411be3..4878bd3b 100644 --- a/R/distance.r +++ b/R/distance.r @@ -112,7 +112,7 @@ methods::setMethod( # convert units src <- .convertRastFromMeters(srcOut, unit) - .makeGRaster(src, "distance") + makeGRaster(src, "distance") } # EOF ) @@ -176,7 +176,7 @@ methods::setMethod( # convert units src <- .convertRastFromMeters(src = src, unit = unit) - .makeGRaster(src, "distance") + makeGRaster(src, "distance") } # EOF ) diff --git a/R/erase.r b/R/erase.r index c789ee4f..a2d63e73 100644 --- a/R/erase.r +++ b/R/erase.r @@ -33,7 +33,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/extend.r b/R/extend.r index 5b53c945..a4886ae7 100644 --- a/R/extend.r +++ b/R/extend.r @@ -182,6 +182,6 @@ methods::setMethod( } # next raster - .makeGRaster(srcs, names = names(x), levels = levels(x), ac = activeCats(x)) + makeGRaster(srcs, names = names(x), levels = levels(x), ac = activeCats(x)) } # EOF diff --git a/R/extract.r b/R/extract.r index 2999bb26..2f1908ca 100644 --- a/R/extract.r +++ b/R/extract.r @@ -98,7 +98,7 @@ methods::setMethod( yy <- y[i] yy <- .aggregate(yy, gtype = "polygons", dissolve = FALSE) - yy <- .makeGVector(yy) + yy <- makeGVector(yy) thisOut <- extract( x = x, y = yy, diff --git a/R/fast.r b/R/fast.r index c7a4b7f6..23845532 100644 --- a/R/fast.r +++ b/R/fast.r @@ -261,9 +261,9 @@ methods::setMethod( } if (exists("info", inherits = FALSE)) { - out <- .makeGRaster(info, names = xNames, levels = levels) + out <- makeGRaster(info, names = xNames, levels = levels) } else { - out <- .makeGRaster(src, names = xNames, levels = levels) + out <- makeGRaster(src, names = xNames, levels = levels) } } @@ -680,7 +680,7 @@ methods::setMethod( } - out <- .makeGVector(src = src, table = table) + out <- makeGVector(src = src, table = table) # # save/reload vector... seems to fix errors with subset_single_bracket on polygon vectors later on # if (reload & geomtype(out) == "polygons") { @@ -706,7 +706,7 @@ methods::setMethod( # output = src, # flags = c(.quiet(), "overwrite", "t", "c") # ) - # out <- .makeGVector(src, table = table) + # out <- makeGVector(src, table = table) # # writeVector(out, filename = tempVect, overwrite = TRUE) # # out <- fast(tempVect, reload = FALSE, table = table) # cannot use vect() on this... weird! diff --git a/R/fasterRaster.r b/R/fasterRaster.r index a3df5d1d..2fdbb3cf 100644 --- a/R/fasterRaster.r +++ b/R/fasterRaster.r @@ -125,6 +125,8 @@ #' * [fractalRast()]: Create a fractal `GRaster` #' * [init()]: GRaster with values equal to row, column, coordinate, regular, or "chess" #' * [longlat()]: Create longitude/latitude rasters +#' * [makeGRaster()]: Create a `GRaster` from a **GRASS** raster file +#' * [makeGVector()]: Create a `GVector` from a **GRASS** vector file #' * [rNormRast()]: A random `GRaster` with values drawn from a normal distribution #' * [rSpatialDepRast()]: Create a random `GRaster` with or without spatial dependence #' * [rUnifRast()]: A random `GRaster` with values drawn from a uniform distribution diff --git a/R/fillHoles.r b/R/fillHoles.r index 8d893fbd..ae746fa2 100644 --- a/R/fillHoles.r +++ b/R/fillHoles.r @@ -42,7 +42,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) - out <- .makeGVector(src, table = x) + out <- makeGVector(src, table = x) } diff --git a/R/fillNAs.r b/R/fillNAs.r index 5881ad76..c317f863 100644 --- a/R/fillNAs.r +++ b/R/fillNAs.r @@ -118,7 +118,7 @@ methods::setMethod( } } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/flow.r b/R/flow.r index 9120d01a..1cdb096e 100644 --- a/R/flow.r +++ b/R/flow.r @@ -115,7 +115,7 @@ methods::setMethod( srcs <- srcs[order] names <- names[order] - .makeGRaster(srcs, names) + makeGRaster(srcs, names) } # EOF ) diff --git a/R/flowPath.r b/R/flowPath.r index 35da5a3a..92044e65 100644 --- a/R/flowPath.r +++ b/R/flowPath.r @@ -71,7 +71,7 @@ methods::setMethod( } - .makeGRaster(src, names = "flowPath") + makeGRaster(src, names = "flowPath") } # EOF ) diff --git a/R/focal.r b/R/focal.r index 35efa11d..23d2f3c3 100644 --- a/R/focal.r +++ b/R/focal.r @@ -248,7 +248,7 @@ methods::setMethod( levels <- NULL } - this <- .makeGRaster(src, names(x)[i], levels = levels) + this <- makeGRaster(src, names(x)[i], levels = levels) if (i == 1L) { out <- this } else { diff --git a/R/fractalRast.r b/R/fractalRast.r index 08f29be6..4bea04e0 100644 --- a/R/fractalRast.r +++ b/R/fractalRast.r @@ -63,7 +63,7 @@ methods::setMethod( } # next raster on.exit(.rm(srcFracts, type = "raster", warn = FALSE), add = TRUE) - .makeGRaster(srcs, "fractal") + makeGRaster(srcs, "fractal") } # EOF ) diff --git a/R/fragmentation.r b/R/fragmentation.r index 91e8c365..08c36297 100644 --- a/R/fragmentation.r +++ b/R/fragmentation.r @@ -505,7 +505,7 @@ methods::setMethod( levels[[i]] <- levs } - .makeGRaster(srcs, names = "fragmentation", levels = levels) + makeGRaster(srcs, names = "fragmentation", levels = levels) } # EOF diff --git a/R/geomorphons.r b/R/geomorphons.r index 4707d203..8a1fdd3b 100644 --- a/R/geomorphons.r +++ b/R/geomorphons.r @@ -88,7 +88,7 @@ methods::setMethod( geomorphon = c("flat", "peak", "ridge", "shoulder", "spur", "slope", "hollow", "footslope", "valley", "pit") ) - .makeGRaster(src, levels = levels) + makeGRaster(src, levels = levels) } # EOF ) diff --git a/R/grid.r b/R/grid.r index 60fe6f73..6b4c5f7d 100644 --- a/R/grid.r +++ b/R/grid.r @@ -134,6 +134,6 @@ methods::setMethod( if (!(angle %in% c(0, 360))) args$angle <- angle do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } diff --git a/R/hexagons.r b/R/hexagons.r index 437f572d..5710d8a5 100644 --- a/R/hexagons.r +++ b/R/hexagons.r @@ -90,6 +90,6 @@ methods::setMethod( if (!(angle %in% c(0, 360))) args$angle <- angle do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } diff --git a/R/hillshade.r b/R/hillshade.r index f26517d4..14147eb0 100644 --- a/R/hillshade.r +++ b/R/hillshade.r @@ -48,7 +48,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args = args) } - .makeGRaster(srcs, paste0(names(x), "_shade")) + makeGRaster(srcs, paste0(names(x), "_shade")) } # EOF ) diff --git a/R/horizonHeight.r b/R/horizonHeight.r index 288e32c0..28acedfa 100644 --- a/R/horizonHeight.r +++ b/R/horizonHeight.r @@ -79,7 +79,7 @@ methods::setMethod( if (northIs0) niceDirections <- sort(niceDirections) - .makeGRaster(srcs, names = paste0("horizonHeight_", niceDirections, "deg")) + makeGRaster(srcs, names = paste0("horizonHeight_", niceDirections, "deg")) } # EOF ) diff --git a/R/init.r b/R/init.r index 49decff3..8faea42f 100644 --- a/R/init.r +++ b/R/init.r @@ -67,7 +67,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } - .makeGRaster(srcs, fun) + makeGRaster(srcs, fun) } # EOF ) diff --git a/R/interpIDW.r b/R/interpIDW.r index efac9bef..b700dc5a 100644 --- a/R/interpIDW.r +++ b/R/interpIDW.r @@ -61,7 +61,7 @@ methods::setMethod( power = power, flags = c(.quiet(), "overwrite") ) - .makeGRaster(src, "interpolation") + makeGRaster(src, "interpolation") } # EOF ) diff --git a/R/interpSplines.r b/R/interpSplines.r index eff72675..20ab2577 100644 --- a/R/interpSplines.r +++ b/R/interpSplines.r @@ -241,9 +241,9 @@ methods::setMethod( } else if (inherits(y, "GVector")) { table <- .vAsDataTable(src) - out <- .makeGVector(src) + out <- makeGVector(src) } else if (inherits(y, "GRaster")) { - out <- .makeGRaster(src, "interpolation") + out <- makeGRaster(src, "interpolation") } out diff --git a/R/intersect.r b/R/intersect.r index 43d36006..925815d1 100644 --- a/R/intersect.r +++ b/R/intersect.r @@ -33,7 +33,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/kernel.r b/R/kernel.r index b2d69a8f..2494c703 100644 --- a/R/kernel.r +++ b/R/kernel.r @@ -86,7 +86,7 @@ methods::setMethod( if (optimize & kernFx == "gaussian") args$flags <- c(args$flags, "o") do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, "kernelDensity") + makeGRaster(src, "kernelDensity") } # EOF ) diff --git a/R/longlat.r b/R/longlat.r index 459a7ecd..f715dea7 100644 --- a/R/longlat.r +++ b/R/longlat.r @@ -23,7 +23,7 @@ methods::setMethod( .locationRestore(x) .region(x) srcs <- .longlat(x, degrees = degrees) - .makeGRaster(srcs, c("longitude", "latitude")) + makeGRaster(srcs, c("longitude", "latitude")) } # EOF ) diff --git a/R/mask.r b/R/mask.r index 67e0b78b..e9d8e9ee 100644 --- a/R/mask.r +++ b/R/mask.r @@ -39,7 +39,7 @@ methods::setMethod( mask <- sources(mask)[1L] srcs <- .mask(x = x, mask = mask, maskType = "raster", inverse = inverse, maskvalues = maskvalues, updatevalue = updatevalue) - .makeGRaster(srcs, xname, levels = cats, ac = ac) + makeGRaster(srcs, xname, levels = cats, ac = ac) } # EOF ) @@ -63,7 +63,7 @@ methods::setMethod( mask <- sources(mask) srcs <- .mask(x = x, mask = mask, maskType = "vector", inverse = inverse, maskvalues = NA, updatevalue = updatevalue) - .makeGRaster(srcs, xname, levels = cats, ac = ac) + makeGRaster(srcs, xname, levels = cats, ac = ac) } # EOF ) diff --git a/R/maskNA.r b/R/maskNA.r index 21e5c31c..91229573 100644 --- a/R/maskNA.r +++ b/R/maskNA.r @@ -38,7 +38,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } - .makeGRaster(srcs, names = names(x)) + makeGRaster(srcs, names = names(x)) } # EOF ) diff --git a/R/match.r b/R/match.r index 494035ce..80cb6865 100644 --- a/R/match.r +++ b/R/match.r @@ -139,7 +139,7 @@ methods::setMethod( } else { levs <- NULL } - .makeGRaster(srcs, names(x), levels = levs) + makeGRaster(srcs, names(x), levels = levs) } # EOF ) @@ -213,7 +213,7 @@ methods::setMethod( } # next raster - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) @@ -268,7 +268,7 @@ methods::setMethod( } # next raster - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/merge.r b/R/merge.r index 46fe94cf..4cf72faf 100644 --- a/R/merge.r +++ b/R/merge.r @@ -40,7 +40,7 @@ methods::setMethod( # combine levels levels <- combineLevels(x) - .makeGRaster(src, levels = levels) + makeGRaster(src, levels = levels) } # EOF ) diff --git a/R/multivarEnvSim.r b/R/multivarEnvSim.r index 76e1e90d..7bda5d3d 100644 --- a/R/multivarEnvSim.r +++ b/R/multivarEnvSim.r @@ -191,7 +191,7 @@ methods::setMethod( srcsAll <- c(srcs, srcOverall, srcMostDiffFrom1) outNames <- c(names(proj), "MESS", "mostDifferent") - .makeGRaster(srcsAll, names = outNames, levels = levs) + makeGRaster(srcsAll, names = outNames, levels = levs) } diff --git a/R/plot.r b/R/plot.r index 9b70396c..526730f8 100644 --- a/R/plot.r +++ b/R/plot.r @@ -147,9 +147,9 @@ methods::setMethod( files <- .ls() what <- names(files)[files == x] if (what == "raster") { - x <- .makeGRaster(x) + x <- makeGRaster(x) } else if (what == "vector") { - x <- .makeGVector(x) + x <- makeGVector(x) } plot(x, ...) } diff --git a/R/predict.r b/R/predict.r index 4eb605c2..0aa7742a 100644 --- a/R/predict.r +++ b/R/predict.r @@ -300,7 +300,7 @@ methods::setMethod( } - .makeGRaster(src, names = "prediction") + makeGRaster(src, names = "prediction") } # EOF ) diff --git a/R/princomp.r b/R/princomp.r index f9fed336..5aeb7d66 100644 --- a/R/princomp.r +++ b/R/princomp.r @@ -45,7 +45,7 @@ methods::setMethod( info <- do.call(rgrass::execGRASS, args = args) layers <- 1L:nlyr(x) srcs <- paste0(src, ".", layers) - out <- .makeGRaster(srcs, paste0("PC", layers)) + out <- makeGRaster(srcs, paste0("PC", layers)) ### get PCA information ####################### diff --git a/R/project.r b/R/project.r index ab2a0d2e..3a958d56 100644 --- a/R/project.r +++ b/R/project.r @@ -391,7 +391,7 @@ methods::setMethod( } else { levels <- NULL } - thisOut <- .makeGRaster(srcs[i], names(x)[i], levels = levels, ac = activeCat(x, layer = i)) + thisOut <- makeGRaster(srcs[i], names(x)[i], levels = levels, ac = activeCat(x, layer = i)) if (i == 1L) { out <- thisOut } else { @@ -476,7 +476,7 @@ methods::setMethod( # if (geomtype(x, grass = TRUE) == "point") args$flags <- c(args$flags, "b") # disable topology build for points do.call(rgrass::execGRASS, args = args) - out <- .makeGVector(src, table = x@table) + out <- makeGVector(src, table = x@table) out } # EOF diff --git a/R/rSpatialDepRast.r b/R/rSpatialDepRast.r index cc08b4e7..29fc903f 100644 --- a/R/rSpatialDepRast.r +++ b/R/rSpatialDepRast.r @@ -81,7 +81,7 @@ methods::setMethod( ) } # next raster - .makeGRaster(srcs, "rnorm") + makeGRaster(srcs, "rnorm") } # EOF ) diff --git a/R/rWalkRast.r b/R/rWalkRast.r index 586534ae..e7aac748 100644 --- a/R/rWalkRast.r +++ b/R/rWalkRast.r @@ -70,7 +70,7 @@ methods::setMethod( # ex <- paste0(src, " = int(", srcIn, ")") # rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) - .makeGRaster(src, "randomWalk") + makeGRaster(src, "randomWalk") } # EOF ) diff --git a/R/rasterize.r b/R/rasterize.r index 5710b17d..95a908b0 100644 --- a/R/rasterize.r +++ b/R/rasterize.r @@ -41,7 +41,7 @@ methods::setMethod( gtype <- geomtype(x, grass = TRUE) out <- .rasterize(x = x, y = y, field = field, background = background, by = by, gtype = gtype, verbose = verbose) - .makeGRaster(out$src, levels = out$levels) + makeGRaster(out$src, levels = out$levels) } # EOF ) diff --git a/R/rbind.r b/R/rbind.r index a002dc5c..765e9b69 100644 --- a/R/rbind.r +++ b/R/rbind.r @@ -102,7 +102,7 @@ methods::setMethod( } - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) diff --git a/R/reorient.r b/R/reorient.r index 1add92a9..78334735 100644 --- a/R/reorient.r +++ b/R/reorient.r @@ -38,7 +38,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/replace_single_square_bracket.r b/R/replace_single_square_bracket.r index 0e1b04c8..e59eb6d7 100644 --- a/R/replace_single_square_bracket.r +++ b/R/replace_single_square_bracket.r @@ -53,7 +53,7 @@ setMethod( ) } # next raster - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) @@ -115,7 +115,7 @@ setMethod( ) } # next raster - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/resample.r b/R/resample.r index 71c643a4..5bfcbbf8 100644 --- a/R/resample.r +++ b/R/resample.r @@ -211,13 +211,13 @@ methods::setMethod( } else { cats <- ac <- NULL } - thisOut <- .makeGRaster(srcNearest, names(x)[i], levels = cats, ac = ac) + thisOut <- makeGRaster(srcNearest, names(x)[i], levels = cats, ac = ac) } else if (thisMethod == "bilinear" & !fallback) { - thisOut <- .makeGRaster(srcBilinear, names(x)[i]) + thisOut <- makeGRaster(srcBilinear, names(x)[i]) } else if (thisMethod == "bicubic" & !fallback) { - thisOut <- .makeGRaster(srcBicubic, names(x)[i]) + thisOut <- makeGRaster(srcBicubic, names(x)[i]) } else if (thisMethod == "lanczos" & !fallback) { - thisOut <- .makeGRaster(srcLanczos, names(x)[i]) + thisOut <- makeGRaster(srcLanczos, names(x)[i]) } else if (fallback) { src <- .makeSourceName("resample_fallback", "raster") @@ -247,7 +247,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) do.call(rgrass::execGRASS, args=args) - thisOut <- .makeGRaster(src, names = names(x)[i]) + thisOut <- makeGRaster(src, names = names(x)[i]) } # next layer diff --git a/R/rnormRast.r b/R/rnormRast.r index aa92a2e3..e3e22603 100644 --- a/R/rnormRast.r +++ b/R/rnormRast.r @@ -52,7 +52,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args = args) } # next raster - .makeGRaster(srcs, "rnorm") + makeGRaster(srcs, "rnorm") } # EOF ) diff --git a/R/ruggedness.r b/R/ruggedness.r index dfd67b7c..b476b963 100644 --- a/R/ruggedness.r +++ b/R/ruggedness.r @@ -64,7 +64,7 @@ methods::setMethod( } } # next layer - .makeGRaster(srcs, names = paste0(names(x), "_TRI")) + makeGRaster(srcs, names = paste0(names(x), "_TRI")) } # EOF ) diff --git a/R/runifRast.r b/R/runifRast.r index c2119499..69c18f01 100644 --- a/R/runifRast.r +++ b/R/runifRast.r @@ -59,7 +59,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args = args) } # next raster - .makeGRaster(srcs, rep("runif", n)) + makeGRaster(srcs, rep("runif", n)) } # EOF ) diff --git a/R/sampleRast.r b/R/sampleRast.r index 618c50d3..c258341f 100644 --- a/R/sampleRast.r +++ b/R/sampleRast.r @@ -116,12 +116,12 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite"), intern = TRUE) } # next raster - out <- .makeGRaster(srcsUpdate, names(x)) + out <- makeGRaster(srcsUpdate, names(x)) } else { levels <- cats(x) ac <- activeCats(x) - out <- .makeGRaster(srcs, names(x), levels = levels, ac = ac) + out <- makeGRaster(srcs, names(x), levels = levels, ac = ac) } out diff --git a/R/scale.r b/R/scale.r index 97f338ae..b017617e 100644 --- a/R/scale.r +++ b/R/scale.r @@ -107,7 +107,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } # next layer - out <- .makeGRaster(srcs, names(x)) + out <- makeGRaster(srcs, names(x)) if (center) { vals <- stats[ , "mean"] @@ -164,7 +164,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } # next layer - out <- .makeGRaster(srcs, names(x)) + out <- makeGRaster(srcs, names(x)) names(center) <- names(x) attr(out, "center") <- center @@ -257,7 +257,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } # next layer - out <- .makeGRaster(srcs, names(x)) + out <- makeGRaster(srcs, names(x)) names(center) <- names(x) names(scale) <- names(x) @@ -351,7 +351,7 @@ methods::setMethod( } } # next layer - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/segregate.r b/R/segregate.r index 6e5240b4..b86aa949 100644 --- a/R/segregate.r +++ b/R/segregate.r @@ -67,7 +67,7 @@ methods::setMethod( } else { as.character(vals) } - thisOut <- .makeGRaster(thisSrcs, names = names) + thisOut <- makeGRaster(thisSrcs, names = names) } diff --git a/R/selectRange.r b/R/selectRange.r index be531298..d1300eed 100644 --- a/R/selectRange.r +++ b/R/selectRange.r @@ -46,7 +46,7 @@ methods::setMethod( ) do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, "selectRange") + makeGRaster(src, "selectRange") } # EOF ) diff --git a/R/simplifyGeom.r b/R/simplifyGeom.r index 921318cd..258d94d0 100644 --- a/R/simplifyGeom.r +++ b/R/simplifyGeom.r @@ -76,7 +76,7 @@ methods::setMethod( if (method == "reumann") args$reduction <- 100 * prop do.call(rgrass::execGRASS, args=args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/sineRast.r b/R/sineRast.r index f91619b2..1ad35646 100644 --- a/R/sineRast.r +++ b/R/sineRast.r @@ -133,7 +133,7 @@ methods::setMethod( if ((verbose | faster("verbose")) & nRastsToMake > 1) close(pb) names <- paste0("ns", ns, "_ew", ew, "_nsOffset", nsOffset, "_ewOffset", ewOffset, "_nsAmp", nsAmp, "_ewAmp", ewAmp) - .makeGRaster(srcs, names) + makeGRaster(srcs, names) } # EOF ) diff --git a/R/smoothGeom.r b/R/smoothGeom.r index e830fd33..4122c309 100644 --- a/R/smoothGeom.r +++ b/R/smoothGeom.r @@ -59,7 +59,7 @@ methods::setMethod( if (method == "hermite") args$angle_thresh <- angle do.call(rgrass::execGRASS, args=args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/spatSample.r b/R/spatSample.r index d9eaf45c..bee9a43e 100644 --- a/R/spatSample.r +++ b/R/spatSample.r @@ -324,10 +324,10 @@ methods::setMethod( # info <- .vectInfo(src) # nGeometries <- info$nGeometries # n <- nGeometries / size - # out <- .makeGVector(src, table = out, cats = rep(1:size, each = n)) - out <- .makeGVector(src, table = out, cats = thisCats) + # out <- makeGVector(src, table = out, cats = rep(1:size, each = n)) + out <- makeGVector(src, table = out, cats = thisCats) } else { - out <- .makeGVector(src, cats = thisCats) + out <- makeGVector(src, cats = thisCats) } } else { if (!faster("useDataTable")) out <- as.data.frame(out) @@ -427,7 +427,7 @@ methods::setMethod( } if (as.points) { - out <- .makeGVector(src, table = out) + out <- makeGVector(src, table = out) } else { if (!faster("useDataTable")) out <- as.data.frame(out) } diff --git a/R/streams.r b/R/streams.r index 5279183d..e6d2f432 100644 --- a/R/streams.r +++ b/R/streams.r @@ -59,7 +59,7 @@ methods::setMethod( ) do.call(rgrass::execGRASS, args = args) - .makeGRaster(src, names = "streams") + makeGRaster(src, names = "streams") } # EOF ) diff --git a/R/stretch.r b/R/stretch.r index 425687e2..88409fbf 100644 --- a/R/stretch.r +++ b/R/stretch.r @@ -144,7 +144,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args=args) - this <- .makeGRaster(src, names(x)[i]) + this <- makeGRaster(src, names(x)[i]) if (i == 1L) { out <- this } else { diff --git a/R/subset_single_bracket.r b/R/subset_single_bracket.r index 9c79ee05..b43a5ced 100644 --- a/R/subset_single_bracket.r +++ b/R/subset_single_bracket.r @@ -303,9 +303,9 @@ methods::setMethod( if (removeAll) { out <- NULL } else { - # out <- .makeGVector(src, table = table, cats = newCats) - # out <- .makeGVector(src, table = table) - out <- .makeGVector(src, table = table, cats = keepCats) + # out <- makeGVector(src, table = table, cats = newCats) + # out <- makeGVector(src, table = table) + out <- makeGVector(src, table = table, cats = keepCats) } } @@ -350,7 +350,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } - .makeGRaster(srcs, names(x), levels = cats(x), ac = activeCats(x)) + makeGRaster(srcs, names(x), levels = cats(x), ac = activeCats(x)) } # EOF ) diff --git a/R/subst.r b/R/subst.r index 8747b52a..eb2941db 100644 --- a/R/subst.r +++ b/R/subst.r @@ -186,7 +186,7 @@ methods::setMethod( rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite")) } - .makeGRaster(srcs, names = names(x), levels = levs) + makeGRaster(srcs, names = names(x), levels = levs) } ) diff --git a/R/sun.r b/R/sun.r index 6d060840..560c5a84 100644 --- a/R/sun.r +++ b/R/sun.r @@ -148,27 +148,27 @@ sun <- function( out <- elevation if (beam_rad) { - this <- .makeGRaster(args$beam_rad, "beam_rad") + this <- makeGRaster(args$beam_rad, "beam_rad") out <- c(out, this) } if (diff_rad) { - this <- .makeGRaster(args$diff_rad, "diff_rad") + this <- makeGRaster(args$diff_rad, "diff_rad") out <- c(out, this) } if (refl_rad) { - this <- .makeGRaster(args$refl_rad, "refl_rad") + this <- makeGRaster(args$refl_rad, "refl_rad") out <- c(out, this) } if (glob_rad) { - this <- .makeGRaster(args$glob_rad, "glob_rad") + this <- makeGRaster(args$glob_rad, "glob_rad") out <- c(out, this) } if (insol_time) { - this <- .makeGRaster(args$insol_time, "insol_time") + this <- makeGRaster(args$insol_time, "insol_time") out <- c(out, this) } diff --git a/R/terrain.r b/R/terrain.r index fb5f6f13..c7c3f7ee 100644 --- a/R/terrain.r +++ b/R/terrain.r @@ -109,7 +109,7 @@ methods::setMethod( slopeSrc <- args$slope } - out <- .makeGRaster(slopeSrc, "slope") + out <- makeGRaster(slopeSrc, "slope") } if ("aspect" %in% v) { @@ -136,7 +136,7 @@ methods::setMethod( } - this <- .makeGRaster(aspectSrc, "aspect") + this <- makeGRaster(aspectSrc, "aspect") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -145,7 +145,7 @@ methods::setMethod( } if ("profileCurve" %in% v) { - this <- .makeGRaster(args$pcurvature, "profileCurve") + this <- makeGRaster(args$pcurvature, "profileCurve") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -154,7 +154,7 @@ methods::setMethod( } if ("tanCurve" %in% v) { - this <- .makeGRaster(args$tcurvature, "tanCurve") + this <- makeGRaster(args$tcurvature, "tanCurve") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -163,7 +163,7 @@ methods::setMethod( } if ("dx" %in% v) { - this <- .makeGRaster(args$dx, "dx") + this <- makeGRaster(args$dx, "dx") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -172,7 +172,7 @@ methods::setMethod( } if ("dy" %in% v) { - this <- .makeGRaster(args$dy, "dy") + this <- makeGRaster(args$dy, "dy") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -181,7 +181,7 @@ methods::setMethod( } if ("dxx" %in% v) { - this <- .makeGRaster(args$dxx, "dxx") + this <- makeGRaster(args$dxx, "dxx") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -190,7 +190,7 @@ methods::setMethod( } if ("dyy" %in% v) { - this <- .makeGRaster(args$dyy, "dyy") + this <- makeGRaster(args$dyy, "dyy") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { @@ -199,7 +199,7 @@ methods::setMethod( } if ("dxy" %in% v) { - this <- .makeGRaster(args$dxy, "dxy") + this <- makeGRaster(args$dxy, "dxy") if (exists("out", inherits = FALSE)) { out <- c(out, this) } else { diff --git a/R/thinLines.r b/R/thinLines.r index ca96a7f4..1acc5b15 100644 --- a/R/thinLines.r +++ b/R/thinLines.r @@ -36,7 +36,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args = args) } - .makeGRaster(srcs, names(x)) + makeGRaster(srcs, names(x)) } # EOF ) diff --git a/R/thinPoints.r b/R/thinPoints.r index c78ea751..d441c778 100644 --- a/R/thinPoints.r +++ b/R/thinPoints.r @@ -45,7 +45,7 @@ methods::setMethod( table <- NULL } - .makeGVector(src, table = table) + makeGVector(src, table = table) } # EOF ) \ No newline at end of file diff --git a/R/tiles.r b/R/tiles.r index f3a34bc8..4134dae7 100644 --- a/R/tiles.r +++ b/R/tiles.r @@ -48,7 +48,7 @@ methods::setMethod( out[[i]] <- list() for (j in seq_along(srcs)) { - out[[i]][[j]] <- .makeGRaster(srcs[j], names(x)[i], levels = cats(x, layer = i), ac = activeCat(x, layer = i), fail = TRUE) + out[[i]][[j]] <- makeGRaster(srcs[j], names(x)[i], levels = cats(x, layer = i), ac = activeCat(x, layer = i), fail = TRUE) } # next tile } # next layer @@ -62,7 +62,7 @@ methods::setMethod( srcs <- .tiles(x = x, n = n, dims = dims, extent = extent, res = res, overlap = 0) for (i in seq_along(srcs)) { - out[[i]] <- .makeGRaster(srcs[i], names(x), levels = cats(x), ac = activeCat(x), fail = TRUE) + out[[i]] <- makeGRaster(srcs[i], names(x), levels = cats(x), ac = activeCat(x), fail = TRUE) } # next tile diff --git a/R/trim.r b/R/trim.r index 8e1ff4c6..9f403a6d 100644 --- a/R/trim.r +++ b/R/trim.r @@ -86,7 +86,7 @@ methods::setMethod( ) src <- .copyGSpatial(x, reshapeRegion = FALSE) - .makeGRaster(src, names(x), levels = cats(x), ac = activeCats(x)) + makeGRaster(src, names(x), levels = cats(x), ac = activeCats(x)) } # EOF ) diff --git a/R/union.r b/R/union.r index c2d567df..d5c0ce41 100644 --- a/R/union.r +++ b/R/union.r @@ -34,7 +34,7 @@ methods::setMethod( flags = c(.quiet(), "overwrite") ) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/update.r b/R/update.r index fdc26ae3..97bb6aa2 100644 --- a/R/update.r +++ b/R/update.r @@ -14,7 +14,7 @@ methods::setMethod( f = "update", signature = c(object = "GRaster"), - definition = function(object) .makeGRaster(sources(object), levels = cats(object), ac = activeCats(object)) + definition = function(object) makeGRaster(sources(object), levels = cats(object), ac = activeCats(object)) ) #' @aliases update @@ -23,5 +23,5 @@ methods::setMethod( methods::setMethod( f = "update", signature = c(object = "GVector"), - definition = function(object) .makeGVector(sources(object), table = as.data.table(object)) + definition = function(object) makeGVector(sources(object), table = as.data.table(object)) ) diff --git a/R/vegIndex.r b/R/vegIndex.r index ea303f25..1aa67c5b 100644 --- a/R/vegIndex.r +++ b/R/vegIndex.r @@ -131,7 +131,7 @@ methods::setMethod( do.call(rgrass::execGRASS, args = args) } # next metric - .makeGRaster(srcs, toupper(index)) + makeGRaster(srcs, toupper(index)) } #OF ) diff --git a/R/voronoi.r b/R/voronoi.r index 1badcb84..758e3721 100644 --- a/R/voronoi.r +++ b/R/voronoi.r @@ -59,7 +59,7 @@ methods::setMethod( if (geomtype(x) == "polygons") args$flags <- c(args$flags, "a") do.call(rgrass::execGRASS, args = args) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/R/wetness.r b/R/wetness.r index eb9c84d8..c5304f20 100644 --- a/R/wetness.r +++ b/R/wetness.r @@ -36,7 +36,7 @@ methods::setMethod( ) } - .makeGRaster(srcs, paste0(names(x), "_twi")) + makeGRaster(srcs, paste0(names(x), "_twi")) } # EOF ) diff --git a/R/xor.r b/R/xor.r index 0a4c3d5f..6d6c0d76 100644 --- a/R/xor.r +++ b/R/xor.r @@ -32,7 +32,7 @@ methods::setMethod( snap = -1, flags = c(.quiet(), "overwrite") ) - .makeGVector(src) + makeGVector(src) } # EOF ) diff --git a/_pkgdown.yml b/_pkgdown.yml index 911e2a36..f3569628 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -208,6 +208,8 @@ reference: - fractalRast - init - longlat + - makeGRaster + - makeGVector - rNormRast - rSpatialDepRast - rUnifRast diff --git a/man/copyGSpatial.Rd b/man/copyGSpatial.Rd index 69c710ca..cc408763 100644 --- a/man/copyGSpatial.Rd +++ b/man/copyGSpatial.Rd @@ -34,6 +34,6 @@ Character vector representing the \code{\link[=sources]{sources()}} names of the \code{\link[=sources]{sources()}} names of copied rasters. } \description{ -Create a copy of a \code{GRaster} or \code{GVector} in \strong{GRASS}. This function is used internally and is of little use to most users. This only creates a copy of the object in the \strong{GRASS} session--to make a \code{GRaster} or \code{GVector}, \code{\link[=.makeGRaster]{.makeGRaster()}} or \code{\link[=.makeGVector]{.makeGVector()}} need to be called after making the copy. Note that if the object is multi-layered, then a copy is made of each layer. +Create a copy of a \code{GRaster} or \code{GVector} in \strong{GRASS}. This function is used internally and is of little use to most users. This only creates a copy of the object in the \strong{GRASS} session--to make a \code{GRaster} or \code{GVector}, \code{\link[=makeGRaster]{makeGRaster()}} or \code{\link[=makeGVector]{makeGVector()}} need to be called after making the copy. Note that if the object is multi-layered, then a copy is made of each layer. } \keyword{internal} diff --git a/man/dot-makeGRaster.Rd b/man/dot-makeGRaster.Rd index be7e84f8..786b094b 100644 --- a/man/dot-makeGRaster.Rd +++ b/man/dot-makeGRaster.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/00d_GRaster_class.r -\name{.makeGRaster} -\alias{.makeGRaster} +\name{makeGRaster} +\alias{makeGRaster} \title{Create a GRaster} \usage{ -.makeGRaster(src, names = "raster", levels = "", ac = NULL, fail = TRUE) +makeGRaster(src, names = "raster", levels = "", ac = NULL, fail = TRUE) } \arguments{ \item{src}{Character (name of the raster in **GRASS) or a \code{rastInfo} object.} @@ -24,6 +24,6 @@ A \code{GRaster}. Create a \code{GRaster} from a raster existing in the current \strong{GRASS} session. } \seealso{ -\code{\link[=.makeGVector]{.makeGVector()}} +\code{\link[=makeGVector]{makeGVector()}} } \keyword{internal} diff --git a/man/dot-makeGVector.Rd b/man/dot-makeGVector.Rd index 35df7bb4..9387bb1f 100644 --- a/man/dot-makeGVector.Rd +++ b/man/dot-makeGVector.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/00e_GVector_class.r -\name{.makeGVector} -\alias{.makeGVector} +\name{makeGVector} +\alias{makeGVector} \title{Create a GVector} \usage{ -.makeGVector( +makeGVector( src, table = NULL, build = TRUE, @@ -33,6 +33,6 @@ A \code{GVector} (or \code{NULL} if \code{fail} is \code{TRUE} and the \code{GVe Create a \code{GVector} from a vector existing in the current \strong{GRASS} session. } \seealso{ -\code{\link[=.makeGRaster]{.makeGRaster()}} +\code{\link[=makeGRaster]{makeGRaster()}} } \keyword{internal} diff --git a/vignettes/hidden_functions.Rmd b/vignettes/hidden_functions.Rmd index 66832b7d..f2138fb6 100644 --- a/vignettes/hidden_functions.Rmd +++ b/vignettes/hidden_functions.Rmd @@ -55,7 +55,6 @@ fig.path = 'man/figures/' ## Rasters * `.layerIndex()`: Gets the index of `GRaster` layers from a numeric, integer, character, or logical vector -* `.makeGRaster()` and `.makeGVector()`: Make `GRaster`s or `GVector`s from a vector of `sources`, which are pointers to files in **GRASS** * `.minVal()` and `.maxVal()`: Values in the `@minVal` and `@maxVal` slots in a `GRaster` * `.nlevels()`: Number of levels in a `SpatVector`, `data.frame`, `data.table`, empty string, or a list of `data.frame`s, `data.table`s, and/or empty strings. From 1ab6c06a021f4dce9317057de78bb53d081363aa Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 13:12:20 -0500 Subject: [PATCH 05/14] Better conversion of raster `names()` to GRASS names Previously, short names like "x" or "r1" could have appeared in a `makeSourceName()` output, and thus improperly replaced with the `makeSourceName()` of another raster. This may not completely obviate the bug, but may help. --- R/app.r | 72 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/R/app.r b/R/app.r index 5d929801..f1018067 100644 --- a/R/app.r +++ b/R/app.r @@ -16,6 +16,7 @@ #' * If you want to calculate values using while ignoring `NA` (or `null`) values, see the functions that begin with `n` (like `nmean`). #' * Be mindful of the data type that a function returns. In **GRASS**, these are `CELL` (integer), `FCELL` (floating point values--precise to about the 7th decimal place), and `DCELL` (double-floating point values--precise to about the 15th decimal place; commensurate with the **R** `numeric` type). In cases where you want a `GRaster` to be treated like a float or double type raster, wrap the name of the `GRaster` in the `float()` or `double()` functions. This is especially useful if the `GRaster` might be assumed to be the `CELL` type because it only contains integer values. You can get the data type of a raster using [datatype()] with the `type` argument set to `GRASS`. You can change the data type of a `GRaster` using [as.int()], [as.float()], and [as.doub()]. Note that categorical rasters are really `CELL` (integer) rasters with an associated "levels" table. You can also change a `CELL` raster to a `FCELL` raster by adding then subtracting a decimal value, as in `x - 0.1 + 0.1`. See `vignette("GRasters", package = "fasterRaster")`. #' * The `rand()` function returns integer values by default. If you want non-integer values, use the tricks mentioned above to datatype non-integer values. For example, if you want uniform random values in the range between 0 and 1, use something like `= float(rand(0 + 0.1, 1 + 0.1) - 0.1)`. +#' * `GRaster`s with short names can cause the function to mis-specify the formula in **GRASS**. This happens when, for example, the `fun` argument contains an "if" statement, and the raster name is "i" or "f", which would incorrectly replace those letters in the "if" with the **GRASS** name of the raster. To avoid this, avoid using short raster names that could be part of longer operators using by `app()` (see [appFuns()] for a list of these operators). #' #' @param x A `GRaster` with one or more named layers. #' @@ -66,35 +67,52 @@ methods::setMethod( # replace raster names with sources # replacing from longest to shortest to avoid issues with nestedness - xn <- names(x) - nchars <- nchar(xn) - xn <- xn[order(nchars, decreasing = TRUE)] datatype <- omnibus::pmatchSafe(datatype, c("integer", "float", "double", "auto")) if (datatype == "integer") datatype = "int" - for (name in xn) { - - i <- which(name == names(x)) - src <- sources(x)[i] - - # datatype data type - dt <- datatype(x, "GRASS")[i] - if (datatype == "auto") { - src <- if (dt == "CELL") { - paste0("int(", src, ")") - } else if (dt == "FCELL") { - paste0("float(", src, ")") - } else if (dt == "DCELL") { - paste0("double(", src, ")") - } + # table with GRASS name, R name, and the "stub" string that will temporarily represent it in "fun" + # later, we replace all values of "rname" with the corresponding values of "datatypeSrc" + xwalk <- data.table( + src = sources(x), + datatypeSrc = NA_character_, + rname = names(x), + stub = NA_character_ + ) + xwalk <- xwalk[rev(order(nchar(xwalk$rname)))] + + # datatype + dt <- datatype(x, "GRASS") + if (datatype == "auto") { + srcs <- if ("DCELL" %in% dt) { + paste0("double(", xwalk$src, ")") + } else if ("FCELL" %in% dt) { + paste0("float(", xwalk$src, ")") + } else if ("CELL" %in% dt) { + paste0("int(", xwalk$src, ")") } else { - if (dt != "FCELL") { - src <- paste0(datatype, "(", src, ")") - } + stop('Unknown datatype.') } + } else { + if (!any("FCELL" %in% dt)) { + srcs <- paste0(datatype, "(", xwalk$src, ")") + } + } + + xwalk$datatypeSrc <- srcs - fun <- gsub(fun, pattern = name, replacement = src) + for (i in 1:nrow(xwalk)) { + + rname <- xwalk$rname[i] + stub <- paste0('#', i, '#') + xwalk$stub[i] <- stub + + fun <- gsub(fun, pattern = rname, replacement = stub, fixed = TRUE) + + } + + for (i in 1:nrow(xwalk)) { + fun <- gsub(x = fun, pattern = xwalk$stub[i], replacement = xwalk$datatypeSrc[i], fixed = TRUE) } src <- .makeSourceName("app", "raster") @@ -193,7 +211,7 @@ methods::setMethod( if (length(realBads) > 0L) { - msg <- "At least one raster has a forbidden name that seems to appear in the equation:" + msg <- paste0("At least one raster has a forbidden name that seems to appear in the equation:\n ", fun) if (failOnBad) { stop(msg, "\n", paste(realBads, collapse = " ")) } else { @@ -201,7 +219,12 @@ methods::setMethod( return(realBads) } } else if (msgOnGood) { - msg <- "The GRasters have one or more forbidden names, but they do not seem to appear in\n the equation. Use the equation with caution, or rename your GRasters." + if (any(nchar(ns) <= 3L)) { + msg <- + "The GRasters have one or more forbidden names, but the forbidden names do not seem to appear in\n the equation. Use the equation with caution, or rename the GRasters. Also, consider renaming rasters\n with very names with <=3 characters (e.g., 'a', 'a1', 'f_t', 'egg') to avoid potential issues." + } else { + msg <- "The GRasters have one or more forbidden names, but they do not seem to appear in\n the equation. Use the equation with caution, or rename the GRasters." + } warning(msg) } } @@ -210,4 +233,3 @@ methods::setMethod( } # EOF ) - From 776bca1fc4de087b9294e9195dee3574ca3e698a Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 13:12:28 -0500 Subject: [PATCH 06/14] Update hidden_functions.Rmd --- vignettes/hidden_functions.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/hidden_functions.Rmd b/vignettes/hidden_functions.Rmd index f2138fb6..c659c77c 100644 --- a/vignettes/hidden_functions.Rmd +++ b/vignettes/hidden_functions.Rmd @@ -32,7 +32,7 @@ fig.path = 'man/figures/' * `.copyGSpatial()`: Make a copy of the **GRASS** file pointed to by a `GRaster` or `GVector` * `.exists()`: Does the **GRASS** file of a `GRaster` or `GVector` exist? * `.ext()`: Extent from the [`sources()`](https://adamlilith.github.io/fasterRaster/reference/sources.html) name of a `GRaster` or `GVector` -* `.makeSourceNames()`: Makes one or more statistically unique strings that can be used as file names to represent rasters or vectors in **GRASS** +* `.makeSourceName()`: Makes one or more statistically unique strings that can be used as file names to represent rasters or vectors in **GRASS** * `.plot()`: Plot using the [`sources()`](https://adamlilith.github.io/fasterRaster/reference/sources.html) name of a `GRaster` or `GVector` * `.projection()`: Value of the `@projection` slot in a `GRaster` or `GVector` * `.rastInfo()` and `.vectInfo()`: Metadata for a **GRASS** raster or vector From 265ffe6e8d1d7a901bc8f822224ca6a5872c0473 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 13:38:46 -0500 Subject: [PATCH 07/14] Add citation --- NEWS.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 75ba301d..65793756 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# fasterRaster 8.4.1.2 (2026-XX-XX) +### New functions and functionality +o `makeGRaster()` and `makeGVector()` are now public and allow users to create `G`-objects from files in **GRASS**. (feature request https://github.com/adamlilith/fasterRaster/issues/137 -- thank you, @JacobusS!) +o Updated citation to peer-reviewed journal article + +### Bug fixes +o `app()` is more robust. Previously, short raster could have caused improper function. (issue https://github.com/adamlilith/fasterRaster/issues/138 -- thank you, @laurapoggio-sptools!) +o `bioclims()` properly calculates progress bar width so you know how long you have to go get a coffee. +o `resample()` correctly calculates number of rows in output raster. + # fasterRaster 8.4.1.1 (2025-11-18) ### New functions and functionality o `+` can now combine any two `GVector`s with the same geometry type (points, lines, polygons). @@ -261,7 +271,7 @@ o `rast()`: Attaches the `GRaster`'s levels table to the `SpatRaster` output. o **+** `rasterize()`: Rewritten to perform (nearly) the same as `terra::rasterize()`. o `predict()`: Can accommodate models with two-way interactions between categorical rasters and between a categorical predictor and a scalar. o `scalepop()`: Scales `GRaster`s by population standard deviation. -o Stops with a somewhat informative error when a `GRaster` fails to be created (in hidden function `.makeGRaster()`) +o Stops with a somewhat informative error when a `GRaster` fails to be created (in hidden function `makeGRaster()`) ### Issues o `writeRaster()`: Correctly assign `datatype` to `CELL` rasters. @@ -315,7 +325,7 @@ o Updated `README` for 8.3.0.7013! ### Bug fixes o `[` works consistently for `GVector`s!!!!! -o Hidden function `.makeGVector()` now catches cases with zero extent for polygons. +o Hidden function `makeGVector()` now catches cases with zero extent for polygons. o Fixed installation issue related to `activeCat()<-` and `addCats()<-` (thank you, `@kbondo1`!) o Fixed bug in `arithmetic` when determining data type of an input raster. o `crds()` works when the **GRASS** vector has an attribute table. From 04269140ab5254e22061ea35c588e43d09cb9bcd Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 13:38:54 -0500 Subject: [PATCH 08/14] Fix progress bar --- R/bioclims_GRaster.r | 2 +- R/bioclims_SpatRaster.r | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/bioclims_GRaster.r b/R/bioclims_GRaster.r index fa57e8c5..2e55656c 100644 --- a/R/bioclims_GRaster.r +++ b/R/bioclims_GRaster.r @@ -122,7 +122,7 @@ methods::setMethod( ### number of tasks (used for progress bar nTasks <- 2 + length(bios) + - (any(meanTempBios %in% bios) & !is.null(tmean)) + + (any(meanTempBios %in% bios) & is.null(tmean)) + any(quarterTempBios %in% bios) + any(quarterPrecipBios %in% bios) + any(wettestQuarterBios %in% bios) + diff --git a/R/bioclims_SpatRaster.r b/R/bioclims_SpatRaster.r index 13dc4938..c103bdd2 100644 --- a/R/bioclims_SpatRaster.r +++ b/R/bioclims_SpatRaster.r @@ -54,7 +54,7 @@ methods::setMethod( ### number of tasks (used for progress bar nTasks <- length(bios) + - (any(meanTempBios %in% bios) & !is.null(tmean)) + + (any(meanTempBios %in% bios) & is.null(tmean)) + any(bios %in% quarterTempBios) + any(bios %in% quarterPrecipBios) + (any(bios %in% warmestQuarterBios) & !(53 %in% warmestQuarterBios)) + From 6e3631863c16a8d46249a0f6801fbbe6cc77eb8a Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 15:13:12 -0500 Subject: [PATCH 09/14] Update manual --- DESCRIPTION | 4 +- NAMESPACE | 2 + man/app.Rd | 1 + man/dot-makeGRaster.Rd | 29 ----------- man/dot-makeGVector.Rd | 38 -------------- man/fasterRaster.Rd | 2 + man/makeGRaster.Rd | 104 +++++++++++++++++++++++++++++++++++++ man/makeGVector.Rd | 113 +++++++++++++++++++++++++++++++++++++++++ man/rnormRast.Rd | 2 +- man/runifRast.Rd | 2 +- 10 files changed, 226 insertions(+), 71 deletions(-) delete mode 100644 man/dot-makeGRaster.Rd delete mode 100644 man/dot-makeGVector.Rd create mode 100644 man/makeGRaster.Rd create mode 100644 man/makeGVector.Rd diff --git a/DESCRIPTION b/DESCRIPTION index e3a7f2f1..40d00e71 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: fasterRaster Type: Package Title: Faster Raster and Spatial Vector Processing Using 'GRASS' -Version: 8.4.1.1 -Date: 2025-11-18 +Version: 8.4.1.2 +Date: 2026-04-17 Authors@R: c( person( diff --git a/NAMESPACE b/NAMESPACE index 5de4e956..db057eab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,6 +11,8 @@ export(grassInfo) export(grassStarted) export(installAddon) export(is.polygons) +export(makeGRaster) +export(makeGVector) export(mow) export(pcs) export(print) diff --git a/man/app.Rd b/man/app.Rd index db5cd7f7..5001dbf6 100644 --- a/man/app.Rd +++ b/man/app.Rd @@ -62,6 +62,7 @@ Tips: \item If you want to calculate values using while ignoring \code{NA} (or \code{null}) values, see the functions that begin with \code{n} (like \code{nmean}). \item Be mindful of the data type that a function returns. In \strong{GRASS}, these are \code{CELL} (integer), \code{FCELL} (floating point values--precise to about the 7th decimal place), and \code{DCELL} (double-floating point values--precise to about the 15th decimal place; commensurate with the \strong{R} \code{numeric} type). In cases where you want a \code{GRaster} to be treated like a float or double type raster, wrap the name of the \code{GRaster} in the \code{float()} or \code{double()} functions. This is especially useful if the \code{GRaster} might be assumed to be the \code{CELL} type because it only contains integer values. You can get the data type of a raster using \code{\link[=datatype]{datatype()}} with the \code{type} argument set to \code{GRASS}. You can change the data type of a \code{GRaster} using \code{\link[=as.int]{as.int()}}, \code{\link[=as.float]{as.float()}}, and \code{\link[=as.doub]{as.doub()}}. Note that categorical rasters are really \code{CELL} (integer) rasters with an associated "levels" table. You can also change a \code{CELL} raster to a \code{FCELL} raster by adding then subtracting a decimal value, as in \code{x - 0.1 + 0.1}. See \code{vignette("GRasters", package = "fasterRaster")}. \item The \code{rand()} function returns integer values by default. If you want non-integer values, use the tricks mentioned above to datatype non-integer values. For example, if you want uniform random values in the range between 0 and 1, use something like \verb{= float(rand(0 + 0.1, 1 + 0.1) - 0.1)}. +\item \code{GRaster}s with short names can cause the function to mis-specify the formula in \strong{GRASS}. This happens when, for example, the \code{fun} argument contains an "if" statement, and the raster name is "i" or "f", which would incorrectly replace those letters in the "if" with the \strong{GRASS} name of the raster. To avoid this, avoid using short raster names that could be part of longer operators using by \code{app()} (see \code{\link[=appFuns]{appFuns()}} for a list of these operators). } } \examples{ diff --git a/man/dot-makeGRaster.Rd b/man/dot-makeGRaster.Rd deleted file mode 100644 index 786b094b..00000000 --- a/man/dot-makeGRaster.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/00d_GRaster_class.r -\name{makeGRaster} -\alias{makeGRaster} -\title{Create a GRaster} -\usage{ -makeGRaster(src, names = "raster", levels = "", ac = NULL, fail = TRUE) -} -\arguments{ -\item{src}{Character (name of the raster in **GRASS) or a \code{rastInfo} object.} - -\item{names}{Character: Name of the raster.} - -\item{levels}{\code{NULL} (default), a \code{data.frame}, \code{data.table}, an empty string (\code{""}), or a list of \code{data.frame}s, \code{data.table}s, and/or empty strings: These become the raster's \code{\link[=levels]{levels()}}. If \code{""}, then no levels are defined.} - -\item{ac}{Vector of numeric/integer values >=1, or \code{NULL} (default): Active category column (offset by 1, so 1 really means the second column, 2 means the third, etc.). A value of \code{NULL} uses an automated procedure to figure it out.} - -\item{fail}{Logical: If \code{TRUE} (default), and the raster either has a 0 east-west or north-south extent, then exit the function with an error. If \code{fail} is \code{FALSE}, then display a warning and return \code{NULL}.} -} -\value{ -A \code{GRaster}. -} -\description{ -Create a \code{GRaster} from a raster existing in the current \strong{GRASS} session. -} -\seealso{ -\code{\link[=makeGVector]{makeGVector()}} -} -\keyword{internal} diff --git a/man/dot-makeGVector.Rd b/man/dot-makeGVector.Rd deleted file mode 100644 index 9387bb1f..00000000 --- a/man/dot-makeGVector.Rd +++ /dev/null @@ -1,38 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/00e_GVector_class.r -\name{makeGVector} -\alias{makeGVector} -\title{Create a GVector} -\usage{ -makeGVector( - src, - table = NULL, - build = TRUE, - extensive = FALSE, - cats = NULL, - fail = TRUE -) -} -\arguments{ -\item{src}{Character: The name of the vector in \strong{GRASS}.} - -\item{table}{A \code{data.table}, \code{data.frame}, \code{GVector} with a table, or character. This can be \code{data.table(NULL)} or \code{data.frame(NULL)} if there is no table associated with the vector. If a character, this is interpreted as the name of the table in \strong{GRASS}.} - -\item{build}{Logical: If \code{TRUE} (default), build topology using \strong{GRASS} tool \code{v.build}.} - -\item{extensive}{Logical: If \code{TRUE}, do extensive topological checks using \code{v.build}. The default is \code{FALSE}.} - -\item{cats}{\code{NULL} (default) or an integer vector: Values of the "cats" (categories) of the vector in \strong{GRASS}. This is useful \emph{only} for speeding up the \code{GVector} creation process when the "cats" have already been ascertained.} - -\item{fail}{Logical: If \code{TRUE} (default), and the vector either has a 0 east-west or north-south extent, then exit the function with an error. If \code{fail} is \code{FALSE}, then display a warning and return \code{NULL}.} -} -\value{ -A \code{GVector} (or \code{NULL} if \code{fail} is \code{TRUE} and the \code{GVector} would be invalid). -} -\description{ -Create a \code{GVector} from a vector existing in the current \strong{GRASS} session. -} -\seealso{ -\code{\link[=makeGRaster]{makeGRaster()}} -} -\keyword{internal} diff --git a/man/fasterRaster.Rd b/man/fasterRaster.Rd index fd5ffa70..8d2e6381 100644 --- a/man/fasterRaster.Rd +++ b/man/fasterRaster.Rd @@ -148,6 +148,8 @@ Operations on \code{GRaster}s \item \code{\link[=fractalRast]{fractalRast()}}: Create a fractal \code{GRaster} \item \code{\link[=init]{init()}}: GRaster with values equal to row, column, coordinate, regular, or "chess" \item \code{\link[=longlat]{longlat()}}: Create longitude/latitude rasters +\item \code{\link[=makeGRaster]{makeGRaster()}}: Create a \code{GRaster} from a \strong{GRASS} raster file +\item \code{\link[=makeGVector]{makeGVector()}}: Create a \code{GVector} from a \strong{GRASS} vector file \item \code{\link[=rNormRast]{rNormRast()}}: A random \code{GRaster} with values drawn from a normal distribution \item \code{\link[=rSpatialDepRast]{rSpatialDepRast()}}: Create a random \code{GRaster} with or without spatial dependence \item \code{\link[=rUnifRast]{rUnifRast()}}: A random \code{GRaster} with values drawn from a uniform distribution diff --git a/man/makeGRaster.Rd b/man/makeGRaster.Rd new file mode 100644 index 00000000..bf4ece02 --- /dev/null +++ b/man/makeGRaster.Rd @@ -0,0 +1,104 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/00d_GRaster_class.r +\name{makeGRaster} +\alias{makeGRaster} +\title{Create a GRaster from a GRASS raster} +\usage{ +makeGRaster(src, names = "raster", levels = "", ac = NULL, fail = TRUE) +} +\arguments{ +\item{src}{Character: The name of the raster in \strong{GRASS}.} + +\item{names}{Character: Name of the raster (cf. \code{\link[=names]{names()}}).} + +\item{levels}{\code{NULL} (default), a \code{data.frame}, \code{data.table}, an empty string (\code{""}), or a list of \code{data.frame}s, \code{data.table}s, and/or empty strings: These become the raster's \code{\link[=levels]{levels()}}. If \code{""}, then no levels are defined.} + +\item{ac}{Vector of numeric/integer values >=1, or \code{NULL} (default): Active category column (offset by 1, so 1 really means the second column, 2 means the third, etc.). A value of \code{NULL} uses an automated procedure to figure it out.} + +\item{fail}{Logical: If \code{TRUE} (default), and the raster either has a 0 east-west or north-south extent, then exit the function with an error. If \code{fail} is \code{FALSE}, then display a warning and return \code{NULL}.} +} +\value{ +A \code{GRaster}. +} +\description{ +Create a \code{GRaster} from a raster existing in the current \strong{GRASS} session. +} +\examples{ +if (grassStarted()) { + +# Setup +library(sf) +library(terra) + +# Example data +madElev <- fastData("madElev") # integer raster +madCover <- fastData("madCover") # categorical raster +madCoast4 <- fastData("madCoast4") # polygons vector +madRivers <- fastData("madRivers") # lines vector +madDypsis <- fastData("madDypsis") # points vector + +### Create GRasters from SpatRasters + +# Create an integer raster: +elev <- fast(madElev) +elev + +# Create a categorical raster: +cover <- fast(madCover) +madCover +levels(madCover) # category levels + +# Create a GRaster from a file on disk: +rastFile <- system.file("extdata", "madForest2000.tif", package = "fasterRaster") +forest2000 <- fast(rastFile) +forest2000 + +# Create a 1's raster that spans the world: +ones <- fast(rastOrVect = "raster", crs = "epsg:4326") +ones + +### Create GVectors + +# Create a GVector from an sf vector: +coast4 <- fast(madCoast4) +coast4 + +# Create a GVector from a SpatVector: +madRivers <- vect(madRivers) +class(madRivers) +rivers <- fast(madRivers) +rivers + +# Create a GVector from a vector on disk: +vectFile <- system.file("extdata/shapes", "madCoast.shp", + package = "fasterRaster") +coast0 <- fast(vectFile) +coast0 + +# Import only Dypsis occurrences in a restricted area: +ant <- coast4[coast4$NAME_4 == "Antanambe"] +dypsisRestrict <- fast(madDypsis, extent = ant) +dypsis <- fast(madDypsis) + +plot(coast4) +plot(ant, col = "gray80", add = TRUE) +plot(dypsis, add = TRUE) +plot(dypsisRestrict, col = "red", add = TRUE) + +# Create a generic GVector that spans the world: +wallToWall <- fast(rastOrVect = "vector", crs = "epsg:4326") # WGS84 +wallToWall + +# Create a GVector from a numeric vector +pts <- c(-90.2, 38.6, -122.3, 37.9) +pts <- fast(pts, crs = "epsg:4326") # WGS84 + +# Create a GVector from a matrix (can also use data.frame or data.table): +mat <- matrix(c(-90.2, 38.6, -122.3, 37.9), ncol = 2, byrow = TRUE) +mat <- fast(mat, crs = "epsg:4326", keepgeom = TRUE) # WGS84 + +} +} +\seealso{ +\code{\link[=makeGVector]{makeGVector()}} +} diff --git a/man/makeGVector.Rd b/man/makeGVector.Rd new file mode 100644 index 00000000..2ff31192 --- /dev/null +++ b/man/makeGVector.Rd @@ -0,0 +1,113 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/00e_GVector_class.r +\name{makeGVector} +\alias{makeGVector} +\title{Create a GVector from a GRASS vector} +\usage{ +makeGVector( + src, + table = NULL, + build = TRUE, + extensive = FALSE, + cats = NULL, + fail = TRUE +) +} +\arguments{ +\item{src}{Character: The name of the vector in \strong{GRASS}.} + +\item{table}{A \code{data.table}, \code{data.frame}, \code{GVector} with a table, or character. This can be \code{data.table(NULL)} or \code{data.frame(NULL)} if there is no table associated with the vector. If a character, this is interpreted as the name of the table in \strong{GRASS}.} + +\item{build}{Logical: If \code{TRUE} (default), build topology using \strong{GRASS} tool \code{v.build}.} + +\item{extensive}{Logical: If \code{TRUE}, do extensive topological checks using \code{v.build}. The default is \code{FALSE}.} + +\item{cats}{\code{NULL} (default) or an integer vector: Values of the "cats" (categories) of the vector in \strong{GRASS}. This is useful \emph{only} for speeding up the \code{GVector} creation process when the "cats" have already been ascertained. For most users, this will be better left as \code{NULL}.} + +\item{fail}{Logical: If \code{TRUE} (default), and the vector either has a 0 east-west or north-south extent, then exit the function with an error. If \code{fail} is \code{FALSE}, then display a warning and return \code{NULL}.} +} +\value{ +A \code{GVector} (or \code{NULL} if \code{fail} is \code{TRUE} and the \code{GVector} would be invalid). +} +\description{ +Create a \code{GVector} from a vector existing in the current \strong{GRASS} session. +} +\examples{ +if (grassStarted()) { + +# Setup +library(sf) +library(terra) + +# Example data +madElev <- fastData("madElev") # integer raster +madCover <- fastData("madCover") # categorical raster +madCoast4 <- fastData("madCoast4") # polygons vector +madRivers <- fastData("madRivers") # lines vector +madDypsis <- fastData("madDypsis") # points vector + +### Create GRasters from SpatRasters + +# Create an integer raster: +elev <- fast(madElev) +elev + +# Create a categorical raster: +cover <- fast(madCover) +madCover +levels(madCover) # category levels + +# Create a GRaster from a file on disk: +rastFile <- system.file("extdata", "madForest2000.tif", package = "fasterRaster") +forest2000 <- fast(rastFile) +forest2000 + +# Create a 1's raster that spans the world: +ones <- fast(rastOrVect = "raster", crs = "epsg:4326") +ones + +### Create GVectors + +# Create a GVector from an sf vector: +coast4 <- fast(madCoast4) +coast4 + +# Create a GVector from a SpatVector: +madRivers <- vect(madRivers) +class(madRivers) +rivers <- fast(madRivers) +rivers + +# Create a GVector from a vector on disk: +vectFile <- system.file("extdata/shapes", "madCoast.shp", + package = "fasterRaster") +coast0 <- fast(vectFile) +coast0 + +# Import only Dypsis occurrences in a restricted area: +ant <- coast4[coast4$NAME_4 == "Antanambe"] +dypsisRestrict <- fast(madDypsis, extent = ant) +dypsis <- fast(madDypsis) + +plot(coast4) +plot(ant, col = "gray80", add = TRUE) +plot(dypsis, add = TRUE) +plot(dypsisRestrict, col = "red", add = TRUE) + +# Create a generic GVector that spans the world: +wallToWall <- fast(rastOrVect = "vector", crs = "epsg:4326") # WGS84 +wallToWall + +# Create a GVector from a numeric vector +pts <- c(-90.2, 38.6, -122.3, 37.9) +pts <- fast(pts, crs = "epsg:4326") # WGS84 + +# Create a GVector from a matrix (can also use data.frame or data.table): +mat <- matrix(c(-90.2, 38.6, -122.3, 37.9), ncol = 2, byrow = TRUE) +mat <- fast(mat, crs = "epsg:4326", keepgeom = TRUE) # WGS84 + +} +} +\seealso{ +\code{\link[=makeGRaster]{makeGRaster()}} +} diff --git a/man/rnormRast.Rd b/man/rnormRast.Rd index 7479ec0c..ac135419 100644 --- a/man/rnormRast.Rd +++ b/man/rnormRast.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rNormRast.r +% Please edit documentation in R/rnormRast.r \name{rNormRast,GRaster-method} \alias{rNormRast,GRaster-method} \alias{rNormRast} diff --git a/man/runifRast.Rd b/man/runifRast.Rd index 02063c84..6631fdaf 100644 --- a/man/runifRast.Rd +++ b/man/runifRast.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rUnifRast.r +% Please edit documentation in R/runifRast.r \name{rUnifRast,GRaster-method} \alias{rUnifRast,GRaster-method} \alias{rUnifRast} From 97cf980be7a98ed31b8b8ec5ddc192b77fce7d93 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 15:13:22 -0500 Subject: [PATCH 10/14] Fix `@export` --- R/00d_GRaster_class.r | 2 +- R/00e_GVector_class.r | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/00d_GRaster_class.r b/R/00d_GRaster_class.r index f22f7d2a..13a3deec 100644 --- a/R/00d_GRaster_class.r +++ b/R/00d_GRaster_class.r @@ -162,7 +162,7 @@ methods::setValidity("GRaster", #' #' @aliases makeGRaster #' @rdname makeGRaster -#' @exportMethod makeGRaster +#' @export makeGRaster makeGRaster <- function(src, names = "raster", levels = "", ac = NULL, fail = TRUE) { if (inherits(src, "rastInfo")) { diff --git a/R/00e_GVector_class.r b/R/00e_GVector_class.r index 6fff2d34..090597ac 100644 --- a/R/00e_GVector_class.r +++ b/R/00e_GVector_class.r @@ -70,7 +70,7 @@ methods::setValidity("GVector", #' #' @aliases makeGVector #' @rdname makeGVector -#' @exportMethod makeGVector +#' @export makeGVector makeGVector <- function(src, table = NULL, build = TRUE, extensive = FALSE, cats = NULL, fail = TRUE) { if (inherits(table, "GVector")) table <- table@table From 88cd538fd152b4e7c031e7d0ec7bd690fb65f8e4 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 15:48:19 -0500 Subject: [PATCH 11/14] Update citation --- README.md | 2 +- inst/pkgdown.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53009fe8..1ea89626 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,6 @@ Note that the `M1.M2` and `S1.S2` increment independently. For example, if the v # Citation Please see and cite: -Smith, A.B. 2025. `fasterRaster`: GIS in `R` using `GRASS` for large vectors and rasters. *Transactions in GIS* 30:e70238. 10.1111/tgis.70238, EarthArXiv open-access preprint doi: 10.31223/X52R0M +Smith, A.B. 2025. `fasterRaster`: GIS in `R` using `GRASS` for large vectors and rasters. *Transactions in GIS* 30:e70238. DOI: [10.1111/tgis.70238](https://doi.org/10.1111/tgis.70238), Open-access preprint: [10.31223/X52R0M](https://doi.org/10.31223/X52R0M) ~ Adam diff --git a/inst/pkgdown.yml b/inst/pkgdown.yml index 5bbdd6d7..314b2d8f 100644 --- a/inst/pkgdown.yml +++ b/inst/pkgdown.yml @@ -9,7 +9,7 @@ articles: projects_mapsets: projects_mapsets.html regions: regions.html three_d_objects: three_d_objects.html -last_built: 2025-11-18T15:29Z +last_built: 2026-04-17T20:36Z urls: reference: https://github.com/adamlilith/fasterRaster/reference article: https://github.com/adamlilith/fasterRaster/articles From 49e5a3eaf972bac2bbdc12716331afd46500c206 Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 16:07:44 -0500 Subject: [PATCH 12/14] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 65793756..b1bfb278 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# fasterRaster 8.4.1.2 (2026-XX-XX) +# fasterRaster 8.4.1.2 (2026-04-17) ### New functions and functionality o `makeGRaster()` and `makeGVector()` are now public and allow users to create `G`-objects from files in **GRASS**. (feature request https://github.com/adamlilith/fasterRaster/issues/137 -- thank you, @JacobusS!) o Updated citation to peer-reviewed journal article From e097081070209ca7794b717bd43c3a8dfd33f47f Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 16:07:49 -0500 Subject: [PATCH 13/14] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ea89626..155cddf2 100644 --- a/README.md +++ b/README.md @@ -193,4 +193,5 @@ Please see and cite: Smith, A.B. 2025. `fasterRaster`: GIS in `R` using `GRASS` for large vectors and rasters. *Transactions in GIS* 30:e70238. DOI: [10.1111/tgis.70238](https://doi.org/10.1111/tgis.70238), Open-access preprint: [10.31223/X52R0M](https://doi.org/10.31223/X52R0M) -~ Adam + +`~` Adam From 6c4d8bf829836c70428281cc9d6caea2c145dfbe Mon Sep 17 00:00:00 2001 From: "Adam B. Smith" Date: Fri, 17 Apr 2026 16:07:53 -0500 Subject: [PATCH 14/14] Update pkgdown.yml --- inst/pkgdown.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/pkgdown.yml b/inst/pkgdown.yml index 314b2d8f..06cdc75c 100644 --- a/inst/pkgdown.yml +++ b/inst/pkgdown.yml @@ -9,7 +9,7 @@ articles: projects_mapsets: projects_mapsets.html regions: regions.html three_d_objects: three_d_objects.html -last_built: 2026-04-17T20:36Z +last_built: 2026-04-17T20:49Z urls: reference: https://github.com/adamlilith/fasterRaster/reference article: https://github.com/adamlilith/fasterRaster/articles