Skip to content

Core Logic

Membership Functions

A class to read, handle, and write crop sensitivity parameters from .inf files.

__init__(crop, parameters_path)

Initializes the CropSensitivity class.

Args: crop (str): The name of the crop (e.g., 'beans'). parameters_path (str): The path to the directory containing the parameter files.

create_new_max_parameter_values(parameter, new_max, percentage=True)

Shifts and stretches the parameter suitability value to a new maximum .

Args: parameter (str): Parameter's name new_max (float): The new maximum parameter's value.

Returns: np.array: The new array of values for the transformed range.

create_new_min_parameter_values(parameter, new_min)

Shifts and stretches the parameter suitability value to a new maximum .

Args: parameter (str): Parameter's name new_min (float): The new minimum parameter's value.

Returns: np.array: The new array of values for the transformed range.

create_new_min_parameter_valuesv2(parameter, new_min)

Shifts and stretches the parameter suitability value to a new maximum .

Args: parameter (str): Parameter's name new_min (float): The new minimum parameter's value.

Returns: np.array: The new array of values for the transformed range.

read_crop_configuration()

Reads the crop configuration .inf file and parses the parameters.

The method reads the file line by line, splitting keys and values. It handles the crop name as a string, single values as floats, and parameter curves as lists of floats.

Returns: dict: A dictionary containing the parsed crop parameters.

write_configuration(output_path=None)

Writes the current crop parameters to a .inf file.

Args: output_path (str, optional): The path to write the file to. If not provided, it overwrites the original file.

Utilities

solutions.utils