spyice.postprocess package#

Submodules#

Module contents#

class src.spyice.postprocess.Analysis[source]#

Bases: object

Represents an analysis object that performs error analysis on temperature differences.

Parameters:
  • t_k_diff (float) – The temperature difference in Kelvin.

  • t_stefan_diff (float) – The temperature difference in Stefan-Boltzmann units.

__init__(t_k_diff, t_stefan_diff)[source]#
Parameters:
  • t_k_diff (float) – The temperature difference in Kelvin.

  • t_stefan_diff (float) – The temperature difference in Stefan-Boltzmann units.

calculate_errors(field_array, error_norms_object)[source]#

Calculates the errors of a given field array using the provided error norms object.

Parameters:
  • field_array (numpy.ndarray) – The field array to calculate the errors for.

  • error_norms_object (ErrorNorms) – The error norms object used to calculate the errors.

Returns:

A tuple containing the one-norm error, infinity-norm error, and two-norm error.

Return type:

tuple

error_analytical_numerical()[source]#

Calculates the errors of Numerical and Analytical using error norms one, two and infinity.

Parameters:

None

Returns:

A tuple containing the errors calculated using different error norms:
  • T_k_Stefan_diff_L1norm (float): L1 norm of the difference between T_k_list and T_Stefan_list.

  • T_k_Stefan_diff_infnorm (float): Infinity norm of the difference between T_k_list and T_Stefan_list.

  • T_k_Stefan_diff_L2norm (float): L2 norm of the difference between T_k_list and T_Stefan_list.

  • T_Stefan_diff_L1norm (float): L1 norm of the difference between consecutive T_Stefan values.

  • T_Stefan_diff_infnorm (float): Infinity norm of the difference between consecutive T_Stefan values.

  • T_Stefan_diff_L2norm (float): L2 norm of the difference between consecutive T_Stefan values.

  • T_k_diff_infnorm (float): Infinity norm of the difference between consecutive T_k values.

  • T_k_diff_L2norm (float): L2 norm of the difference between consecutive T_k values.

  • T_k_diff_L1norm (float): L1 norm of the difference between consecutive T_k values.

Return type:

tuple

export_residuals(residuals, temperature_mushy, phi_mushy, salinity_mushy, output_dir)[source]#

Exports the residuals to a file.

Parameters:
  • residuals (np.array) – The residuals to export.

  • output_dir (str) – The output directory to save the residuals to.

Returns:

None

classmethod get_error_results(t_k_diff, t_stefan_diff, residual, temperature_mushy, phi_mushy, salinity_mushy, output_dir)[source]#

Runs error analysis on the given temperature differences.

Parameters:
  • cls – The class object.

  • t_k_diff (ndarray) – The temperature difference for k.

  • t_stefan_diff (ndarray) – The temperature difference for Stefan.

  • residual (ndarray)

  • temperature_mushy (ndarray)

  • phi_mushy (ndarray)

  • salinity_mushy (ndarray)

  • output_dir (Path | str)

Returns:

An instance of the AnalysisData class containing the error analysis results.

Return type:

AnalysisData

set_analysis()[source]#

Sets up the analysis for the current object.

This method initializes the error_norms_object attribute with an instance of the ErrorNorms class, passing the t_k_diff and t_stefan_diff attributes as arguments. It then calculates the numerical analytical difference using the numerical_analytical_diff method of the error_norms_object.

Parameters:

None

Returns:

None

static set_dataclass(data_to_be_converted, dataclass)[source]#

Sets the values of a dataclass object using a dictionary.

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

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

Returns:

The updated dataclass object.

Return type:

dataclass

store_field_errors(T_k_Stefan_diff_L1norm, T_k_Stefan_diff_infnorm, T_k_Stefan_diff_L2norm, T_Stefan_diff_infnorm, T_Stefan_diff_L2norm, T_Stefan_diff_L1norm, T_k_diff_infnorm, T_k_diff_L2norm, T_k_diff_L1norm)[source]#

Stores the field errors.

Parameters:
  • T_k_Stefan_diff_L1norm (float) – The L1 norm of the temperature and concentration difference.

  • T_k_Stefan_diff_infnorm (float) – The infinity norm of the temperature and concentration difference.

  • T_k_Stefan_diff_L2norm (float) – The L2 norm of the temperature and concentration difference.

  • T_Stefan_diff_infnorm (float) – The infinity norm of the temperature difference.

  • T_Stefan_diff_L2norm (float) – The L2 norm of the temperature difference.

  • T_Stefan_diff_L1norm (float) – The L1 norm of the temperature difference.

  • T_k_diff_infnorm (float) – The infinity norm of the temperature and concentration difference.

  • T_k_diff_L2norm (float) – The L2 norm of the temperature and concentration difference.

  • T_k_diff_L1norm (float) – The L1 norm of the temperature and concentration difference.

class src.spyice.postprocess.VisualiseModel[source]#

Bases: object

A class for visualizing sea ice model results.

Parameters:
  • user_input_dataclass (UserInput) – An instance of the UserInput class containing user input data.

  • results_dataclass (ResultsParams) – An instance of the ResultsParams class containing results data.

  • error_analysis_dataclass (Analysis) – An instance of the Analysis class containing error analysis data.

__init__(user_input_dataclass, results_dataclass, error_analysis_dataclass)[source]#
Parameters:
  • user_input_dataclass (UserInput) – An instance of the UserInput class containing user input data.

  • results_dataclass (ResultsParams) – An instance of the ResultsParams class containing results data.

  • error_analysis_dataclass (Analysis) – An instance of the Analysis class containing error analysis data.

Return type:

None

create_2d_array(data)[source]#
phi_slope(iteration)[source]#

Calculates the indices of the mushy regions based on the phi values.

Parameters:

iteration (int) – The iteration number.

Returns:

The indices of the mushy regions.

Return type:

numpy.ndarray

plot_H_iter(h, t, s=None, param_name='Temperature', unit='K', savefig=False)[source]#
plot_H_iter_all(savefig=False)[source]#
plot_H_iter_heatmap(h, p, temp_all, d, t, param_name='Temperature', unit='K', savefig=False)[source]#
plot_H_iter_heatmap_mushy(h, p, temp_all, t, param_name='Temperature', unit='K', savefig=False)[source]#
plot_all_phi_mush(phi_mush, t, savefig=False)[source]#
plot_brinevelocity_profile(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:

savefig (bool)

plot_carbon_concentration(savefig=True)[source]#
Parameters:

savefig (bool)

plot_carbon_concentration_multiplelayers(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:
  • savefig (bool)

  • show (bool)

plot_carbon_concentration_profile(savefig=True, show=False)[source]#
Parameters:
  • savefig (bool)

  • show (bool)

plot_carbon_heatmap_as_gif()[source]#
plot_chla_bulk_concentration(savefig=True)[source]#
Parameters:

savefig (bool)

plot_chla_bulk_concentration_multiplelayers(savefig=True)[source]#
Parameters:

savefig (bool)

plot_depth_over_time(savefig=False, show=False)[source]#

Plots the depth over time.

Parameters:

savefig (bool, optional) – Whether to save the figure. Defaults to False.

plot_depth_over_time_heatmap(savefig=False)[source]#

Plots the depth over time.

Parameters:

savefig (bool, optional) – Whether to save the figure. Defaults to False.

plot_error_temp(zoom_x, norm='inf', savefig=True)[source]#

Plots the temperature errors using the specified norm.

Parameters:
  • zoom_x (int) – The maximum value for the x-axis.

  • norm (str, optional) – The norm to be used for plotting. Defaults to “inf”.

  • savefig (bool, optional) – Whether to save the figure. Defaults to True.

plot_error_temp_diff(zoom_x, savefig='True')[source]#

Plots the temperature differences between two consecutive iterations.

Parameters:
  • zoom_x (int) – The maximum value for the x-axis.

  • savefig (str, optional) – Indicates whether to save the figure or not. Defaults to “True”.

plot_liquid_fraction_profile(savefig=True)[source]#
Parameters:

savefig (bool)

plot_liquid_salinity_profile(savefig=True)[source]#
Parameters:

savefig (bool)

plot_liquidfraction_heatmap(savefig=True, show=False, ax=None, fig=None)[source]#

Plots the Liquidfraction heatmap.

Parameters:

savefig (bool)

plot_nutrient_cn_profile(savefig=True)[source]#
Parameters:

savefig (bool)

plot_nutrient_concentration(savefig=True)[source]#
Parameters:

savefig (bool)

plot_nutrient_concentration_heatmap_as_gif()[source]#
plot_nutrient_concentration_multiplelayers(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:
  • savefig (bool)

  • show (bool)

plot_photosynthetic_rate(savefig=True)[source]#
Parameters:

savefig (bool)

plot_photosynthetic_rate_multiplelayers(savefig=True)[source]#
Parameters:

savefig (bool)

plot_radiation_algae(savefig=True)[source]#
Parameters:

savefig (bool)

plot_radiation_algae_dt_by_rho_c(savefig=True)[source]#
Parameters:

savefig (bool)

plot_radiation_algae_multiplelayers(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:
  • savefig (bool)

  • show (bool)

plot_radiation_all(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:

savefig (bool)

plot_radiation_profile(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:

savefig (bool)

plot_response_pt1_pt2(tempmushPT1, tempmushPT2, savefig=False)[source]#
plot_salinity_heatmap(savefig=True, show=False, ax=None, fig=None)[source]#

Plots the Salinity heatmap.

Parameters:
  • savefig (bool)

  • show (bool)

plot_salinity_heatmap_as_gif()[source]#
plot_salinity_profile(savefig=True)[source]#
Parameters:

savefig (bool)

plot_salinity_sourceterm_profile(savefig=True, show=False, ax=None, fig=None)[source]#
Parameters:

savefig (bool)

plot_temperature(z_depth, savefig=True, Buffo_matlab=False)[source]#

Plots the temperature evolution at a given depth.

Parameters:
  • z_depth (float) – The depth at which to plot the temperature evolution.

  • savefig (bool, optional) – Whether to save the figure. Defaults to True.

  • Buffo_matlab (bool, optional) – Whether to include Buffo-matlab data in the plot. Defaults to False.

plot_temperature_3D(savefig=True)[source]#
Parameters:

savefig (bool)

plot_temperature_3d_contours(savefig=True)[source]#
plot_temperature_heatmap(savefig=True, export_csv=False, show=False, ax=None, fig=None)[source]#

Plots the temperature heatmap.

Parameters:
  • savefig (bool)

  • show (bool)

plot_temperature_heatmap_as_gif()[source]#
plot_temperature_liquid_solid_evolution(z_depth, savefig=False)[source]#

Plots the temperature evolution at a given depth.

Parameters:
  • z_depth (float) – The depth at which to plot the temperature evolution.

  • savefig (bool, optional) – Whether to save the figure. Defaults to True.

  • Buffo_matlab (bool, optional) – Whether to include Buffo-matlab data in the plot. Defaults to False.

plot_temperature_profile(savefig=True)[source]#
Parameters:

savefig (bool)