RUFAS.routines.field.manager.fertilizer_schedule module#

class RUFAS.routines.field.manager.fertilizer_schedule.FertilizerSchedule(name: str, mix_names: List[str], years: List[int], days: List[int], nitrogen_masses: List[float], phosphorus_masses: List[float], potassium_masses: List[float], application_depths: List[float] | None = None, surface_remainder_fractions: List[float] | None = None, pattern_skip: int = 0, pattern_repeat: int = 0)#

Bases: Schedule

A Schedule child class that defines the timing and amounts of fertilizer application to a field. Inherits from the Schedule class to manage and validate a schedule for applying specific fertilizer mixes to a field, including the timing (years and days) and amounts (masses of nitrogen, phosphorus, and potassium) of each application.

Parameters#

namestr

The name of the fertilizer application schedule.

mix_namesList[str]

The names of the specific fertilizer mixes included in the schedule.

yearsList[int]

The years in which the fertilizer will be applied.

daysList[int]

The Julian days on which the fertilizer will be applied within the specified years.

nitrogen_massesList[float]

The minimum masses of nitrogen to be applied in each fertilizer application (kg).

phosphorus_massesList[float]

The minimum masses of phosphorus to be applied in each fertilizer application (kg).

potassium_massesList[float]

The minimum masses of potassium to be applied in each fertilizer application (kg).

application_depthsList[float], optional, default None

The depths at which the fertilizer is to be injected into the soil for each application (mm).

surface_remainder_fractionsList[float], optional, default None

The fractions of each fertilizer application that remain on the soil surface (unitless).

pattern_skipint, optional, default 0.0

The number of years to skip between repetitions of the fertilizer application pattern.

pattern_repeatint, optional, default 0.0

The number of times the specified fertilizer application pattern should be repeated.

Attributes#

mix_namesList[str]

Elongated list of mix names to match the length of the years list, ensuring a mix name for each application year.

nitrogen_massesList[float]

Elongated list of nitrogen masses to match the length of the years list, ensuring a nitrogen mass for each application year.

phosphorus_massesList[float]

Elongated list of phosphorus masses to match the length of the years list, ensuring a phosphorus mass for each application year.

potassium_massesList[float]

Elongated list of potassium masses to match the length of the years list, ensuring a potassium mass for each application year.

application_depthsList[float]

Elongated list or default value [0.0] for application depths, ensuring an application depth for each application year.

surface_remainder_fractionsList[float]

Elongated list or default value [1.0] for surface remainder fractions, ensuring a fraction for each application year.

Notes#

Application depths and surface remainder fractions are intended to have defaults of [0.0] and [1.0] respectively,

but these are not specified directly in the function signature to avoid using mutable default arguments.

__init__(name: str, mix_names: List[str], years: List[int], days: List[int], nitrogen_masses: List[float], phosphorus_masses: List[float], potassium_masses: List[float], application_depths: List[float] | None = None, surface_remainder_fractions: List[float] | None = None, pattern_skip: int = 0, pattern_repeat: int = 0)#
_validate_fertilizer_parameters() None#

Checks that all fields defining a fertilizer application schedule are valid, raises errors if not.

Raises#

ValueError

If not all fertilizer application years are valid. If not all fertilizer application days are valid. If not all fertilizer nitrogen masses are valid. If not all fertilizer phosphorus masses are valid. If not all fertilizer potassium masses are valid. If not all fertilizer application depths are valid. If not all fertilizer surface retention fractions are valid. If not all fertilizer application parameters have the same length.

generate_fertilizer_events() List[FertilizerEvent]#

Creates a list of all fertilizer application events that will occur as dictated by this fertilizer schedule.

Returns#

List[FertilizerEvent]

List of all fertilizer events that occur over the course of this fertilizer schedule.