dycove.sim.vegetation.VegetationSpecies

class dycove.sim.vegetation.VegetationSpecies(input_veg_filename, species_name=None, mor=0, rand_seed_frac=1.0, rand_seed_method='random')[source]

A single vegetation species. Can (and will) handle multiple cohorts of the species.

Parameters:
  • input_veg_filename (str or Path) – Path to JSON file containing vegetation attributes.

  • mor (int) – 1 if we want to consider morphology (burial/scour) for this vegetation unit, else 0

  • rand_seed_frac (float) – Fraction of potentially colonized cells that will actually colonize, distributed randomly.

  • rand_seed_method (str) – Options are ‘random’ or ‘deterministic’. If rand_seed_frac is between 0 and 1, ‘deterministic’ will use a seed to evaluate the SAME set of cells for each colonization, whereas ‘random’ will be truly random each time.

__init__(input_veg_filename, species_name=None, mor=0, rand_seed_frac=1.0, rand_seed_method='random')[source]

Methods

__init__(input_veg_filename[, species_name, ...])

apply_mortality()

Multiply potential mortality by vegetation fractions to determine actual mortality.

colonization(ets, min_depths, max_depths, fl_dr)

Colonize a VegCohort by adding a new fraction to cells.

compute_new_fraction(existing_cohorts, ...)

Compute a new cohort’s fractional cover based on available space.

compute_veg_model_quantities()

Function to compute weighted area averages of model vegetation variables.

create_seed_fraction_mask(array_len)

Create a mask based on random seeding

find_potential_inds(dry_cell_arr, fld_cell_arr)

get_drag()

linear_mortality_func(stressor, th_min, th_max)

Generic, hydrodynamic stressor mortality function (linear).

load_vegetation_attributes(filename)

Parse vegetation input json file and store attributes in a dataclass.

mortality(hydro_vars, morpho_vars)

Delegate to internal methods.

mortality_hydrodynamic(fld_frac, dry_frac, ...)

Compute linear mortality functions for each hydrodynamic stressor (if activated).

mortality_morphodynamic(bl_diff[, ...])

Compute linear mortality functions for each morphodynamic stressor (if activated).

remove_old_cohorts(list_of_inds)

root_growth(ets)

Computes root length based on growth functions in VegAttributes.

stemdiam_growth(ets)

Computes stem diameter based on growth functions in VegAttributes.

stemheight_growth(ets)

Computes stem height based on growth functions in VegAttributes.

update_lifestage_and_stemdensity()

Function to be called at the end of every eco year.

apply_mortality()[source]

Multiply potential mortality by vegetation fractions to determine actual mortality.

Populate mortality-related fields of each active VegCohort object.

colonization(ets, min_depths, max_depths, fl_dr, combined_cohorts=None)[source]

Colonize a VegCohort by adding a new fraction to cells.

This method only adds new fractions. Effective stem diameters and heights are computed elsewhere.

Parameters:
  • ets (int) – Current ecological timestep within current ecological year.

  • min_depths (numpy.ndarray) – Array of minimum water depths [m] at each cell over the previous period.

  • max_depths (numpy.ndarray) – Array of maximum water depths [m] at each cell over the previous period.

  • fl_dr (float) – Wet/dry threshold [m]; passed from constants.py).

  • combined_cohorts (list of VegetationSpecies or None, optional) – Relevant only if multiple species are present. Provides information about other species occupying space in cells. See colonization method of MultipleVegetationSpecies for the use-case.

compute_new_fraction(existing_cohorts: list, inds2colonize: ndarray)[source]

Compute a new cohort’s fractional cover based on available space.

compute_veg_model_quantities()

Function to compute weighted area averages of model vegetation variables.

Handles the various fractions that are tracked within each grid cell.

This function works the same no matter the number of species, and so it is shared by both classes.

create_seed_fraction_mask(array_len: int)[source]

Create a mask based on random seeding

static linear_mortality_func(stressor, th_min, th_max)[source]

Generic, hydrodynamic stressor mortality function (linear).

Parameters:
  • stressor (numpy.ndarray) – Array of relevant stressor magnitude for each cell. For flooding/dessication, it is an array of fraction of time where cells are wet/dry. For uprooting, it is an array of maximum velocities.

  • th_min (float) – Stressor value below which there is no mortality. Comes from JSON input file.

  • th_max (float) – Stressor value above which there is total mortality. Comes from JSON input file.

static load_vegetation_attributes(filename: Path) VegetationAttributes[source]

Parse vegetation input json file and store attributes in a dataclass.

mortality(hydro_vars, morpho_vars)[source]

Delegate to internal methods.

mortality_hydrodynamic(fld_frac, dry_frac, vel_max)[source]

Compute linear mortality functions for each hydrodynamic stressor (if activated).

Hydrodynamic mortality is computed independently from vegetation characteristics like stem height, root length, etc. Mortality parameters can be dependent on life stage though, so we compute mortality for each life stage and apply to the fractions later (self.apply_mortality).

Parameters:
  • fld_frac (numpy.ndarray) – Array containing fractions of time that each cell was flooded during the previous period.

  • dry_frac (numpy.ndarray) – Array containing fractions of time that each cell was dry during the previous period.

  • vel_max (numpy.ndarray) – Array of maximum water velocities [m/s] at each cell over the previous period.

mortality_morphodynamic(bl_diff, burial_frac=1.0, scour_frac=0.1)[source]

Compute linear mortality functions for each morphodynamic stressor (if activated).

Morphodynamic stressors (burial, scour) are not currently functions of life stage, and they are binary (e.g., stem is either buried or not).

Creates arrays of zeros if using a non-morphology model or with morphology turned off.

Parameters:
  • bl_diff (numpy.ndarray) – Array of cell-wise differences in bed level [m], from beginning to end of the previous period, where positive values signify burial.

  • burial_frac (float) – Fraction of stem height above which vegetation is considered buried.

  • scour_frac (float) – Fraction of root length above which vegetation is considered scoured.

Notes

  • If morphology is turned on (mor=1), but morphology is not active in the model (e.g., ANUGA) bl_diff will be passed as zero-difference arrays, and scour/burial will be set to zero.

root_growth(ets)[source]

Computes root length based on growth functions in VegAttributes.

stemdiam_growth(ets)[source]

Computes stem diameter based on growth functions in VegAttributes.

stemheight_growth(ets)[source]

Computes stem height based on growth functions in VegAttributes.

update_lifestage_and_stemdensity()[source]

Function to be called at the end of every eco year.

Updates the life stage and the year within the life stage for each cohort.

Stem density update is done here because it only depends on eco year and does not change during the year.