From 194f35cc7580abe6a348334103ae455743cbd912 Mon Sep 17 00:00:00 2001 From: Sean Rohan <65584161+sean-rohan-NOAA@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:55:11 -0800 Subject: [PATCH] Update interpolate_variable.R --- R/interpolate_variable.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/R/interpolate_variable.R b/R/interpolate_variable.R index b7d1ad5..8d2d1e2 100644 --- a/R/interpolate_variable.R +++ b/R/interpolate_variable.R @@ -130,6 +130,15 @@ interpolate_variable <- function(dat, xshift <- ((-1625000/cell_resolution) - floor(-1625000/cell_resolution))*cell_resolution yshift <- ((379500/cell_resolution) - floor(379500/cell_resolution))*cell_resolution bbox <- bbox + c(xshift,yshift,xshift,yshift) + + interp_raster <- terra::rast(xmin = bbox["xmin"], + xmax = bbox["xmax"], + ymin = bbox["ymin"], + ymax = bbox["ymax"], + nrows = floor((bbox["ymax"]-bbox["ymin"])/cell.resolution), + ncols = floor((bbox["xmax"]-bbox["xmin"])/cell.resolution), + crs = interpolation.crs) + } } else { # User-customized interpolation bounds @@ -273,4 +282,4 @@ interpolate_variable <- function(dat, -} \ No newline at end of file +}