# Create a dummy template raster
library(terra)
template_raster_ex <- rast(nrows=10, ncols=10, xmin=0, xmax=100, ymin=0, ymax=100,
crs="EPSG:25830")
# Create dummy candidate_surfaces (sf object with polygons)
# Ensure 'size' column exists
library(sf)
poly1 <- st_polygon(list(cbind(c(10,10,30,30,10), c(10,30,30,10,10))))
poly2 <- st_polygon(list(cbind(c(50,50,70,70,50), c(50,70,70,50,50))))
poly3 <- st_polygon(list(cbind(c(20,20,40,40,20), c(20,40,40,20,20))))
candidate_surfaces_ex <- st_sf(
id = 1:3,
size = c(400, 400, 400), # Dummy sizes for example
geometry = st_sfc(poly1, poly2, poly3),
crs = 25830
)
# Example reference surface
reference_surface_ex <- 1000
# Calculate burned probability
bp_raster <- calc_abp(template_raster = template_raster_ex,
candidate_surfaces = candidate_surfaces_ex,
reference_surface = reference_surface_ex)
plot(bp_raster, main = "Burned Probability Raster")
Run the code above in your browser using DataLab