Assigns a new management system to a fraction of surface area by selecting clusters that match given spatial and structural criteria.
Usage
allocate_surface(
map,
system,
target_fraction,
ditches = 1:26,
field_type = c("both", "regular", "tancat")
)
Arguments
- map
[
erahumed_cluster_map]
A cluster map created withnew_cluster_map()
ordefault_cluster_map()
.- system
[
erahumed_management_system]
A management system to assign, created withnew_management_system()
or helper functions such asbomba()
orclearfield()
.- target_fraction
[numeric(1)]
The fraction of total surface area to allocate to the given system. Must be a number between 0 and 1.- ditches
[integer]
A vector of ditch IDs where candidate clusters will be selected from. Defaults to all ditches (1:26).- field_type
[character(1)]
Type of field to consider when selecting clusters. Must be one of:"regular"
– only regular fields"tancat"
– only tancats"both"
– all field types (default)
Details
This function randomly selects clusters matching the specified ditches
and
field_type
until the cumulative surface area of selected clusters reaches
the target_fraction
. The new management system is added to the internal
list and assigned a unique ID within the map.
If no eligible clusters remain before reaching the target fraction, the function will return early with a partial allocation.
Examples
map <- new_cluster_map(jsendra())
map <- allocate_surface(map, bomba(), target_fraction = 0.1, field_type = "tancat")