API for the animal_traits module#

The models.animal.animal_traits module contains classes that organizes animal traits into enumerations for use by the Functional Group class in the functional_group module.

Classes:

DevelopmentStatus(*values)

Enumeration for development status.

DevelopmentType(*values)

Enumeration for development types.

DietType(*values)

Enumeration for diet resource types.

ExcretionType(*values)

Enumeration for excretion type.

MetabolicType(*values)

Enumeration for metabolic types.

MigrationType(*values)

Enumeration for external migration trait.

ReproductiveEnvironment(*values)

Where and how reproduction happens: aquatic vs terrestrial.

ReproductiveType(*values)

Enumeration for reproductive types.

TaxaType(*values)

Enumeration for taxa types.

VerticalOccupancy(*values)

Enumeration for vertical occupancy trait.

class virtual_ecosystem.models.animal.animal_traits.DevelopmentStatus(*values)[source]#

Enumeration for development status.

class virtual_ecosystem.models.animal.animal_traits.DevelopmentType(*values)[source]#

Enumeration for development types.

class virtual_ecosystem.models.animal.animal_traits.DietType(*values)[source]#

Enumeration for diet resource types.

TODO: refine categorizations

Methods:

coarse_category()

Classify the detailed diet into a broad trophic category.

count_dietary_categories()

Count the number of distinct dietary categories in this flag set.

parse(diet_string)

Parse a string of underscore-separated diet terms into a DietType flag.

coarse_category() DietType[source]#

Classify the detailed diet into a broad trophic category.

This method examines the components of the current DietType flag and returns one of the three broad trophic categories: HERBIVORE, CARNIVORE, or OMNIVORE. These categories are defined as composite flags within the DietType enumeration.

  • Returns OMNIVORE if the diet includes both plant/fungal and animal-derived

    resources.

  • Returns CARNIVORE if the diet includes only animal-derived resources.

  • Returns HERBIVORE for all other combinations, including plant-only or empty

    diets.

Returns:

A diet type flag representing the coarse category.

Return type:

DietType

count_dietary_categories() int[source]#

Count the number of distinct dietary categories in this flag set.

Returns:

An integer of the number of different type types possessed by the functional group.

classmethod parse(diet_string: str) DietType[source]#

Parse a string of underscore-separated diet terms into a DietType flag.

This method takes a lowercase string such as ‘fruit_foliage_fish’ and converts it into a combined DietType flag using bitwise OR logic. This allows diet traits to be specified flexibly in configuration files or CSV inputs.

Parameters:

diet_string – A lowercase underscore-separated string representing one or more diet components (e.g., ‘foliage’, ‘fruit_fish’, ‘nectar_fungus’).

Returns:

A DietType flag representing the combined diet traits.

class virtual_ecosystem.models.animal.animal_traits.ExcretionType(*values)[source]#

Enumeration for excretion type.

class virtual_ecosystem.models.animal.animal_traits.MetabolicType(*values)[source]#

Enumeration for metabolic types.

class virtual_ecosystem.models.animal.animal_traits.MigrationType(*values)[source]#

Enumeration for external migration trait.

class virtual_ecosystem.models.animal.animal_traits.ReproductiveEnvironment(*values)[source]#

Where and how reproduction happens: aquatic vs terrestrial.

class virtual_ecosystem.models.animal.animal_traits.ReproductiveType(*values)[source]#

Enumeration for reproductive types.

class virtual_ecosystem.models.animal.animal_traits.TaxaType(*values)[source]#

Enumeration for taxa types.

class virtual_ecosystem.models.animal.animal_traits.VerticalOccupancy(*values)[source]#

Enumeration for vertical occupancy trait.

Methods:

parse(occupancy)

Convert a string like 'soil_ground' into a VerticalOccupancy flag.

classmethod parse(occupancy: str) VerticalOccupancy[source]#

Convert a string like ‘soil_ground’ into a VerticalOccupancy flag.

This method parses a lowercase underscore-separated string into a combined VerticalOccupancy flag using bitwise OR logic. It enables easy construction of multi-layer occupancy traits from a single string field, such as those found in CSV imports or config files.

Parameters:

occupancy – A string representing one or more vertical layers, such as ‘soil’, ‘ground_canopy’, or ‘soil_ground_canopy’.

Returns:

A VerticalOccupancy flag representing the combined vertical occupancy.