Custom schemes are validated rectangular regions. Required columns
are class_id, label, depth_min,
depth_max, velocity_min, and
velocity_max.
rules <- data.frame(
class_id = c(1L, 2L), label = c("Slow", "Fast"),
depth_min = c(0, 0), depth_max = c(Inf, Inf),
velocity_min = c(0, 0.5), velocity_max = c(0.5, Inf)
)
custom <- meso_scheme(rules, name = "Two velocity classes")
validate_meso_scheme(custom)
plot_meso_scheme(custom)Overlaps are always rejected. Gaps are rejected unless
allow_gaps = TRUE; observations in an allowed gap return
NA. Validation evaluates exact breakpoints and
representatives of every interval, not a random sample.
## Error:
## ! Overlapping classes 1 ('Slow') and 2 ('Fast') near depth 0 and velocity 0.4.
## Error:
## ! Uncovered depth-velocity region near depth 0 and velocity 0.4. Set `allow_gaps = TRUE` only when gaps are intentional.
## depth velocity mesohabitat_class mesohabitat
## 1 1 0.5 NA <NA>
The custom scheme can be supplied to every table, vector, raster, and scenario classifier. Users are responsible for scientifically justifying and reporting custom thresholds and units.
h <- mesohabitat_example_rasters()
custom_raster <- classify_mesohabitat_raster(
h$depth, h$velocity, scheme = custom
)
plot_mesohabitat(custom_raster, scheme = custom)