spyice.preprocess package#

Submodules#

Module contents#

class src.spyice.preprocess.PreProcess[source]#

Bases: UserInput, GeometrySettings, ResultsParams

Class for preprocessing data before modeling.

Initialize the PreProcess class. :param config_data: The configuration data object. :type config_data: ConfigData :param output_dir: The output directory. :type output_dir: str

Raises:

None

Returns:

None

__init__(constants_type, config_data, output_dir)[source]#

Initialize the PreProcess class. :param config_data: The configuration data object. :type config_data: ConfigData :param output_dir: The output directory. :type output_dir: str

Raises:

None

Returns:

None

get_userinput()[source]#

Returns a UserInput object with the following attributes:

Parameters:

self (PreProcess) – The PreProcess instance.

Returns:

A UserInput object with the following attributes:
  • constants: The constants attribute.

  • grid_timestep_dt: The grid_timestep_dt attribute.

  • initial_salinity: The initial_salinity attribute.

  • dir_output_name: The dir_output_name attribute.

  • max_iterations: The max_iterations attribute.

Return type:

UserInput

classmethod get_variables(config, out_dir_final)[source]#

Retrieves variables and user input data after preprocessing.

Parameters:
  • cls – The class object.

  • config – The configuration object.

  • out_dir_final (Path | str) – The output directory.

Returns:

A tuple containing the filtered variables and user input data.

Return type:

tuple[PreprocessData, UserInput]

preprocess()[source]#

Preprocesses the data before running the simulation. This method sets up the initial conditions and boundary conditions for the simulation. It calculates the solid enthalpy and updates the enthalpy based on temperature, salinity, and liquid fraction. Finally, it initializes the ice thickness and prints a message indicating that the initial and boundary conditions have been applied.

Args:

None

static preprocess_jupyter(self)[source]#

Preprocesses the data before running the simulation. This method sets up the initial conditions and boundary conditions for the simulation. It calculates the solid enthalpy and updates the enthalpy based on temperature, salinity, and liquid fraction. Finally, it initializes the ice thickness and prints a message indicating that the initial and boundary conditions have been applied.

Args:

None

Parameters:

self (PreprocessData)

static set_dataclass(data_to_be_converted, dataclass)[source]#

Sets the attributes of a dataclass object using a dictionary.

Parameters:
  • data_to_be_converted (dict) – A dictionary containing the attribute names and values to be set.

  • dataclass (dataclass) – The dataclass object to be modified.

Returns:

The modified dataclass object with the attributes set.

Return type:

dataclass

static set_dataclass_with_dataclass(_preprocess_dataclass, _dataclass)[source]#

Sets the dataclass attributes of the object.

Parameters:

_dataclass – An instance of the dataclass.

Returns:

None

set_preprocess(config_data, output_dir)[source]#
static update_preprocess_dataclass(preprocess_dataclass, userinput_dataclass)[source]#
Parameters:

userinput_dataclass (UserInput)