From d5de130d4e33ae37b5bd6e9a84b08e5c523b4ce5 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 14 Apr 2024 17:27:52 +0200 Subject: [PATCH] fixes ifs --- R/lsp_add_spatial.R | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/R/lsp_add_spatial.R b/R/lsp_add_spatial.R index 40ad7fe..b162fd6 100644 --- a/R/lsp_add_spatial.R +++ b/R/lsp_add_spatial.R @@ -108,13 +108,13 @@ lsp_add_stars.lsp = function(x = NULL, window = NULL, metadata = TRUE){ if (metadata_attr$window_shift == 0) { output_stars = stars::st_as_stars(metadata_attr$bb, nx = 1, ny = 1, values = 1) names(output_stars) = "id" + } else if (is.null(window)){ + output_stars = lsp_create_grid(x_crs = metadata_attr$crs, + x_bb = metadata_attr$bb, + x_delta_row = metadata_attr$delta_y, + x_delta_col = metadata_attr$delta_x, + window_shift = metadata_attr$window_shift) } - } else if (is.null(window)){ - output_stars = lsp_create_grid(x_crs = metadata_attr$crs, - x_bb = metadata_attr$bb, - x_delta_row = metadata_attr$delta_y, - x_delta_col = metadata_attr$delta_x, - window_shift = metadata_attr$window_shift) } else { output_stars = stars::st_rasterize(window[1], template = stars::st_as_stars(metadata_attr$bb,