pyissm.model.classes.sampling
- class pyissm.model.classes.sampling(other=None)
Bases:
manage_stateSampling parameters class for ISSM.
This class encapsulates parameters for stochastic sampling in the ISSM (Ice Sheet System Model) framework. It configures parameters for generating random fields using PDE-based operators and autoregressive processes, useful for uncertainty quantification and stochastic forcing applications.
- Parameters:
other (any, optional) – Any other class object that contains common fields to inherit from. If values in other differ from default values, they will override the default values.
- kappa
Coefficient of the identity operator in PDE operator (kappa^2 I - Laplacian)^(alpha/2)(tau).
- Type:
float, default=nan
- tau
Scaling coefficient of the solution.
- Type:
float, default=0
- beta
Coefficient in Robin boundary conditions (to be defined for robin = 1).
- Type:
float, default=nan
- phi
Temporal correlation factor for first-order autoregressive process X_t = phi X_{t-1} + noise (|phi|<1 for stationary process, phi = 1 for random walk process).
- Type:
float, default=nan
- alpha
Exponent in PDE operator (default: 2.0, BiLaplacian covariance operator).
- Type:
float, default=2
- robin
Apply Robin boundary conditions (1 if applied and 0 for homogeneous Neumann boundary conditions).
- Type:
int, default=0
- seed
Seed for pseudorandom number generator (given seed if >=0 and random seed if <0).
- Type:
int, default=-1
- requested_outputs
Additional outputs requested (not implemented yet).
- Type:
list, default=[]
- __init__(self, other=None)
Initializes the sampling parameters, optionally inheriting from another instance.
- __repr__(self)
Returns a detailed string representation of the sampling parameters.
- __str__(self)
Returns a short string identifying the class.
- _process_outputs(self, md=None, return_default_outputs=False)
Process requested outputs, expanding ‘default’ to appropriate outputs.
- marshall_class(self, fid, prefix, md=None)
Marshall parameters to a binary file
Examples
md.sampling = pyissm.model.classes.sampling() md.sampling.kappa = 0.1 md.sampling.alpha = 2.0 md.sampling.phi = 0.9 md.sampling.robin = 1 md.sampling.beta = 0.5
- __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
__init__([other])Initialize the instance with optional field inheritance.
check_consistency(md, solution, analyses)Check consistency of the [sampling.sampling] parameters.
issm_enum_string()Default ISSM C++ enum string used during marshalling.
marshall_class(fid, prefix[, md])Marshall [sampling.sampling] parameters to a binary file.
- check_consistency(md, solution, analyses)
Check consistency of the [sampling.sampling] 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:
- marshall_class(fid, prefix, md=None)
Marshall [sampling.sampling] 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