if (FALSE) {
# Case 1: Multiple Otsu-based burned area shapefiles
rast <- terra::rast("rbr_doy_stack_1987.tif")
polys <- list(
ge50 = "burned_areas_1987_otsu_ge50.shp",
ge100 = "burned_areas_1987_otsu_ge100.shp"
)
calculate_doy_flags(
raster = rast,
doy_band = 2,
polygons_sf = polys,
output_dir = "output/",
year = 1987,
stats = "both",
doy_thresholds = c(10, 15),
calc_percentiles = TRUE,
percentiles = c(0.05, 0.25, 0.95),
polygonize = TRUE,
python_exe = "/usr/bin/python",
gdal_polygonize_script = "/usr/bin/gdal_polygonize.py"
)
# Case 2: Single shapefile without polygonization
calculate_doy_flags(
raster = rast,
polygons_sf = "burned_areas_1987_origval.shp",
output_dir = "output/",
year = 1987,
stats = "median",
doy_thresholds = 10,
calc_percentiles = FALSE,
polygonize = FALSE
)
}
Run the code above in your browser using DataLab