pyissm.model.classes.class_utils

Various utility functions for ISSM model classes.

Functions

cluster_queue_requirements(queue_dict, ...)

Validate cluster queue requirements.

marshall_inversion_cost_functions(cost_functions)

Map inversion cost function codes to their corresponding string names.

supported_analyses()

Return a list of supported analyses.

supported_inversion_control_parameters()

Return a list of supported inversion control parameters.

supported_inversion_cost_functions()

Return a list of supported inversion cost function codes.

supported_stochastic_forcings([return_dict])

Return supported stochastic forcings.

pyissm.model.classes.class_utils.cluster_queue_requirements(queue_dict, queue, np, time)

Validate cluster queue requirements.

Validates that the requested queue exists, the time is positive and does not exceed the queue’s maximum allowed time, and the number of processors is positive and does not exceed the queue’s maximum allowed processors.

Parameters:
  • queue_dict (dict) – Dictionary mapping queue names to (max_time, max_np) tuples, where max_time is the maximum allowed time for the queue and max_np is the maximum allowed number of processors.

  • queue (str) – Name of the requested queue.

  • np (int) – Number of processors requested. Must be positive and not exceed the queue’s maximum.

  • time (float or int) – Requested time in minutes (or appropriate time unit). Must be positive and not exceed the queue’s maximum allowed time.

Raises:

Exception

  • If the queue name is not found in queue_dict. - If time is not positive. - If requested time exceeds the maximum allowed time for the queue. - If number of processors is not positive. - If requested number of processors exceeds the maximum allowed for the queue.

pyissm.model.classes.class_utils.marshall_inversion_cost_functions(cost_functions)

Map inversion cost function codes to their corresponding string names.

This function converts integer cost function codes used in ISSM inversion routines to their human-readable string representations. It supports both single cost function codes and lists of multiple codes.

Parameters:

cost_functions (int or list of int) –

Cost function code(s) to be mapped. Supported codes include:

  • 101: SurfaceAbsVelMisfit

  • 102: SurfaceRelVelMisfit

  • 103: SurfaceLogVelMisfit

  • 104: SurfaceLogVxVyMisfit

  • 105: SurfaceAverageVelMisfit

  • 201: ThicknessAbsMisfit

  • 501: DragCoefficientAbsGradient

  • 502: RheologyBbarAbsGradient

  • 503: ThicknessAbsGradient

  • 504: ThicknessAlongGradient

  • 505: ThicknessAcrossGradient

Returns:

List containing the string name(s) corresponding to the input cost function code(s).

Return type:

list of str

Examples

>>> map_inversion_cost_functions(101)
['SurfaceAbsVelMisfit']

>>> map_inversion_cost_functions([101, 201, 501])
['SurfaceAbsVelMisfit', 'ThicknessAbsMisfit', 'DragCoefficientAbsGradient']
pyissm.model.classes.class_utils.supported_analyses()

Return a list of supported analyses.

Returns:

List of supported analyses.

Return type:

list of str

pyissm.model.classes.class_utils.supported_inversion_control_parameters()

Return a list of supported inversion control parameters.

Returns:

List of supported inversion control parameter names.

Return type:

list of str

pyissm.model.classes.class_utils.supported_inversion_cost_functions()

Return a list of supported inversion cost function codes.

Returns:

List of supported inversion cost function codes.

Return type:

list of int

pyissm.model.classes.class_utils.supported_stochastic_forcings(return_dict=False)

Return supported stochastic forcings.

Parameters:

return_dict (bool, default=False) – If True, return the full mapping dict; otherwise, return just the list of keys.

Returns:

Mapping of supported stochastic forcing fields to their corresponding parameter modules, or list of field names.

Return type:

dict or list of str

Notes

Maintain legacy naming for compatibility with MATLAB version