Skip to content

Commit

Permalink
improve creation of mask from raster data
Browse files Browse the repository at this point in the history
  • Loading branch information
HannaMeyer committed Oct 18, 2024
1 parent 5804c4e commit 2a154f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/geodist.R
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ sampleFromArea <- function(modeldomain, samplesize, type,variables,sampling, cat
}
#create mask to sample from:
template <- modeldomain[[1]]
terra::values(template)[!is.na(terra::values(template))] <-1
#terra::values(template)[!is.na(terra::values(template))] <-1
template <- terra::classify(template, cbind(-Inf, Inf, 1), right=FALSE)
modeldomainextent <- terra::as.polygons(template) |>
sf::st_as_sf() |>
sf::st_geometry()
Expand Down

0 comments on commit 2a154f3

Please sign in to comment.