RUFAS.routines.field.manager.crop_schedule module#

class RUFAS.routines.field.manager.crop_schedule.CropSchedule(name: str, crop_reference: str, planting_years: List[int], planting_days: List[int], harvest_years: List[int], harvest_days: List[int], harvest_operations: List[str], use_heat_scheduling: bool = False, planting_skip: int = 0, harvesting_skip: int = 0, pattern_repeat: int = 0)#

Bases: Schedule

A class for defining a schedule for planting and harvesting crops, allows users to specify a pattern for planting and harvesting a certain crop that can be repeated over a specified number of years, with specified breaks in between repetitions of the pattern.

Parameters#

namestr

Reference to the name of this crop schedule that will be used to distinguish this schedule from others.

crop_referencestr

Reference to the name of the crop that will be used to identify the correct crop specifications.

planting_yearsList[int]

Years in which the crop is planted.

planting_daysList[int]

Julian days on which the crop is planted.

harvest_yearsList[int]

Years in which the crop is harvested.

harvest_daysList[int]

Julian days on which the crop is harvested.

harvest_operationsList[str]

Operations with which the crop is harvested.

use_heat_schedulingbool, optional, default False

Indicates if heat scheduling should be used to determine when the crop is harvested.

planting_skipint, optional, default 0

Number of years to skip between planting cycles.

harvesting_skipint, optional, default 0

Number of years to skip between harvesting cycles.

pattern_repeatint, optional, default 0

Number of times the specified crop planting and harvesting pattern should be repeated.

Attributes#

crop_referencestr

Identifier for the crop associated with this schedule.

planting_yearsList[int]

List of years in which planting events will occur.

planting_daysList[int]

Corresponding Julian days for planting.

planting_skipint

Number of years to skip between planting events.

harvest_yearsList[int]

List of years in which harvesting events will occur.

harvest_daysList[int]

Corresponding Julian days for harvesting.

harvest_operationsList[HarvestOperation]

Enumerated list of operations to perform at harvest.

heat_scheduledbool

Flag indicating if heat unit scheduling is utilized for harvesting decisions.

harvesting_skipint, optional, default 0.0

Number of years to skip between harvesting cycles.

Notes#

This class extends the Schedule class, adding specific functionality for managing agricultural crop schedules. It involves detailed tracking and management of planting and harvesting events, including optional heat scheduling for advanced crop management.

__init__(name: str, crop_reference: str, planting_years: List[int], planting_days: List[int], harvest_years: List[int], harvest_days: List[int], harvest_operations: List[str], use_heat_scheduling: bool = False, planting_skip: int = 0, harvesting_skip: int = 0, pattern_repeat: int = 0)#
_validate_planting_parameters() None#

Checks fields that dictate planting for correctness, otherwise raises errors.

Raises#

ValueError

If not all planting years are valid. If not all planting days are valid. If not number of planting years and days are not equal.

_validate_harvest_parameters() None#

Checks fields that dictate harvesting of crop for correctness, otherwise raises errors.

Raises#

ValueError

If not all harvest years are valid. If not all harvest days are valid. If the number of harvest years, days, and operations are not equal. If the last harvest operation is not a final one, or if any operations before the last are final ones.

generate_planting_events() List[PlantingEvent]#

Generates a list of all planting events that should happen for this crop schedule.

Returns#

List[PlantingEvent]

List of all planting events that will happen for this crop schedule.

generate_harvest_events() list[HarvestEvent]#

Generates a list of all harvest events that will occur in the crop schedule.

Returns#

List[HarvestEvent]

List of harvesting events that will happen for this crop schedule.

Notes#

If heat scheduled harvesting is used, then only the final harvesting event (i.e. the one that kills it) will be scheduled, which is why this method contains the if block that removes all non-final harvest events.