Skip to content

Commit

Permalink
break link to input xyz before changing it internally
Browse files Browse the repository at this point in the history
  • Loading branch information
CeresBarros committed Feb 10, 2024
1 parent 4ab31f5 commit c44e900
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/dbGetRaster.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pgGetTerra <- function(conn, name, tile, rast = "rast", bands = 37:73,
#' @return integer. A bounding box (e.g. `c(51, 50, -121, -122)`)
#' @export
get_bb <- function(in_xyz) {
.checkXYZ(in_xyz)
.checkXYZ(copy(in_xyz))
thebb <- c(max(in_xyz[, "lat"]), min(in_xyz[, "lat"]), max(in_xyz[, "lon"]), min(in_xyz[, "lon"]))

if (any(is.na(thebb))) {
Expand Down
4 changes: 2 additions & 2 deletions R/downscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ climr_downscale <- function(xyz, which_normal = c("auto", list_normal()), histor
gcm_hist_years, max_run, vars)

expectedCols <- c("lon", "lat", "elev", "id")
xyz <- .checkXYZ(xyz, expectedCols)
xyz <- .checkXYZ(copy(xyz), expectedCols)

dbCon <- data_connect()
thebb <- get_bb(xyz) ## get bounding box based on input points
Expand Down Expand Up @@ -310,7 +310,7 @@ downscale <- function(xyz, normal, gcm = NULL, historic = NULL, gcm_ts = NULL, g
historic_ts, return_normal, vars)

expectedCols <- c("lon", "lat", "elev", "id")
xyz <- .checkXYZ(xyz, expectedCols)
xyz <- .checkXYZ(copy(xyz), expectedCols)

if (isTRUE(nthread > 1L)) {
if (!requireNamespace("parallel")) {
Expand Down

0 comments on commit c44e900

Please sign in to comment.