RUFAS.routines.field.crop.heat_units module#

class RUFAS.routines.field.crop.heat_units.HeatUnits(crop_data: CropData | None = None, maximum_temperature: float = 38.0, use_heat_unit_temperature: bool = False, new_heat_units: float | None = None, minimum_heat_unit_temperature: float | None = None, maximum_heat_unit_temperature: float | None = None, heat_unit_temperature: float | None = None)#

Bases: object

A class that manages heat units for crop growth.

Parameters#

crop_dataOptional[CropData], optional

An instance of CropData containing crop specifications and attributes. If not provided, a default CropData instance is initialized with default values.

maximum_temperaturefloat, default 38

Maximum temperature for plant growth (Celsius).

use_heat_unit_temperaturebool, default False

If alternative heat unit method is used.

new_heat_unitsOptional[float], default None

Heat units accumulated on the current day (Celsius).

minimum_heat_unit_temperatureOptional[float], default None

Minimum temperature for heat unit calculations (Celsius).

maximum_heat_unit_temperatureOptional[float], default None

Maximum temperature for heat unit calculations (Celsius).

heat_unit_temperatureOptional[float], default None

Heat unit temperature for alternative method (Celsius).

Attributes#

dataCropData

A reference to the crop_data object, used for accessing and updating crop-related data like temperature thresholds, accumulated heat units, and growth stages.

maximum_temperaturefloat

Maximum temperature for plant growth (Celsius).

use_heat_unit_temperaturebool

If alternative heat unit method is used.

new_heat_unitsOptional[float]

Heat units accumulated on the current day (Celsius*).

minimum_heat_unit_temperatureOptional[float]

Minimum temperature for heat unit calculations (Celsius).

maximum_heat_unit_temperatureOptional[float]

Maximum temperature for heat unit calculations (Celsius).

heat_unit_temperatureOptional[float]

Heat unit temperature for alternative method (Celsius).

Notes#

This module primarily follows the Heat Units section of the SWAT model (5:3.1)

__init__(crop_data: CropData | None = None, maximum_temperature: float = 38.0, use_heat_unit_temperature: bool = False, new_heat_units: float | None = None, minimum_heat_unit_temperature: float | None = None, maximum_heat_unit_temperature: float | None = None, heat_unit_temperature: float | None = None) None#
absorb_heat_units(mean_air_temperature: float | None = None, min_air_temperature: float | None = None, max_air_temperature: float | None = None) None#

Main function for absorbing heat units during a day and accumulating them.

Parameters#

mean_air_temperatureOptional[float]

Average air temperature for the day (°C).

min_air_temperatureOptional[float]

Minimum air temperature for the day (°C).

max_air_temperatureOptional[float]

Maximum air temperature for the day (°C).

Notes#

If the attribute use_heat_unit_temperature in CropData is False, both min_air_temperature and max_air_temperature are optional. Otherwise, they are used to determine heat unit accumulation rather than average air temperature.

References#

SWAT 5:1.1, 5:2.1.2

accumulate_heat_units(air_temperature: float | None = None) None#

Accumulates heat units during a day based on the air temperature.

Parameters#

air_temperaturefloat

The average air temperature during the day (°C).

Notes#

The method of accumulation depends on the attribute use_heat_unit_temperature: - If use_heat_unit_temperature is False (default), the method accumulates every degree Celsius above the crop’s minimum temperature for growth as heat units, following the SWAT manual. - If use_heat_unit_temperature is True, or air_temperature is None, an alternative method is used. In this method, the heat_unit_temperature attribute is used in place of the average air temperature. The accumulation varies depending on the relationship between the air temperature range and the crop’s growth temperature range:

  1. If both min and max air temperatures are higher than the crop’s min and max growth temperatures, accumulation is greater than the main method.

  2. If both min and max air temperatures are lower than the crop’s min and max temperatures, accumulation is greater than the main method.

  3. If the air temperature range is entirely within the crop’s temperature range, accumulation equals the middle of the crop temperature window.

  4. If the crop’s temperature range is entirely within the air temperature range, accumulation equals the middle of the air temperature range.

assign_new_heat_units(air_temperature: float | None = None) None#

Assign new heat units based on whether the alternative accumulation method is to be used.

Parameters#

air_temperatureOptional[float], optional

The average air temperature during the day (°C).

add_heat_units() None#

Add newly acquired heat units to accumulated heat units.

static _determine_new_heat_units(temperature: float, min_temperature: float) float#

Calculates the heat units that will be accumulated during a day.

Parameters#

temperaturefloat

The temperature to be compared to min_temperature for accumulating heat units (°C).

min_temperaturefloat

The minimum temperature below which a crop cannot grow (°C).

Returns#

float

The calculated heat units to be accumulated based on the given temperature and minimum temperature (C).

References#

SWAT Reference 5:1.1

static _determine_minimum_heat_unit_temperature(min_air_temp: float, min_growth_temp: float) float#

Calculates the minimum heat unit temperature on the current day.

Parameters#

min_air_tempfloat

Minimum air temperature on the current day (°C).

min_growth_tempfloat

Minimum temperature at which a crop can grow (°C).

Returns#

float

The calculated minimum heat unit temperature for the day (°C).

static _determine_maximum_heat_unit_temperature(max_air_temp: float, max_growth_temp: float) float#

Calculates the maximum heat unit temperature on the current day.

Parameters#

max_air_tempfloat

Maximum air temperature on the current day (°C).

max_growth_tempfloat

Maximum temperature at which a crop can grow (°C).

Returns#

float

The maximum heat unit temperature for the day.

References#

“pseudocode_crop” C.2.A.4