Munin.PriceList package

Submodules

Munin.PriceList.PriceList module

class Munin.PriceList.PriceList.DiameterRange(Min: float, Max: float)[source]

Bases: object

Max: float
Min: float
class Munin.PriceList.PriceList.LengthCorrections(corrections: Dict[int, Dict[int, int]] | None = None)[source]

Bases: object

Holds logic for how the length modifies price (absolute or percent). Now accepts a dictionary of corrections in the form:

{ diameter: { length: correction_percentage, … }, … }

get_length_correction(diameter: int, log_part: int | None, length: int) int[source]

Returns the correction percentage for a given diameter and log length. Looks up the corrections dictionary for the closest available length (floored). Returns 0 if no correction applies.

class Munin.PriceList.PriceList.LengthRange(Min: float, Max: float)[source]

Bases: object

Max: float
Min: float
class Munin.PriceList.PriceList.Pricelist[source]

Bases: object

Holds the combined pulpwood, timber, etc. prices and constraints.

load_from_dict(price_data: dict)[source]

Loads and configures the entire pricelist from a dictionary.

class Munin.PriceList.PriceList.PulpPricelist[source]

Bases: object

Placeholder for pulp prices per species.

getPulpwoodPrice(species: str | TreeName) int[source]

Try to find the price for a species by first looking for a full name match. If none is found, look for a match on just the genus. Returns a default price if no match is found.

class Munin.PriceList.PriceList.TimberPriceForDiameter(butt_price: float, middle_price: float, top_price: float)[source]

Bases: object

Represents the set of prices for a given diameter, for each log part type. E.g. an entry might store: PriceButt, PriceMiddle, PriceTop, …

price_for_log_part(part_type: int) float[source]

Return the price (in e.g. SEK/m3) for the given part type index.

class Munin.PriceList.PriceList.TimberPricelist(min_diameter: int, max_diameter: int, volume_type: str = 'm3to')[source]

Bases: object

Stores the entire set of timber prices by diameter class, etc.

class LogParts(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Butt = 0
Middle = 1
Top = 2
getTimberWeight(log_part: LogParts)[source]

If you’re applying downgrading or certain proportions for pulp/fuel/cull, return an object that has .PulpwoodPercentage, .FuelWoodPercentage, .LogCullPercentage, etc. This is a placeholder.

get_nearest_diameter_class(diameter_cm: float) int[source]

Returns the closest available diameter class (floored down to available class). If the requested diameter is smaller than min, returns min. If larger than max, returns max.

property maxDiameter
property minDiameter
price_for_log_part(log_part: LogParts, diameter_cm: float) float[source]

Get the price for a given log part (Butt, Middle, Top) at a given diameter (cm). Rounds or floors the diameter to the nearest available diameter class.

set_price_for_diameter(diameter: int, price_struct: TimberPriceForDiameter)[source]

Store a price entry for a certain diameter class.

Munin.PriceList.PriceList.create_pricelist_from_data(price_data: dict, species_to_load: str | Sequence[str] | None = None) Pricelist[source]

Build a Pricelist from a dictionary.

Parameters:
  • price_data (dict) – The complete price dictionary (must contain the ‘Common’ block).

  • species_to_load (str | Sequence[str] | None, default None) –

    • None - load all species that have timber price tables.

    • str - load just that species.

    • iterable - load every species in the iterable; it is not an error if some of them have only pulp prices.

Returns:

A fully populated Pricelist instance.

Return type:

Pricelist

Munin.PriceList.PriceMatrix module

Munin.PriceList.SolutionCube module

class Munin.PriceList.SolutionCube.SolutionCube(dataset: Dataset)[source]

Bases: object

classmethod generate(pricelist_data: Dict[str, Any], taper_model: Type[Taper], species_list: list[str], dbh_range: Tuple[float, float], height_range: Tuple[float, float], dbh_step: int = 2, height_step: float = 0.2, workers: int = -1)[source]

Generates the solution cube by running the optimizer in parallel.

classmethod load(path: str, pricelist_to_verify: Dict | None = None)[source]

Loads a solution cube from a netCDF file.

lookup(species: str, dbh: float, height: float) Tuple[float, list][source]

Performs a fast lookup for a given tree’s properties. Uses nearest-neighbor interpolation.

save(path: str)[source]

Saves the dataset to a netCDF file.

Module contents