Skip to content

Commit c24788d

Browse files
authored
Merge pull request #139 from adamlilith/its_a_new_world
# 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 #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 #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.
2 parents 9db86da + 6c4d8bf commit c24788d

115 files changed

Lines changed: 485 additions & 283 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: fasterRaster
22
Type: Package
33
Title: Faster Raster and Spatial Vector Processing Using 'GRASS'
4-
Version: 8.4.1.1
5-
Date: 2025-11-18
4+
Version: 8.4.1.2
5+
Date: 2026-04-17
66
Authors@R:
77
c(
88
person(

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export(grassInfo)
1111
export(grassStarted)
1212
export(installAddon)
1313
export(is.polygons)
14+
export(makeGRaster)
15+
export(makeGVector)
1416
export(mow)
1517
export(pcs)
1618
export(print)

NEWS.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# fasterRaster 8.4.1.2 (2026-04-17)
2+
### New functions and functionality
3+
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!)
4+
o Updated citation to peer-reviewed journal article
5+
6+
### Bug fixes
7+
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!)
8+
o `bioclims()` properly calculates progress bar width so you know how long you have to go get a coffee.
9+
o `resample()` correctly calculates number of rows in output raster.
10+
111
# fasterRaster 8.4.1.1 (2025-11-18)
212
### New functions and functionality
313
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.
261271
o **+** `rasterize()`: Rewritten to perform (nearly) the same as `terra::rasterize()`.
262272
o `predict()`: Can accommodate models with two-way interactions between categorical rasters and between a categorical predictor and a scalar.
263273
o `scalepop()`: Scales `GRaster`s by population standard deviation.
264-
o Stops with a somewhat informative error when a `GRaster` fails to be created (in hidden function `.makeGRaster()`)
274+
o Stops with a somewhat informative error when a `GRaster` fails to be created (in hidden function `makeGRaster()`)
265275

266276
### Issues
267277
o `writeRaster()`: Correctly assign `datatype` to `CELL` rasters.
@@ -315,7 +325,7 @@ o Updated `README` for 8.3.0.7013!
315325

316326
### Bug fixes
317327
o `[` works consistently for `GVector`s!!!!!
318-
o Hidden function `.makeGVector()` now catches cases with zero extent for polygons.
328+
o Hidden function `makeGVector()` now catches cases with zero extent for polygons.
319329
o Fixed installation issue related to `activeCat()<-` and `addCats()<-` (thank you, `@kbondo1`!)
320330
o Fixed bug in `arithmetic` when determining data type of an input raster.
321331
o `crds()` works when the **GRASS** vector has an attribute table.

R/00d_GRaster_class.r

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,26 @@ methods::setValidity("GRaster",
144144
} # EOF
145145
)
146146

147-
#' Create a GRaster
147+
#' Create a GRaster from a GRASS raster
148148
#'
149149
#' @description Create a `GRaster` from a raster existing in the current **GRASS** session.
150150
#'
151-
#' @param src Character (name of the raster in **GRASS) or a `rastInfo` object.
152-
#' @param names Character: Name of the raster.
151+
#' @param src Character: The name of the raster in **GRASS**.
152+
#' @param names Character: Name of the raster (cf. [names()]).
153153
#' @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.
154154
#' @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.
155155
#' @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`.
156156
#'
157157
#' @returns A `GRaster`.
158158
#'
159-
#' @seealso [.makeGVector()]
159+
#' @seealso [makeGVector()]
160160
#'
161-
#' @keywords internal
162-
.makeGRaster <- function(src, names = "raster", levels = "", ac = NULL, fail = TRUE) {
161+
#' @example man/examples/ex_fast.r
162+
#'
163+
#' @aliases makeGRaster
164+
#' @rdname makeGRaster
165+
#' @export makeGRaster
166+
makeGRaster <- function(src, names = "raster", levels = "", ac = NULL, fail = TRUE) {
163167

164168
if (inherits(src, "rastInfo")) {
165169
info <- src

R/00e_GVector_class.r

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ methods::setValidity("GVector",
4646
} # EOF
4747
)
4848

49-
#' Create a GVector
49+
#' Create a GVector from a GRASS vector
5050
#'
5151
#' @description Create a `GVector` from a vector existing in the current **GRASS** session.
5252
#'
@@ -58,16 +58,20 @@ methods::setValidity("GVector",
5858
#'
5959
#' @param extensive Logical: If `TRUE`, do extensive topological checks using `v.build`. The default is `FALSE`.
6060
#'
61-
#' @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.
61+
#' @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`.
6262
#'
6363
#' @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`.
6464
#'
6565
#' @returns A `GVector` (or `NULL` if `fail` is `TRUE` and the `GVector` would be invalid).
6666
#'
67-
#' @seealso [.makeGRaster()]
67+
#' @seealso [makeGRaster()]
6868
#'
69-
#' @keywords internal
70-
.makeGVector <- function(src, table = NULL, build = TRUE, extensive = FALSE, cats = NULL, fail = TRUE) {
69+
#' @example man/examples/ex_fast.r
70+
#'
71+
#' @aliases makeGVector
72+
#' @rdname makeGVector
73+
#' @export makeGVector
74+
makeGVector <- function(src, table = NULL, build = TRUE, extensive = FALSE, cats = NULL, fail = TRUE) {
7175

7276
if (inherits(table, "GVector")) table <- table@table
7377
if (is.null(table)) table <- data.table::data.table(NULL)

R/04_arithmetic.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ methods::setMethod(
462462
.genericArithRast <- function(name, src, ex) {
463463

464464
rgrass::execGRASS(cmd = "r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite"))
465-
.makeGRaster(src, name)
465+
makeGRaster(src, name)
466466

467467
}
468468

R/05_GRaster_functions_by_layer.r

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ setMethod(
6565
)
6666

6767
}
68-
.makeGRaster(srcs, names(x))
68+
makeGRaster(srcs, names(x))
6969

7070
} # EOF
7171
)
@@ -101,7 +101,7 @@ methods::setMethod(
101101
)
102102

103103
}
104-
.makeGRaster(srcs, names(x))
104+
makeGRaster(srcs, names(x))
105105

106106
}
107107
)
@@ -251,7 +251,7 @@ setMethod(
251251
)
252252

253253
}
254-
.makeGRaster(srcs, names(x))
254+
makeGRaster(srcs, names(x))
255255

256256
} # EOF
257257
)
@@ -278,7 +278,7 @@ setMethod(
278278
)
279279

280280
}
281-
.makeGRaster(srcs, names(x))
281+
makeGRaster(srcs, names(x))
282282

283283
} # EOF
284284
)
@@ -404,7 +404,7 @@ setMethod(
404404
)
405405

406406
}
407-
.makeGRaster(srcs, names(x))
407+
makeGRaster(srcs, names(x))
408408

409409
}
410410

@@ -430,7 +430,7 @@ setMethod(
430430
)
431431
}
432432

433-
.makeGRaster(srcs, names(x))
433+
makeGRaster(srcs, names(x))
434434

435435
}
436436

@@ -459,7 +459,7 @@ setMethod(
459459
)
460460

461461
}
462-
.makeGRaster(srcs, names(x))
462+
makeGRaster(srcs, names(x))
463463

464464
}
465465

@@ -488,6 +488,6 @@ setMethod(
488488
flags = c(.quiet(), "overwrite")
489489
)
490490
}
491-
.makeGRaster(srcs, fx)
491+
makeGRaster(srcs, fx)
492492

493493
}

R/06_GRaster_functions_across_layers.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ setMethod(
248248

249249
.rm(c(srcSS, srcCount), type = "raster", warn = FALSE)
250250

251-
out <- .makeGRaster(src, "sd")
251+
out <- makeGRaster(src, "sd")
252252

253253
# population standard deviation
254254
} else {
@@ -307,7 +307,7 @@ setMethod(
307307
)
308308

309309
.rm(c(srcSS, srcCount), type = "raster", warn = FALSE)
310-
.makeGRaster(src, "var")
310+
makeGRaster(src, "var")
311311

312312
} # EOF
313313
)
@@ -401,7 +401,7 @@ setMethod(
401401
if (na.rm) args$flags <- c(args$flags, "n")
402402

403403
do.call(rgrass::execGRASS, args = args)
404-
.makeGRaster(src, fxName)
404+
makeGRaster(src, fxName)
405405

406406
} # EOF
407407
)
@@ -424,7 +424,7 @@ setMethod(
424424
ex <- paste(ex, collapse = " | ")
425425
ex <- paste0(src, " = ", ex)
426426
rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite"))
427-
.makeGRaster(src, "layer")
427+
makeGRaster(src, "layer")
428428

429429
} # EOF
430430
)
@@ -448,7 +448,7 @@ setMethod(
448448
ex <- paste(ex, collapse = " & ")
449449
ex <- paste0(src, " = ", ex)
450450
rgrass::execGRASS("r.mapcalc", expression = ex, flags = c(.quiet(), "overwrite"))
451-
.makeGRaster(src, "layer")
451+
makeGRaster(src, "layer")
452452

453453
} # EOF
454454
)
@@ -487,7 +487,7 @@ setMethod(
487487
} else {
488488
levels <- NULL
489489
}
490-
out <- .makeGRaster(src, fxName, levels = levels)
490+
out <- makeGRaster(src, fxName, levels = levels)
491491
} else if (return == "source") {
492492
out <- src
493493
} else {

R/07_comparison.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ methods::setMethod(
354354
}
355355

356356
} # next layer
357-
out <- .makeGRaster(srcs, "logical", levels = cats(e1), ac = activeCats(e1))
357+
out <- makeGRaster(srcs, "logical", levels = cats(e1), ac = activeCats(e1))
358358
out
359359

360360
} # EOF
@@ -446,7 +446,7 @@ methods::setMethod(
446446
}
447447

448448
} # next layer
449-
out <- .makeGRaster(srcs, "logical", levels = cats(e2), ac = activeCats(e2))
449+
out <- makeGRaster(srcs, "logical", levels = cats(e2), ac = activeCats(e2))
450450
out
451451

452452
} # EOF

R/aggregate.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ methods::setMethod(
136136
levs <- NULL
137137
}
138138

139-
this <- .makeGRaster(srcs[i], names = names(x)[i], levels = levs)
139+
this <- makeGRaster(srcs[i], names = names(x)[i], levels = levs)
140140
if (i == 1L) {
141141
out <- this
142142
} else {
@@ -210,7 +210,7 @@ methods::setMethod(
210210

211211
} # if data table has >= 2 rows
212212

213-
.makeGVector(src, table = aggTable)
213+
makeGVector(src, table = aggTable)
214214

215215
} # EOF
216216
)

0 commit comments

Comments
 (0)