RUFAS.routines.field.crop.crop_data_factory module#
- class RUFAS.routines.field.crop.crop_data_factory.CropConfiguration#
Bases:
TypedDict
Data structure used to store crop configuration attributes. Attribute descriptions are omitted because all attributes are documented in both the metadata properties and the CropData class docstring.
- name: str#
- plant_category: PlantCategory#
- crop_category: CropCategory#
- rufas_ids: list[int]#
- is_nitrogen_fixer: bool#
- minimum_temperature: float#
- optimal_temperature: float#
- potential_heat_units: float#
- max_leaf_area_index: float#
- first_heat_fraction_point: float#
- first_leaf_fraction_point: float#
- second_heat_fraction_point: float#
- second_leaf_fraction_point: float#
- senescent_heat_fraction: float#
- light_use_efficiency: float#
- emergence_nitrogen_fraction: float#
- half_mature_nitrogen_fraction: float#
- mature_nitrogen_fraction: float#
- emergence_phosphorus_fraction: float#
- half_mature_phosphorus_fraction: float#
- mature_phosphorus_fraction: float#
- max_root_depth: float#
- root_distribution_param_da: float#
- root_distribution_param_c: float#
- storage_type: StorageType#
- optimal_harvest_index: float#
- minimum_harvest_index: float#
- dry_matter_percentage: float#
- lignin_dry_matter_percentage: float#
- crude_protein_percent: float#
- non_protein_nitrogen: float#
- starch: float#
- adf: float#
- ndf: float#
- sugar: float#
- ash: float#
- yield_nitrogen_fraction: float#
- yield_phosphorus_fraction: float#
- class RUFAS.routines.field.crop.crop_data_factory.CropDataFactory#
Bases:
object
Manages and manufactures CropData instances using user-input crop configurations.
Attributes#
- _crop_configurationsdict[str, CropConfiguration]
Maps names of different crop configurations to dictionaries of their attributes.
- _omOutputManager
OutputManager instance.
- _crop_configurations: dict[str, CropConfiguration]#
- _om: OutputManager#
- classmethod setup_crop_configurations() None #
Collects crop configuration inputs, validates them, and stores them so they can be used for creating CropData.
Raises#
- ValueError
If the names of crop configurations are not unique.
- classmethod _manufacture_crop_configuration(config: dict[str, Any]) CropConfiguration #
Creates and validates the configuration for a single crop.
Parameters#
- configdict[str, Any]
A dictionary containing the configuration attributes for a single crop.
Returns#
- CropConfiguration
A validated crop configuration dictionary.
Raises#
- ValueError
If the crop type is not valid for the crop category.
- classmethod get_available_crop_configurations() list[str] #
Returns a list of the names of the available crop configurations.
Returns#
- list[str]
A list of the names of the available crop configurations.
- classmethod get_full_crop_configurations() dict[str, CropConfiguration] #
Returns the full crop configurations available in the simulation.
- classmethod create_crop_data(crop_type: str) CropData #
Creates a CropData instance configured with the attributes of the specified crop configuration.
Parameters#
- crop_typestr
The name of the crop configuration to use.
Returns#
- CropData
A CropData instance with the attributes of the specified crop configuration.
Raises#
- ValueError
If the specified crop configuration does not exist.