Skip to content

Commit

Permalink
fixes corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad committed Apr 14, 2024
1 parent ba845f8 commit 5dd1b87
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/lsp_add_spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ lsp_add_stars.lsp = function(x = NULL, window = NULL, metadata = TRUE){
if (metadata_attr$use_window && is.null(window)){
stop("This function requires an sf object in the window argument for irregular local landscapes.", call. = FALSE)
}
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"
if (!is.null(metadata_attr$window_shift)){
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,
Expand Down

0 comments on commit 5dd1b87

Please sign in to comment.