pyforestry.sweden.site package#

Submodules#

pyforestry.sweden.site.enums module#

The Swedish site classifications, as enums.

Every site factor the Swedish site-index and growth functions in this package take as a category – field layer, bottom layer, soil moisture, texture, depth, lateral water, peat humification, county and climate zone – is one enum here, each member wrapping a primitive from sweden_site_primitives that carries the numeric code the functions index by along with Swedish and English names.

Sweden bundles them so a caller imports one name.

class pyforestry.sweden.site.enums.Sweden[source]#

Bases: object

Namespace bundling every Swedish site classification under one name.

Sweden.FieldLayer, Sweden.SoilMoistureEnum, Sweden.County and the rest are aliases for the enums defined above, so a caller imports one symbol and reaches all of them. It holds no state and is never instantiated.

BottomLayer#

alias of SwedenBottomLayer

ClimateZone#

alias of SwedenClimateZone

County#

alias of SwedenCounty

FieldLayer#

alias of SwedenFieldLayer

PeatHumification#

alias of SwedenPeatHumification

SoilDepth#

alias of SwedenSoilDepth

SoilMoistureEnum#

alias of SwedenSoilMoisture

SoilTextureSediment#

alias of SwedenSoilTextureSediment

SoilTextureTill#

alias of SwedenSoilTextureTill

SoilWater#

alias of SwedenSoilWater

class pyforestry.sweden.site.enums.SwedenBottomLayer(*values)[source]#

Bases: Enum

Bottom-layer (moss and lichen) type of the site.

Read alongside the field layer by the site-index estimators; the lichen and bogmoss types in particular separate dry and wet poor sites that share a field layer.

BOGMOSS_TYPE = BottomLayerType(code=4, english_name='Bogmoss type (Sphagnum)', swedish_name='Vitmosstyp')#
FRESH_MOSS = BottomLayerType(code=6, english_name='Fresh moss type', swedish_name='Friskmosstyp')#
LICHEN_RICH = BottomLayerType(code=3, english_name='Lichen-rich', swedish_name='Lavrik typ')#
LICHEN_RICH_BOGMOSS = BottomLayerType(code=2, english_name='Lichen-rich bogmoss type', swedish_name='Lavrik vitmosstyp')#
LICHEN_TYPE = BottomLayerType(code=1, english_name='Lichen type', swedish_name='Lavtyp')#
SWAMP_MOSS = BottomLayerType(code=5, english_name='Swamp moss type', swedish_name='Sumpmosstyp')#
class pyforestry.sweden.site.enums.SwedenClimateZone(*values)[source]#

Bases: Enum

Maritime or continental climate region (M1-M3, K1-K3).

A coarse regional climate split used as a categorical term by several Swedish functions. from_code() looks a member up by its integer code.

K1 = ClimateZoneData(code=4, label='K1', description='Continental, Middle Sweden')#
K2 = ClimateZoneData(code=5, label='K2', description='Continental, Northern Sweden')#
K3 = ClimateZoneData(code=6, label='K3', description='Continental, Southern Sweden')#
M1 = ClimateZoneData(code=1, label='M1', description='Maritime, West coast')#
M2 = ClimateZoneData(code=2, label='M2', description='Maritime, East coast')#
M3 = ClimateZoneData(code=3, label='M3', description='Maritime, Mountain range')#
classmethod from_code(code: int) → SwedenClimateZone | None[source]#

Lookup enum member by code.

class pyforestry.sweden.site.enums.SwedenCounty(*values)[source]#

Bases: Enum

Administrative region, in the subdivision Swedish forestry functions use.

Not simply the 21 counties: the large northern counties are split into their historical landscapes (Norrbotten into lappmark and kustland, Jämtland into Jämtland and Härjedalen), because the growth and volume functions were fitted with those divisions as regional terms. The codes are the ones Söderberg (1986) and the site-index estimators index by.

ALVSBORG_DALSLANDS = CountyData(code=21, label='Älvsborg, Dalslands landskap (P)')#
ALVSBORG_VASTERGOTLANDS = CountyData(code=22, label='Älvsborg, Västergötlands landskap (P)')#
BLEKINGE = CountyData(code=30, label='Blekinge (K)')#
GAVLEBORG_HALSINGLANDS = CountyData(code=9, label='Gävleborg - Hälsinglands landskap (X Hälsingl)')#
GAVLEBORG_OVRIGA = CountyData(code=10, label='Gävleborg, övriga (X övr)')#
GOTLAND = CountyData(code=31, label='Gotland (I)')#
HALLAND = CountyData(code=27, label='Halland (N)')#
JAMTLAND_HARJEDALENS = CountyData(code=6, label='Jämtland - Härjedalens landskap (Z Härjed)')#
JAMTLAND_JAMTLANDS = CountyData(code=5, label='Jämtland - Jämtlands landskap (Z)')#
JONKOPING = CountyData(code=23, label='Jönköping (F)')#
KALMAR = CountyData(code=25, label='Kalmar (H)')#
KOPPARBERG_OVRIGA = CountyData(code=12, label='Kopparberg (Dalarna), övriga (W övr)')#
KOPPARBERG_SALEN_IDRE = CountyData(code=11, label='Kopparberg (Dalarna), Sälen - Idre (W)')#
KRISTIANSTAD = CountyData(code=28, label='Kristianstad (L)')#
KRONOBERG = CountyData(code=24, label='Kronoberg (G)')#
MALMOHUS = CountyData(code=29, label='Malmöhus (M)')#
NORRBOTTENS_KUSTLAND = CountyData(code=2, label='Norrbottens kustland (BD kust)')#
NORRBOTTENS_LAPPMARK = CountyData(code=1, label='Norrbottens lappmark (BD lappm)')#
OREBRO = CountyData(code=14, label='Örebro (T)')#
OSTERGOTLAND = CountyData(code=19, label='Östergötland (E)')#
SKARABORG = CountyData(code=20, label='Skaraborg (R)')#
SODERMANLAND = CountyData(code=18, label='Södermanland (D)')#
STOCKHOLM = CountyData(code=17, label='Stockholm (AB)')#
UPPSALA = CountyData(code=16, label='Uppsala (C)')#
VARMLAND = CountyData(code=13, label='Värmland (S)')#
VASTERBOTTENS_KUSTLAND = CountyData(code=4, label='Västerbottens kustland (AC kust)')#
VASTERBOTTENS_LAPPMARK = CountyData(code=3, label='Västerbottens lappmark (AC lappm)')#
VASTERNORRLAND_ANGERMANLANDS = CountyData(code=7, label='Västernorrland - Ångermanlands landskap (Y Ångerm)')#
VASTERNORRLAND_MEDELPADS = CountyData(code=8, label='Västernorrland - Medelpads landskap (Y Medelp)')#
VASTMANLAND = CountyData(code=15, label='Västmanland (U)')#
VASTRA_GOTALANDS = CountyData(code=26, label='Västra Götalands (Göteborg - Bohuslän) (O)')#
classmethod from_code(code: int) → SwedenCounty | None[source]#

Lookup enum member by code.

class pyforestry.sweden.site.enums.SwedenFieldLayer(*values)[source]#

Bases: Enum

Ground vegetation class, and the site-index correction it carries.

The eighteen Swedish field-layer types, ordered from rich herb communities down to lichen. Each member’s Vegetation value holds the code, the Swedish and English names, and a numeric index used as a vegetation effect by the site-index estimators in pyforestry.sweden.siteindex.sis.

BILBERRY = Vegetation(code=13, swedish_name='Blåbär', english_name='European blueberry, bilberry', index=0)#
BROADLEAVED_GRASS = Vegetation(code=8, swedish_name='Bredbl. gräs', english_name='Broadleaved grass', index=2.5)#
CROWBERRY = Vegetation(code=15, swedish_name='Kråkbär', english_name='Crowberry', index=-3)#
HIGH_HERB_WITHOUT_SHRUBS = Vegetation(code=1, swedish_name='Högört utan ris', english_name='Rich-herb without shrubs', index=4)#
HIGH_HERB_WITH_SHRUBS_BLUEBERRY = Vegetation(code=2, swedish_name='Högört med ris/blåbär', english_name='Rich-herb with shrubs/bilberry', index=2.5)#
HIGH_HERB_WITH_SHRUBS_LINGON = Vegetation(code=3, swedish_name='Högört med ris/lingon', english_name='Rich-herb with shrubs/lingonberry', index=2)#
HORSETAIL = Vegetation(code=12, swedish_name='Fräken', english_name='Horsetail, Equisetum ssp.', index=1)#
LICHEN_DOMINANT = Vegetation(code=18, swedish_name='Lav', english_name='Lichen, dominating', index=-1)#
LICHEN_FREQUENT = Vegetation(code=17, swedish_name='Lavrik', english_name='Lichen, frequent occurrence', index=-0.5)#
LINGONBERRY = Vegetation(code=14, swedish_name='Lingon', english_name='Lingonberry', index=-0.5)#
LOW_HERB_WITHOUT_SHRUBS = Vegetation(code=4, swedish_name='Lågört utan ris', english_name='Low-herb without shrubs', index=3)#
LOW_HERB_WITH_SHRUBS_BLUEBERRY = Vegetation(code=5, swedish_name='Lågört med ris/blåbär', english_name='Low-herb with shrubs/bilberry', index=2.5)#
LOW_HERB_WITH_SHRUBS_LINGON = Vegetation(code=6, swedish_name='Lågört med ris/lingon', english_name='Low-herb with shrubs/lingonberry', index=2)#
NO_FIELD_LAYER = Vegetation(code=7, swedish_name='Utan fältskikt', english_name='No field layer', index=3)#
POOR_SHRUB = Vegetation(code=16, swedish_name='Fattigris', english_name='Poor shrub', index=-5)#
SEDGE_HIGH = Vegetation(code=10, swedish_name='Carex ssp.,Hög starr', english_name='Sedge, high', index=-3)#
SEDGE_LOW = Vegetation(code=11, swedish_name='Carex ssp.,Låg starr', english_name='Sedge, low', index=-3)#
THINLEAVED_GRASS = Vegetation(code=9, swedish_name='Smalbl. gräs', english_name='Thinleaved grass', index=1.5)#
class pyforestry.sweden.site.enums.SwedenPeatHumification(*values)[source]#

Bases: Enum

How far peat at the site has decomposed, on a four-step field scale.

Only meaningful where the texture is peat; higher humification means a denser, more decomposed peat and a different nutrient supply.

HIGH = PeatHumificationCat(code=3, swedish_description='hög', english_description='High')#
LOW = PeatHumificationCat(code=1, swedish_description='låg', english_description='Low')#
MEDIUM = PeatHumificationCat(code=2, swedish_description='medium', english_description='Medium')#
NONE = PeatHumificationCat(code=0, swedish_description='ingen', english_description='None')#
class pyforestry.sweden.site.enums.SwedenSoilDepth(*values)[source]#

Bases: Enum

Depth of the soil above bedrock, in five field classes.

Shallow soils and outcrops restrict rooting volume and available water, and the site-index functions treat them as a productivity penalty.

DEEP = SoilDepthCat(code=1, swedish_description='Mäktigt >70 cm. Inga synliga hällar', english_description='Deep >70cm. No visible stone outcrops.')#
OUTCROP = SoilDepthCat(code=5, swedish_description='Häll, inget egentligt jordtäcke', english_description='Outcrop. No discernible topsoil')#
RATHER_SHALLOW = SoilDepthCat(code=2, swedish_description='Tämligen grunt jorddjupt 20-70 cm', english_description='Rather shallow soil depth, 20-70 cm')#
SHALLOW = SoilDepthCat(code=3, swedish_description='Grunt jorddjup < 20 cm. Rikligt med hällar.', english_description='Rather shallow soil depth < 20 cm. Plenty of stony outcrops.')#
VARYING = SoilDepthCat(code=4, swedish_description='Mycket varierande jorddjup. Brottytor i berggrunden delvis synliga.', english_description='Widely varying soil depth. Breaks in bedrock partly visible.')#
class pyforestry.sweden.site.enums.SwedenSoilMoisture(*values)[source]#

Bases: Enum

Site moisture class, defined by depth to the subsoil water table.

Dry through wet, as judged in the field from water-table depth and standing water in hollows. An input to nearly every Swedish site-index and growth function in this package.

DRY = SoilMoistureData(code=1, swedish_description='torr', english_description='Dry (subsoil water depth >2 m)')#
MESIC = SoilMoistureData(code=2, swedish_description='frisk', english_description='Mesic (subsoil water depth = 1-2 m)')#
MESIC_MOIST = SoilMoistureData(code=3, swedish_description='frisk-fuktig', english_description='Mesic-moist (subsoil water depth <1 m)')#
MOIST = SoilMoistureData(code=4, swedish_description='fuktig', english_description='Moist (subsoil water depth <1 m, and pools visible in hollows)')#
WET = SoilMoistureData(code=5, swedish_description='blöt', english_description='Wet (subsoil water pools visible)')#
class pyforestry.sweden.site.enums.SwedenSoilTextureSediment(*values)[source]#

Bases: Enum

Grain-size class of a sorted sediment soil.

The sediment counterpart of SwedenSoilTextureTill, sharing its nine codes and its coarse-to-fine ordering from boulders through clay to peat.

BOULDER = SoilTextureCategory(code=1, swedish_name='Sten/block', english_name='Boulders/stones', short_name='Boulder')#
CLAY = SoilTextureCategory(code=8, swedish_name='Lera', english_name='Clay', short_name='Clay')#
COARSE_SAND = SoilTextureCategory(code=3, swedish_name='Grovsand', english_name='Coarse sand', short_name='Coarse sand')#
COARSE_SILT = SoilTextureCategory(code=6, swedish_name='Finmo', english_name='Coarse silt', short_name='Coarse silt')#
FINE_SAND = SoilTextureCategory(code=5, swedish_name='Grovmo', english_name='Fine sand', short_name='Fine sand')#
FINE_SILT = SoilTextureCategory(code=7, swedish_name='Mjäla', english_name='Fine silt', short_name='Fine silt')#
GRAVEL = SoilTextureCategory(code=2, swedish_name='Grus', english_name='Gravel', short_name='Gravel')#
MEDIUM_SAND = SoilTextureCategory(code=4, swedish_name='Mellansand', english_name='Medium sand', short_name='Medium sand')#
PEAT = SoilTextureCategory(code=9, swedish_name='Torv', english_name='Peat', short_name='Peat')#
class pyforestry.sweden.site.enums.SwedenSoilTextureTill(*values)[source]#

Bases: Enum

Grain-size class of a till (moraine) soil.

Till is the unsorted glacial deposit covering most of Sweden. The parallel SwedenSoilTextureSediment covers sorted sediments; both share the same nine codes so a caller can read one texture code without first knowing which parent material it came from.

BOULDER = SoilTextureCategory(code=1, swedish_name='Stenig/blockig morän', english_name='Boulder rich/stony till', short_name='Boulder')#
CLAY = SoilTextureCategory(code=8, swedish_name='Lerig morän', english_name='Clayey till', short_name='Clay')#
COARSE_SILTY = SoilTextureCategory(code=6, swedish_name='Moig morän', english_name='Coarse silty till', short_name='Coarse silt')#
FINE_SILTY = SoilTextureCategory(code=7, swedish_name='Mjälig morän', english_name='Fine silty till', short_name='Fine silt')#
GRAVEL = SoilTextureCategory(code=2, swedish_name='Grusig morän', english_name='Gravelly till', short_name='Gravel')#
PEAT = SoilTextureCategory(code=9, swedish_name='Torv', english_name='Peat', short_name='Peat')#
SANDY = SoilTextureCategory(code=3, swedish_name='Sandig morän', english_name='Sandy till', short_name='Coarse sand')#
SANDY_MOIG = SoilTextureCategory(code=4, swedish_name='Sandig-moig morän', english_name='Sandy-silty till', short_name='Medium sand')#
SILTY_SAND = SoilTextureCategory(code=5, swedish_name='Finmoig morän', english_name='Silty-sandy till', short_name='Fine sand')#
class pyforestry.sweden.site.enums.SwedenSoilWater(*values)[source]#

Bases: Enum

Whether, and for how long, seepage water moves through the soil.

MISSING/SHORTER_PERIODS/LONGER_PERIODS is the lateral water movement class: moving water carries nutrients, so a site with longer periods of seepage is more productive than its texture alone implies.

LONGER_PERIODS = SoilWaterCat(code=3, swedish_description='längre perioder', english_description='Longer periods')#
SELDOM_NEVER = SoilWaterCat(code=1, swedish_description='saknas', english_description='Seldom/never')#
SHORTER_PERIODS = SoilWaterCat(code=2, swedish_description='kortare perioder', english_description='Shorter periods')#
pyforestry.sweden.site.enums.county_flags_syz_t_area(county: SwedenCounty | None) → tuple[int, int, int][source]#

Return (gotland, syz_area, t_area) flags for Appendix 1 regeneration functions.

SYZ-area corresponds to old county codes S, Y, Z (X is excluded). We map those to the modern enum members below.

pyforestry.sweden.site.sweden_site_primitives module#

Dataclasses defining Swedish site classification codes.

class pyforestry.sweden.site.sweden_site_primitives.BottomLayerType(code: int, english_name: str, swedish_name: str)[source]#

Bases: object

Main ground vegetation category.

class pyforestry.sweden.site.sweden_site_primitives.ClimateZoneData(code: int, label: str, description: str)[source]#

Bases: object

Zonal climate classification.

class pyforestry.sweden.site.sweden_site_primitives.CountyData(code: int, label: str)[source]#

Bases: object

Swedish county identifier.

class pyforestry.sweden.site.sweden_site_primitives.PeatHumificationCat(code: int, swedish_description: str, english_description: str)[source]#

Bases: object

Degree of humification for peat soils.

class pyforestry.sweden.site.sweden_site_primitives.SoilDepthCat(code: int, swedish_description: str, english_description: str)[source]#

Bases: object

Categorical depth to parent material.

class pyforestry.sweden.site.sweden_site_primitives.SoilMoistureData(code: int, swedish_description: str, english_description: str)[source]#

Bases: object

Relative soil moisture description.

class pyforestry.sweden.site.sweden_site_primitives.SoilTextureCategory(code: int, swedish_name: str, english_name: str, short_name: str)[source]#

Bases: object

Soil texture group such as clay or sand.

class pyforestry.sweden.site.sweden_site_primitives.SoilWaterCat(code: int, swedish_description: str, english_description: str)[source]#

Bases: object

Qualitative class describing soil water availability.

class pyforestry.sweden.site.sweden_site_primitives.Vegetation(code: int, swedish_name: str, english_name: str, index: float)[source]#

Bases: object

Vegetation type with a productivity index.

pyforestry.sweden.site.swedish_site module#

Swedish Site utilities and interfaces.

Source: Swedish forestry domain models and helper implementations curated in pyforestry.

class pyforestry.sweden.site.swedish_site.SwedishSite(latitude: float, longitude: float, altitude: float | None = None, field_layer: SwedenFieldLayer | None = None, bottom_layer: SwedenBottomLayer | None = None, soil_texture: SwedenSoilTextureTill | SwedenSoilTextureSediment | None = None, soil_moisture: SwedenSoilMoisture | None = None, soil_depth: SwedenSoilDepth | None = None, soil_water: SwedenSoilWater | None = None, aspect: float | None = None, incline_percent: float | None = None, ditched: bool | None = None)[source]#

Bases: SiteBase

A robust SwedishSite class that carries at least latitude and longitude. Other attributes (altitude, field layer, etc.) are optional. If not provided (or if computation fails), the computed attributes will be left as None.

altitude: float | None = None#
aspect: float | None = None#
bottom_layer: SwedenBottomLayer | None = None#
climate_zone: SwedenClimateZone | None = None#
county: SwedenCounty | None = None#
distance_to_coast: float | None = None#
ditched: bool | None = None#
field_layer: SwedenFieldLayer | None = None#
humidity: float | None = None#
incline_percent: float | None = None#
n_of_limes_norrlandicus: bool | None = None#
sis_birch_50: float | None = None#
sis_pine_100: float | None = None#
sis_spruce_100: float | None = None#
soil_depth: SwedenSoilDepth | None = None#
soil_moisture: SwedenSoilMoisture | None = None#
soil_texture: SwedenSoilTextureTill | SwedenSoilTextureSediment | None = None#
soil_water: SwedenSoilWater | None = None#
temperature_sum_odin1983: float | None = None#

Module contents#

Init utilities and interfaces.

Source: Swedish forestry domain models and helper implementations curated in pyforestry.