From be05d3160fa77b11a882ea35b5516d7259fb031c Mon Sep 17 00:00:00 2001 From: rhijmans Date: Wed, 7 Feb 2024 19:21:03 +0100 Subject: [PATCH] r --- R/rast.R | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/R/rast.R b/R/rast.R index f6c2b1caa..fb837c416 100644 --- a/R/rast.R +++ b/R/rast.R @@ -75,7 +75,7 @@ setMethod("rast", signature(x="missing"), rast_from_image <- function(x) { - # list should represent an "image" + # list representing an "image" if (! all(dim(x$z) == c(length(x$x), length(x$y)))) { error("rast", '"z" does not have the right dimensions') } @@ -95,17 +95,14 @@ rast_from_image <- function(x) { if (dx > 0.01 | dy > 0.01) { error("rast", "data are not on a regular grid") } - if (xmn > -360.1 & xmx < 360.1 & ymn > -90.1 & ymx < 90.1) { - crs <- "+proj=longlat +datum=WGS84" - } else { - crs <- "" - } +# if (xmn > -360.1 & xmx < 360.1 & ymn > -90.1 & ymx < 90.1) { +# crs <- "+proj=longlat +datum=WGS84" +# } else { +# crs <- "" +# } x <- t(x$z) x <- x[nrow(x):1, ] - - r <- rast(nrows=nrow(x), ncols=ncol(x), extent=ext(xmn, xmx, ymn, ymx), crs=crs) - values(r) <- as.vector(t(x)) - r + rast(x, extent=ext(xmn, xmx, ymn, ymx), crs="") }