pyforestry.sweden.simulation.mortality package#
Submodules#
pyforestry.sweden.simulation.mortality.context module#
Unified mortality context models for Sweden simulation orchestration.
pyforestry.sweden.simulation.mortality.engine module#
Simulation-layer mortality orchestration for Swedish mortality modules.
This module is pyforestry’s own composition layer and carries no publication of
its own: it selects among, and applies, mortality models that each carry their
own provenance. The scientific sources are those of the composed modules –
pyforestry.sweden.mortality.elfving_2013,
pyforestry.sweden.mortality.fridman_stahl_2001,
pyforestry.sweden.mortality.siipilehto_2020,
pyforestry.sweden.mortality.soderberg_1986,
pyforestry.sweden.mortality.bengtsson and
pyforestry.sweden.mortality.naslund_1986 – reachable through
MortalityEngine.components.
- class pyforestry.sweden.simulation.mortality.engine.MortalityEngine(config: MortalityConfig = <factory>, rng: KeyedRNG | None = None)[source]#
Bases:
objectSimulation-layer mortality orchestration for Sweden.
runis a single linear pipeline: resolve the probability source (retained override -> configured tree model), optionally calibrate (Bengtsson then Söderberg), apply adjustment factors, and realize the result (deterministic or stochastic).- property component_id: str#
Stable identifier for this composition.
- property components: tuple[Describable, ...]#
The mortality modules this engine can compose, each with its own citation.
Returns the modules’ descriptors, not their ids.
componentsmeansSequence[Describable]everywhere else in this package, and every consumer readscomponent_idandsourceoff each entry – so returning bare strings did not merely differ in type, it dropped the citations.pyforestry.projection._provenancereported a run through this engine as citing one thing, itself, and none of the seven papers that produced the numbers.
- run(context: MortalityContext) MortalityResult[source]#
Predict and realize mortality for the stand described by
context.
- property source: SourceReference#
Provenance for the engine itself, which is a pyforestry composition.
The engine has no publication of its own. The scientific content belongs to the composed mortality modules; see
components.
- class pyforestry.sweden.simulation.mortality.engine.MortalityModel(*args, **kwargs)[source]#
Bases:
ProtocolStructural interface shared by the interchangeable single-tree strategies.
The three tree-model facades (Fridman & Ståhl 2001, Elfving 2013, Siipilehto et al. 2020) all expose this signature, so the engine treats the configured model as one strategy instead of branching on its concrete type.
- predict_probabilities(*, context: MortalityContext, period_years: float, default_stems_per_tree: float) tuple[list[float], dict[str, Any]][source]#
Return per-tree 5-year mortality probabilities and model diagnostics.
pyforestry.sweden.simulation.mortality.normalize module#
Normalization helpers for unified mortality context.
- pyforestry.sweden.simulation.mortality.normalize.normalize_mortality_context(context: MortalityContext) MortalityContext[source]#
Return normalized context with copied mutable fields and non-null history.
Module contents#
Sweden simulation-layer mortality context and orchestration engine.