RUFAS.routines.field.crop.growth_constraints module#

class RUFAS.routines.field.crop.growth_constraints.GrowthConstraints(crop_data: CropData | None = None, water_stress: float = 0.0, temp_stress: float | None = None, nitrogen_stress: float | None = None, phosphorus_stress: float | None = None)#

Bases: object

A class pertaining to growth constraints of crops.

This class is focused on managing and applying growth constraints to crop processes, as described in the Growth Constraints section of the SWAT model (5:3.1). It uses data from the CropData class to assess and apply these constraints.

Parameters#

crop_dataOptional[CropData], optional

A CropData object containing crop specifications and tracked attributes. If not provided, a default CropData object is initialized with default values.

water_stressfloat, default 0.0

Water stress for the day (unitless).

temp_stressOptional[float], default None

Temperature stress for the day (unitless).

nitrogen_stressOptional[float], default None

Nitrogen stress for the day (unitless).

phosphorus_stressOptional[float], default None

Phosphorus stress for the day (unitless).

Attributes#

dataCropData

A reference to the crop_data object on which the growth constraint operations are conducted.

water_stressfloat

Water stress for the day (unitless).

temp_stressOptional[float]

Temperature stress for the day (unitless).

nitrogen_stressOptional[float]

Nitrogen stress for the day (unitless).

phosphorus_stressOptional[float]

Phosphorus stress for the day (unitless).

Methods#

constrain_growth(max_transpiration: float, temperature: float) -> None

Constrain a plant’s growth by updating stress and growth factor values based on maximum transpiration and current air temperature.

_determine_growth_factor(water_stress: float, temperature_stress: float, nitrogen_stress: float,

phosphorus_stress: float) -> float

Calculate the plant growth factor based on various stress parameters.

_determine_water_stress(water_uptake: float, max_transpiration: float) -> float

Calculate water stress for a given day based on water uptake and maximum transpiration.

_determine_temperature_stress(air_temp: float, min_temp: float, optimal_temp: float) -> float

Calculate temperature stress for a given day based on air temperature, minimum growth temperature, and optimal growth temperature.

_determine_nutrient_stress(stored: float, optimal: float) -> float

Calculate plant nutrient stress for the day based on the amount of nutrient stored and the optimal nutrient amount.

__init__(crop_data: CropData | None = None, water_stress: float = 0.0, temp_stress: float | None = None, nitrogen_stress: float | None = None, phosphorus_stress: float | None = None) None#
constrain_growth(max_transpiration: float | None, temperature: float | None, simulate_water_stress: bool, simulate_temp_stress: bool, simulate_nitrogen_stress: bool, simulate_phosphorus_stress: bool) None#

Main method to constrain a plant’s growth by updating stress and growth factor values.

Parameters#

max_transpirationfloat | None

The maximum amount of transpiration possible (in mm) on this day, determined by soil conditions.

temperaturefloat | None

The current air temperature in degrees Celsius.

simulate_water_stressbool

Whether water stress should affect growth of all crops grown in the field.

simulate_temp_stressbool

Whether temperature stress should affect growth of all crops grown in the field.

simulate_nitrogen_stressbool

Whether nitrogen stress should affect growth of all crops grown in the field.

simulate_phosphorus_stressbool

Whether phosphorus stress should affect growth of all crops grown in the field.

Notes#

Each crop stressor is checked to determine whether or not it should affect crop growth. If it is not to affect crop growth, then the stressor is set to 0.

static _determine_growth_factor(water_stress: float, temperature_stress: float, nitrogen_stress: float, phosphorus_stress: float) float#

Calculates the plant growth factor based on various stress parameters.

Parameters#

water_stressfloat

Plant water stress.

temperature_stressfloat

Plant temperature stress.

nitrogen_stressfloat

Plant nitrogen stress.

phosphorus_stressfloat

Plant phosphorus stress.

Returns#

float

Calculated plant growth factor.

References#

SWAT 5:3.2.3

static _determine_water_stress(water_uptake: float, max_transpiration: float) float#

Calculates water stress for a given day.

Parameters#

water_uptakefloat

The water taken up by the plant from the soil (mm).

max_transpirationfloat

The maximum plant transpiration possible on a given day (mm).

Returns#

float

The calculated water stress of the plant.

References#

SWAT 5:3.1.1

static _determine_temperature_stress(air_temp: float, min_temp: float, optimal_temp: float) float#

Calculates temperature stress for a given day.

Parameters#

air_tempfloat

Average air temperature for the day (Celsius).

min_tempfloat

Minimum temperature for plant growth (Celsius).

optimal_tempfloat

Optimal temperature for plant growth (Celsius).

Returns#

float

The calculated temperature stress of the plant.

References#

SWAT 5:3.1.2

static _determine_nutrient_stress(stored: float, optimal: float) float#

Calculates plant nutrient stress for the day.

Parameters#

storedfloat

The mass of the nutrient currently stored in the plant (kg/ha).

optimalfloat

The optimal mass of the nutrient that should be stored in the plant for ideal growth (kg/ha).

Returns#

float

The calculated nutrient stress of the plant.

References#

SWAT 5:3.1.3, 5:3.1.4