RUFAS.routines.field.soil.snow module#
- class RUFAS.routines.field.soil.snow.Snow(soil_data: SoilData | None = None, field_size: float | None = None)#
Bases:
object
Class representing snow-related calculations and data management.
This class provides methods for calculating snow pack temperature, snow melting, and updating snow-related data based on the Soil and Water Assessment Tool (SWAT) documentation.
Attributes#
- soil_dataOptional[SoilData]
The object that tracks all soil variables throughout the simulation.
- field_sizeOptional[float]
The field size (ha).
Methods#
- _calc_snow_temp(current_day_conditions: CurrentDayConditions) -> float:
Calculate the snow pack temperature for the current day.
- _melt_snow(current_day_conditions: CurrentDayConditions, day: int) -> float:
Calculate the snow melt for the current day.
- _melt_factor(day: int) -> float:
Calculate the snow melt factor for a given day, b_mlt.
- sublimation():
Placeholder function for sublimation calculations.
- update_snow(current_day_conditions: CurrentDayConditions, day: int) -> None:
Update snow-related data including snow content and temperatures.
- __init__(soil_data: SoilData | None = None, field_size: float | None = None)#
object that tracks all soil variable throughout the simulation
- static _calc_snow_temp(soil_data: SoilData, current_day_conditions: CurrentDayConditions) float #
This function calculates the snow pack temperature for the current day.
Parameters#
- soil_dataSoilData
The object that tracks all soil variables throughout the simulation.
- current_day_conditionsCurrentDayConditions
The current day weather data.
Returns#
- float
The calculated snow pack temperature for the current day (Celsius).
References#
Equation 1:2.5.1 in SWAT 2009 Theoretical Documentation.
- static _melt_snow(soil_data: SoilData, current_day_conditions: CurrentDayConditions, day: int) float #
This function calculates the amount of snow melting for the current day.
Parameters#
- soil_dataSoilData
The object that tracks all soil variables throughout the simulation.
- current_day_conditionsCurrentDayConditions
The current day weather data.
- day :int
The day number of the year.
Returns#
- float
The amount of snow melting for the current day.
References#
Equation 1:2.5.2 in SWAT 2009 Theoretical Documentation.
- static _melt_factor(soil_data: SoilData, day: int) float #
This function calculates the snow melt factor for the current day.
Parameters#
- dayint
The day number of the year.
Returns#
- float
The calculated snow melt factor for the current day.
References#
Equation 1:2.5.3 in SWAT 2009 Theoretical Documentation.
- update_snow(current_day_conditions: CurrentDayConditions, day: int) None #
Update snow-related data for the current day.
This function updates various snow-related data, including snow content, snow temperatures, and snow melting, based on the provided current day weather data and day of the simulation.
Notes#
If the current snow content is negative, a ValueError is raised.
If the snow content is 0.0, ‘previous_day_snow_temperature’ and ‘current_day_snow_temperature’ are set to None and ‘snow_content’ and ‘snow_melt_amount’ is set to 0.0.
Before calculating the current day snow temperature, ‘previous_day_snow_temperature’ is set to the value of ‘current_day_snow_temperature’ from the last iteration. If ‘current_day_snow_temperature’ is None, ‘previous_day_snow_temperature’ is set to the average air temperature of the current day.
Parameters#
- current_day_conditionsCurrentDayConditions
The current day weather data.
- dayint
The day number of the year.
Returns#
None
Raises#
- ValueError
If the snow_content is < 0.0.