pyissm.model.classes.verbose
- class pyissm.model.classes.verbose(other=None)
Bases:
manage_stateVerbose parameters class for ISSM.
This class encapsulates verbose parameters that control the level of output and logging in the ISSM (Ice Sheet System Model) framework. It allows users to enable or disable verbosity for different components of the model.
- Parameters:
other (any, optional) – Any other class object that contains common fields to inherit from. If values in
otherdiffer from default values, they will override the default values.
- mprocessor
Processor verbosity (0 or 1).
- Type:
int, default=0
- module
Module verbosity (0 or 1).
- Type:
int, default=0
- solution
Solution verbosity (0 or 1).
- Type:
int, default=1
- solver
Solver verbosity (0 or 1).
- Type:
int, default=0
- convergence
Convergence verbosity (0 or 1).
- Type:
int, default=0
- control
Control verbosity (0 or 1).
- Type:
int, default=1
- qmu
QMU (Dakota) verbosity (0 or 1).
- Type:
int, default=1
- autodiff
Automatic differentiation verbosity (0 or 1).
- Type:
int, default=0
- smb
Surface mass balance verbosity (0 or 1).
- Type:
int, default=0
Examples
>>> md.verbose = pyissm.model.classes.verbose() >>> md.verbose.solution = 1 >>> md.verbose.convergence = 1
- __init__(other=None)
Initialize the instance with optional field inheritance.
- Parameters:
other (
object, optional) – Another instance to inherit field values from. If provided, any fields in the current instance that differ from the default values and exist in ‘other’ will be replaced with the values from ‘other’.
Notes
The inheritance process:
Iterates through all attributes of the current instance
Checks if the same attribute exists in the ‘other’ instance
Compares field values using _fields_equal()
If different, replaces the current value with the ‘other’ value
This enables the common ISSM pattern where classes can inherit configurations from existing instances while maintaining their default values for unspecified fields.
Methods
VerboseToBinary()Convert current verbosity settings to integer bitmask.
__init__([other])Initialize the instance with optional field inheritance.
check_consistency(md, solution, analyses)Check consistency of the [verbose.verbose] parameters.
deactivate_all()Deactivate all verbose model components.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [verbose.verbose] parameters to a binary file.
- VerboseToBinary()
Convert current verbosity settings to integer bitmask.
This method converts the boolean verbosity flags into a single integer where each bit represents a different verbosity option according to the field mapping defined in the class.
- Returns:
Integer bitmask representing the current verbosity settings. Each bit corresponds to a verbosity flag as defined in _fields.
- Return type:
int
Examples
>>> verbose_obj = verbose() >>> verbose_obj.solution = True >>> verbose_obj.control = True >>> binary_value = verbose_obj.VerboseToBinary() >>> print(binary_value) # Will print 36 (4 + 32)
- check_consistency(md, solution, analyses)
Check consistency of the [verbose.verbose] parameters.
- Parameters:
md (
pyissm.model.Model) – The model object to check.solution (
str) – The solution name to check.analyses (list of
str) – List of analyses to check consistency for.
- Returns:
md – The model object with any consistency errors noted.
- Return type:
- deactivate_all()
Deactivate all verbose model components.
- marshall_class(fid, prefix, md=None)
Marshall [verbose.verbose] parameters to a binary file.
- Parameters:
fid (file object) – The file object to write the binary data to.
prefix (str) – Prefix string used for data identification in the binary file.
md (ISSM model object, optional.) – ISSM model object needed in some cases.
- Return type:
None