derevo.models package

Submodules

derevo.models.cohabitation module

Genus cohabitation attributes model is defined here.

class derevo.models.cohabitation.CohabitationType(value)[source]

Bases: Enum

Enumeration used to two genera cohabitation.

NEGATIVE = 'NEGATIVE'
NEUTRAL = 'NEUTRAL'
POSITIVE = 'POSITIVE'
to_value() Literal[-1, 0, 1][source]

Get tolerance type as an integer value in range [-1, 1].

class derevo.models.cohabitation.GeneraCohabitation(genus_1: str, genus_2: str, cohabitation: CohabitationType)[source]

Bases: object

Contains cohabitation type of two plant genus

genus_1: str
genus_2: str
cohabitation: CohabitationType

derevo.models.enumerations module

Enumeration models are defined here.

class derevo.models.enumerations.ToleranceType(value)[source]

Bases: Enum

Enumeration used to describe plant resistance to some factor.

NEGATIVE = 'NEGATIVE'
NEUTRAL = 'NEUTRAL'
POSITIVE = 'POSITIVE'
classmethod from_value(value: Literal[-1, 0, 1]) ToleranceType[source]

Construct ToleranceType from integer value.

to_value() Literal[-1, 0, 1][source]

Get tolerance type as an integer value in range [-1, 1].

class derevo.models.enumerations.LightType(value)[source]

Bases: Enum

Enumeration used to describe possible light types.

DARK = 'DARK'
DARKENED = 'DARKENED'
LIGHT = 'LIGHT'
class derevo.models.enumerations.AcidityType(value)[source]

Bases: Enum

Enumeration used to describe soil acidity types.

STRONGLY_ACIDIC = 3
ACIDIC = 5
SLIGHTLY_ACIDIC = 6
NEUTRAL = 7
SLIGHTLY_ALCALINE = 8
ALCALINE = 9
STRONGLY_ALCALINE = 11
classmethod from_value(value: int) AcidityType[source]

Construct AcidityType from pH value.

Values: - <=3 - STRONGLY_ACIDIC - 4..5 - ACIDIC - 6 - SLIGHTLY_ACIDIC - 7 - NEUTRAl - 8 - SLIGHTLY_ALCALINE - 9..10 - ALCALINE - >=11 - STRONGLY_ALCALINE

class derevo.models.enumerations.FertilityType(value)[source]

Bases: Enum

Enumeration used to describe soil fertility types.

BARREN = 'BARREN'
SLIGHTLY_FERTIL = 'SLIGHTLY_FERTIL'
FERTIL = 'FERTIL'
class derevo.models.enumerations.SoilType(value)[source]

Bases: Enum

Enumeration used to describe soil types.

SANDY = 'SANDY'
SUBSANDY = 'SUBSANDY'
LOAMY = 'LOAMY'
CLAYEY = 'CLAYEY'
ROCKY = 'ROCKY'
GRAVELLY = 'GRAVELLY'
HEAVY = 'HEAVY'
DRAINED = 'DRAINED'
class derevo.models.enumerations.HumidityType(value)[source]

Bases: Enum

Enumeration used to describe humidity types.

LOW = 'LOW'
NORMAL = 'NORMAL'
HIGH = 'HIGH'
class derevo.models.enumerations.LimitationFactor(value)[source]

Bases: Enum

Enumeration used to describe limitation factor.

OVERCONSOLIDATION = 'OVERCONSOLIDATION'
SALINIZATION = 'SALINIZATION'
DROUGHT = 'DROUGHT'
FLOODING = 'FLOODING'
GAS_POLLUTION = 'GAS_POLLUTION'
WINDINESS = 'WINDINESS'
class derevo.models.enumerations.UsdaZone(value)[source]

Bases: Enum

Enueration used to describe USDA zones.

USDA1 = 'USDA1'
USDA2 = 'USDA2'
USDA3 = 'USDA3'
USDA4 = 'USDA4'
USDA5 = 'USDA5'
USDA6 = 'USDA6'
USDA7 = 'USDA7'
USDA8 = 'USDA8'
USDA9 = 'USDA9'
USDA10 = 'USDA10'
USDA11 = 'USDA11'
classmethod from_value(value: Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) UsdaZone[source]

Construct UsdaZone from integer value. Valid values are integers in range [1, 11].

class derevo.models.enumerations.AggressivenessLevel(value)[source]

Bases: Enum

Enumeration used to describe plant spread agressiveness.

AGGRESSIVE = 'AGGRESSIVE'
NEUTRAL = 'NEUTRAL'
SUPPRESSED = 'SUPPRESSED'
classmethod from_value(value: Literal[-1, 0, 1]) AggressivenessLevel[source]

Construct AgressivenessLevel from integer value.

Values: - -1 - SUPPRESSED - 0 - NEUTRAL - 1 - AGGRESSIVE

class derevo.models.enumerations.SurvivabilityLevel(value)[source]

Bases: Enum

Enumeration used to describe plant spread agressiveness.

STRONG = 'STRONG'
NORMAL = 'NORMAL'
WEAK = 'WEAK'
classmethod from_value(value: Literal[-1, 0, 1]) SurvivabilityLevel[source]

Construct SurvivabilityLevel from integer value.

Values: - -1 - WEAK - 0 - NORMAL - 1 - STRONG

class derevo.models.enumerations.LifeForm(value)[source]

Bases: Enum

Enumeration used to describe plant life form.

TREE = 'TREE'
BUSH = 'BUSH'
GROUND_COVER = 'GROUND_COVER'
LIANA = 'LIANA'
PERENNIAL = 'PERENNIAL'
BULBOUS = 'BULBOUS'
ANNUAL = 'ANNUAL'
SWAMP_PLANT = 'SWAMP_PLANT'

derevo.models.global_territory module

Global territory model class is defined here.

derevo.models.global_territory._check_names(gdf: gpd.GeoDataFrame, concrete_enum: Type[LightType] | Type[LimitationFactor] | type[HumidityType] | Type[SoilType] | Type[AcidityType] | Type[FertilityType])[source]

Remove rows which name cannot be cast to the given enumeration.

derevo.models.global_territory._names_to_enum(values: Iterable[str | Enum], concrete_enum: type[Enum]) list[Enum][source]

Construct list of given enum types from their string names.

derevo.models.global_territory._names_to_unique_enum(values: Iterable[str | Enum], concrete_enum: type[Enum]) list[Enum][source]

Construct list of given enum types from their string names.

class derevo.models.global_territory.GlobalTerritory(usda_zone: UsdaZone | None = None, limitation_factors: gpd.GeoDataFrame = Ellipsis, light_types: gpd.GeoDataFrame = Ellipsis, humidity_types: gpd.GeoDataFrame = Ellipsis, soil_types: gpd.GeoDataFrame = Ellipsis, soil_acidity_types: gpd.GeoDataFrame = Ellipsis, soil_fertility_types: gpd.GeoDataFrame = Ellipsis)[source]

Bases: object

Global territory model (for a whole city for example) that contains all of its factors data.

Missing or None value in init means that the parameter is unknown and will not be taken in the account.

Fields notes: - limitation_factors GeoDataFrame must contain column ‘name’ with values corresponding to LimitationFactor emueration - light_types GeoDataFrame must contain column ‘name’ with values corresponding to LightType enumeration - humidity_types GeoDataFrame must contain column ‘name’ with values corresponding to HumidityType enumeration - soil_types GeoDataFrame must contain column ‘name’ with values corresponding to SoilType enumeration - soil_acidity_types GeoDataFrame must contain column ‘name’ with values corresponding to AcidityType enumeration - soil_fertility_types GeoDataFrame must contain column ‘name’ with values corresponding to FertilityType enumeration

usda_zone: UsdaZone | None = None
limitation_factors: gpd.GeoDataFrame = Ellipsis
light_types: gpd.GeoDataFrame = Ellipsis
humidity_types: gpd.GeoDataFrame = Ellipsis
soil_types: gpd.GeoDataFrame = Ellipsis
soil_acidity_types: gpd.GeoDataFrame = Ellipsis
soil_fertility_types: gpd.GeoDataFrame = Ellipsis
__post_init__()[source]

Check that each of the DataFrames contains ‘name’ column. Throw ValueError otherwise.

as_territory() Territory[source]

Get global territory information as Territory class.

derevo.models.plants module

Plant model class is defined here.

class derevo.models.plants.Plant(name_ru: str, name_latin: str, genus: str | None = None, life_form: LifeForm | None = None, limitation_factors_resistances: dict[LimitationFactor, ToleranceType] = <factory>, usda_zone_preferences: dict[UsdaZone, ToleranceType] = <factory>, light_preferences: dict[LightType, ToleranceType] = <factory>, humidity_preferences: dict[HumidityType, ToleranceType] = <factory>, soil_acidity_preferences: dict[AcidityType, ToleranceType] = <factory>, soil_fertility_preferences: dict[FertilityType, ToleranceType] = <factory>, soil_type_preferences: dict[SoilType, ToleranceType] = <factory>, aggresiveness: AggressivenessLevel = AggressivenessLevel.NEUTRAL, survivability: SurvivabilityLevel = SurvivabilityLevel.NORMAL, is_invasive: bool = False)[source]

Bases: object

Plant class for the derevo methods.

Fields: - name_ru (str): russian name of the plant. - name_latin (str): latin name of the plant. - genus (str | None, optional): genera name of the plant, required for method but optional. Defaults to None. - limitation_factors_resistances (dict[LimitationFactor, ToleranceType], optional): dictionary with keys as limitation factors and values as a tolerance type for a plant to the given limitation factor. Defaults to {}. - usda_zone_preferences (dict[UsdaZone, ToleranceType], optional): dictionary with keys as USDA zones and values as a tolerance type for a plant to the given USDA zone. Default to {}. - light_preferences (dict[LightType, ToleranceType], optional): dictionary with keys as light types and values as a tolerance type for a plant to the given light type. Default to {}. - humidity_preferences (dict[HumidityType, ToleranceType], optional): dictionary with keys as humidity types and values as a tolerance type for a plant to the given humidity type. Default to {}. - soil_acidity_preferences (dict[AcidityType, ToleranceType], optional): dictionary with keys as soil acidity types and values as a tolerance type for a plant to the given soil acidity type. Default to {}. - soil_fertility_preferences (dict[FertilityType, ToleranceType], optional): dictionary with keys as soil fertility types and values as a tolerance type for a plant to the given soil fertility type. Default to {}. - soil_type_preferences (dict[SoilType, ToleranceType], optional): dictionary with keys as soil types and values as a tolerance type for a plant to the given soil type. Default to {}.

name_ru: str
name_latin: str
genus: str | None = None
life_form: LifeForm | None = None
limitation_factors_resistances: dict[LimitationFactor, ToleranceType]
usda_zone_preferences: dict[UsdaZone, ToleranceType]
light_preferences: dict[LightType, ToleranceType]
humidity_preferences: dict[HumidityType, ToleranceType]
soil_acidity_preferences: dict[AcidityType, ToleranceType]
soil_fertility_preferences: dict[FertilityType, ToleranceType]
soil_type_preferences: dict[SoilType, ToleranceType]
aggresiveness: AggressivenessLevel = 'NEUTRAL'
survivability: SurvivabilityLevel = 'NORMAL'
is_invasive: bool = False
class derevo.models.plants.Compatability(genus_name_1: str, genus_name_2: str, cohabitation_type: ToleranceType)[source]

Bases: object

Compatibility class for cohabitation attributes

Fields: - genus_name_1 (str): genera name of the plant, required for method - genus_name_2 (str): genera name of the corresponding plant, required for method - cohabitation_type (ToleranceType): type of cohabitation

genus_name_1: str
genus_name_2: str
cohabitation_type: ToleranceType

derevo.models.territory module

Territory model class is defined here.

class derevo.models.territory.Territory(usda_zone: UsdaZone | None = None, limitation_factors: list[LimitationFactor] | None = None, light_types: list[LightType] | None = None, humidity_types: list[HumidityType] | None = None, soil_types: list[SoilType] | None = None, soil_acidity_types: list[AcidityType] | None = None, soil_fertility_types: list[FertilityType] | None = None)[source]

Bases: object

Description of the territory for composition creation.

None value means that the parameter is unknown and will not be taken in the account.

usda_zone: UsdaZone | None = None
limitation_factors: list[LimitationFactor] | None = None
light_types: list[LightType] | None = None
humidity_types: list[HumidityType] | None = None
soil_types: list[SoilType] | None = None
soil_acidity_types: list[AcidityType] | None = None
soil_fertility_types: list[FertilityType] | None = None
update(other: Territory, replace: bool = False) None[source]

Add other territory attributes to the currently set attributes. If replace is set to True, then replace current territory values whre other attributes are not None.

Module contents

Model classes are defined here.