R/landweb-species-units.R
landweb_species_units.RdSplits a species out of its merged LandWeb group where it holds at least threshold percent of the
study area's tree cover; the group's other species stay together. Returns everything a study area's
simulation needs to use the result: its species table, colours, and which species layers make up
each simulated unit.
landweb_species_units(
sppEquiv,
layers,
studyArea = NULL,
threshold = 1,
floor = 5,
neverSplit = c("Thuj_pli", "Tsug_het")
)data.table from landweb_species_sppEquiv().
SpatRaster of percent cover, one layer per LandWeb code: the speciesData stage's
speciesLayers for the study area.
SpatVector or sf polygon(s) the shares are measured over, normally the reporting
study area; NULL uses every cell of layers.
numeric; percent of the study area's tree cover a species (or a group's remainder) needs to be simulated on its own.
numeric; Biomass_borealDataPrep's minCoverThreshold.
character; species never simulated on their own (western redcedar and western hemlock, whose traits are unreviewed).
A list:
sppEquiv: the study area's species table, LandWeb holding each row's unit; rows of dropped
species are removed;
sppColorVect: named colours of the units and "Mixed";
sppColorVectReport: named colours of the reporting groups present and "Mixed";
layerMap: named character vector, each layer of layers to its unit (NA: dropped), for
landweb_sum_layers();
units: data.table of each unit's members, dominant member and share (percent), and ranked,
a list column of its members in the order it takes growth-curve traits from (most cover first,
species in neverSplit last; see landweb_unit_growth_traits());
hybridParent: the species hybrid spruce joined.
Shares are measured as Biomass_borealDataPrep will see the layers. A candidate unit's layer is the
sum of its species' layers, rounded; pixels whose total cover is at most floor are left out;
cells of a unit with at most floor cover are dropped; and each pixel is rescaled to 100. A unit's
share is then its mean percent of a pixel's tree cover over studyArea.
The rule, for each merged group (LandWebGroup):
hybrid spruce (Pice_eng_gla) joins whichever parent, white or Engelmann spruce, has more cover
in studyArea, before the floor;
a member with a share of at least threshold is simulated on its own;
the members left form the group's remainder: one unit if its share is at least threshold,
otherwise merged into the group's largest split-out member, and otherwise (none split out)
dropped, its cover going to the other species of each pixel;
species in neverSplit take no part in 2-3: they join the largest unit of their group at the
end, or are dropped if their group has none.
A unit is named by its species' code, or by its group's code when it holds several species. It
takes its labels and colour from that species or group, and the traits of its member with most
cover: the other members' LANDIS_traits codes are blanked (see landweb_dominant_sppEquiv()),
and hybrid rows take their parent's code.
A species unit's growth curve is fitted on that species' permanent sample plot trees only; a group
unit's on all its members'. Biomass_speciesParameters assigns plot trees to units by Latin_full,
so the rows of a species unit's merged minor members (hybrid spruce included), and of species in
neverSplit, have it blanked: their trees still count in plot biomass but do not shape the curve.
On WesternAlbertaUpland, merged Engelmann and hybrid spruce plots from the montane ecozone made white
spruce's pooled curve unidentifiable.