Skip to content

Commit

Permalink
fixes r-spatial#95
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Nov 23, 2021
1 parent f6c8a9c commit 9205ddd
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: gstat
Version: 2.0-8
Version: 2.0-9
Title: Spatial and Spatio-Temporal Geostatistical Modelling, Prediction
and Simulation
Authors@R: c(person(given = "Edzer",
Expand Down
2 changes: 1 addition & 1 deletion R/circEmbed.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ krigeSimCE <- function(formula, data, newdata, model, n = 1, ext = 2) {
stopifnot(is(model, "variogramModel"))
stopifnot(gridded(newdata))
if (!missing(data))
stopifnot(identical(data@proj4string, newdata@proj4string))
stopifnot(identical(data@proj4string@projargs, newdata@proj4string@projargs))

varName <- all.vars(formula[[2]])

Expand Down
2 changes: 1 addition & 1 deletion R/gstat.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function (g, id, formula, locations,
g = list()
g[["data"]] = list()
g[["model"]] = list()
} else if (!dummy && inherits(g$data[[1]], "Spatial") && !identical(g$data[[1]]$data@proj4string, data@proj4string))
} else if (!dummy && inherits(g$data[[1]], "Spatial") && !identical(g$data[[1]]$data@proj4string@projargs, data@proj4string@projargs))
stop("data items in gstat object have different coordinate reference systems")
if (missing(id))
id = paste("var", length(g$data) + 1, sep = "")
Expand Down
4 changes: 2 additions & 2 deletions R/krige0.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ krige0 <- function(formula, data, newdata, model, beta, y, ...,
computeVar = FALSE, fullCovariance = FALSE) {

if (inherits(data, "ST"))
stopifnot(identical(data@sp@proj4string, newdata@sp@proj4string))
stopifnot(identical(data@sp@proj4string@projargs, newdata@sp@proj4string@projargs))
else
stopifnot(identical(data@proj4string, newdata@proj4string))
stopifnot(identical(data@proj4string@projargs, newdata@proj4string@projargs))
lst = extractFormula(formula, data, newdata)
X = lst$X
x0 = lst$x0
Expand Down
2 changes: 1 addition & 1 deletion R/krigeST.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ krigeST <- function(formula, data, newdata, modelList, beta, y, ...,
newdata = as(newdata, "STFDF")
TRUE
} else {
if (!identical(data@sp@proj4string, newdata@sp@proj4string))
if (!identical(data@sp@proj4string@projargs, newdata@sp@proj4string@projargs))
message("please verify that the CRSs of data and newdata are identical, or transform them first to make them identical")
FALSE
}
Expand Down
2 changes: 1 addition & 1 deletion R/predict.gstat.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function (object, newdata, block = numeric(0), nsim = 0, indicators = FALSE,
name = names(object$data)[i]
d = object$data[[i]]
if (!is.null(d$data)) {
if (!identical(d$data@proj4string, newdata@proj4string)) {
if (!identical(d$data@proj4string@projargs, newdata@proj4string@projargs)) {
print(proj4string(d$data))
print(proj4string(newdata))
stop(paste(name, ": data item in gstat object and newdata have different coordinate reference systems"))
Expand Down
2 changes: 1 addition & 1 deletion R/variogram.gstat.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
for (i in seq(along = object$data)) {
d = object$data[[i]]
beta[[i]] = d$beta
if (i > 1 && !identical(object$data[[1]]$data@proj4string, d$data@proj4string))
if (i > 1 && !identical(object$data[[1]]$data@proj4string@projargs, d$data@proj4string@projargs))
stop("data items in gstat object have different coordinate reference systems")
raw = gstat.formula(d$formula, d$data)
y[[i]] = raw$y
Expand Down
5 changes: 5 additions & 0 deletions inst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2021-10-06 Edzer Pebesma <[email protected]>

* inst/ChangeLog, src/data.c, src/mtrx.c, src/s.c, src/select.c,
src/userio.c: fix CRAN issues * PROBLEM ... ERROR now error("%s", arg); * several compiler warnings * add #include R.h to mtrx.c

2021-09-25 Edzer Pebesma <[email protected]>

* R/gstat.R, inst/ChangeLog, src/lm.c, src/mtrx.c,
Expand Down
4 changes: 2 additions & 2 deletions tests/stars.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.1.1 (2021-08-10) -- "Kick Things"
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -536,4 +536,4 @@ sample 1 5 NA NA NA NA sim1,...,sim5
>
> proc.time()
user system elapsed
5.075 0.176 5.243
4.922 0.130 5.044
4 changes: 2 additions & 2 deletions tests/windst.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.0.4 (2021-02-15) -- "Lost Library Book"
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -145,4 +145,4 @@ x2 5535500 6309500
>
> proc.time()
user system elapsed
3.815 0.096 3.904
4.207 0.127 4.329

0 comments on commit 9205ddd

Please sign in to comment.