pyissm.model.classes.cf

cf classes for ISSM.

Classes

levelsetmisfit([other])

Level-set misfit response definition class for ISSM.

surfacelogvel([other])

Surface log-velocity misfit response definition class for ISSM.

surfacesquare([other])

Surface-square cost-function (response) definition class for ISSM.

surfacesquaretransient([other])

Transient surface-square misfit response definition class for ISSM.

class pyissm.model.classes.cf.levelsetmisfit(other=None)

Bases: manage_state

Level-set misfit response definition class for ISSM.

This response is commonly used to measure misfit between a modeled level-set field (e.g. calving-front / ice-mask level set) and an observed level-set field. It supports optional per-vertex weights and an associated data time (years from start) indicating when the observation applies.

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.

name

Identifier for this response definition.

Type:

str

definitionstring

Unique output definition identifier, typically "OutputdefinitionN". MATLAB allows Outputdefinition1..``Outputdefinition2000``.

Type:

str

model_string

String key for the modeled field to be compared. Example: "MaskIceLevelset".

Type:

str

observation

Observed field to compare against (often in ISSM time-series format). Written as a DoubleMat time series with timeserieslength = nv + 1. Default is NaN (unset).

Type:

numpy.ndarray or float

observation_string

Identifier/name for the observation dataset.

Type:

str

weights

Weight coefficients (per-vertex, often time-series formatted). Written as a DoubleMat time series with timeserieslength = nv + 1. Default is NaN (unset).

Type:

numpy.ndarray or float

weights_string

Identifier/name for the weights dataset.

Type:

str

datatime

Time in years from start associated with the data. MATLAB writes this as round(datatime * yts) to the binary file.

Type:

float

Examples

>>> cf = cflevelsetmisfit()
>>> cf.name = "CalvingFrontPosition"
>>> cf.definitionstring = "Outputdefinition1"
>>> cf.model_string = "MaskIceLevelset"
>>> cf.observation_string = "LevelsetObservations"
>>> cf.observation = md.mask.ice_levelset
>>> cf.weights = np.ones(md.mesh.numberofvertices, )
>>> cf.weights_string = "WeightsLevelsetObservations"
>>> cf.datatime = time
>>> md.outputdefinition.definitions.append(cf)
check_consistency(md, solution=None, analyses=None)

Check consistency of the [cf.levelsetmisfit] 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:

pyissm.model.Model

classmethod issm_enum_string()

Default ISSM C++ enum string used during marshalling.

Historical behavior for outputdefinition was to capitalize the Python class name (e.g., ‘surfacesquare’ -> ‘Surfacesquare’). Subclasses can override this when ISSM expects a different enum string (e.g., ‘Cfsurfacesquare’).

Return type:

str

marshall_class(fid, prefix, md=None)

Marshall [cf.levelsetmisfit] 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 (pyissm.model.Model, optional) – ISSM model object needed in some cases.

Return type:

None

class pyissm.model.classes.cf.surfacelogvel(other=None)

Bases: manage_state

Surface log-velocity misfit response definition class for ISSM.

This response is typically used in transient inversions/calibration workflows where the misfit compares the logarithm of surface speed implied by modeled surface velocities against observed surface velocities, with optional per-vertex weights and an associated observation time.

The class stores:
  • observed Vx and Vy (often in ISSM time-series format)

  • optional strings identifying those observations

  • per-vertex weights (also often a time series)

  • a datatime (years from start) telling ISSM which time the data corresponds to

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.

name

Identifier for this response definition.

Type:

str

definitionstring

Unique output definition identifier, typically "OutputdefinitionN". MATLAB allows Outputdefinition1..``Outputdefinition2000``.

Type:

str

vxobs

Observed x-velocity component. MATLAB marshals this as a DoubleMat time series with timeserieslength = nv + 1 and applies a scale of 1 / yts. Default is NaN (unset).

Type:

numpy.ndarray or float

vxobs_string

Identifier/name for the observed x-velocity dataset.

Type:

str

vyobs

Observed y-velocity component. Same marshalling conventions as vxobs. Default is NaN (unset).

Type:

numpy.ndarray or float

vyobs_string

Identifier/name for the observed y-velocity dataset.

Type:

str

weights

Weight coefficients (typically per-vertex, often time-series formatted). Default is NaN (unset).

Type:

numpy.ndarray or float

weights_string

Identifier/name for the weights dataset.

Type:

str

datatime

Time in years from start associated with the data. MATLAB writes this as round(datatime * yts) to the binary file.

Type:

float

Notes

  • The MATLAB implementation only explicitly projects vxobs (not vyobs) during extrusion. For strict parity, we replicate that behavior here. If you prefer symmetry, you can project both vxobs and vyobs.

  • vxobs and vyobs are written with a scale = 1/yts in MATLAB, matching ISSM’s internal unit conventions (m/s vs m/yr).

check_consistency(md, solution, analyses)

Check consistency of the [cf.surfacelogvel] 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:

pyissm.model.Model

classmethod issm_enum_string()

Default ISSM C++ enum string used during marshalling.

Historical behavior for outputdefinition was to capitalize the Python class name (e.g., ‘surfacesquare’ -> ‘Surfacesquare’). Subclasses can override this when ISSM expects a different enum string (e.g., ‘Cfsurfacesquare’).

Return type:

str

marshall_class(fid, prefix, md=None)

Marshall [cf.surfacelogvel] 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 (pyissm.model.Model, optional) – ISSM model object needed in some cases.

Return type:

None

class pyissm.model.classes.cf.surfacesquare(other=None)

Bases: manage_state

Surface-square cost-function (response) definition class for ISSM.

Python/pyISSM equivalent of ISSM MATLAB’s cfsurfacesquare class. This response is typically used to compare a modeled surface (or base) field against observed data with per-vertex weights, optionally as a time series.

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.

name

Identifier for this response definition.

Type:

str

definitionstring

Unique output definition identifier, typically "OutputdefinitionN".

Type:

str

surfaceid

Which surface to evaluate: - 1: surface - 2: base

Type:

int

model_string

Name of the modeled field to compare (string key used by ISSM).

Type:

str

observation

Observed field to compare against. May be provided as a time series in ISSM “timeseries” format (length = numberofvertices + 1). Default is NaN (unset).

Type:

numpy.ndarray or float

observation_string

Name/identifier for the observation dataset.

Type:

str

weights

Per-vertex weights (or timeseries weights). Default is NaN (unset).

Type:

numpy.ndarray or float

weights_string

Name/identifier for the weights dataset.

Type:

str

datatime

Time in years from start associated with the data (used to pick the comparison time). Default is 0.0.

Type:

float

check_consistency(md, solution, analyses)

Check consistency of the [cf.surfacesquare] 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:

pyissm.model.Model

classmethod issm_enum_string()

Default ISSM C++ enum string used during marshalling.

Historical behavior for outputdefinition was to capitalize the Python class name (e.g., ‘surfacesquare’ -> ‘Surfacesquare’). Subclasses can override this when ISSM expects a different enum string (e.g., ‘Cfsurfacesquare’).

Return type:

str

marshall_class(fid, prefix, md=None)

Marshall [cf.surfacesquare] 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 (pyissm.model.Model, optional) – ISSM model object needed in some cases.

Return type:

None

class pyissm.model.classes.cf.surfacesquaretransient(other=None)

Bases: manage_state

Transient surface-square misfit response definition class for ISSM.

This response compares a modeled field (given by model_string) against a set of time-series observations using a squared-misfit form, with optional per-vertex weights. In ISSM convention, transient time series are typically stored in a matrix/vector with a time row/column included, and are marshalled with timeserieslength = numberofvertices + 1 and yts conversion.

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.

name

Identifier for this response definition.

Type:

str

definitionstring

Unique output definition identifier, typically "OutputdefinitionN". MATLAB allows Outputdefinition1..``Outputdefinition2000``.

Type:

str

model_string

Name of the modeled field to compare (string key used by ISSM). Example: "Surface", "Vx", "Vy".

Type:

str

observations

Observed time series to compare against. By MATLAB convention this is a time-series array marshalled with timeserieslength = nv + 1. Default is NaN (unset).

Type:

numpy.ndarray or float

weights

Weights applied to the misfit, typically a time-series array with the same convention as observations. Default is NaN (unset).

Type:

numpy.ndarray or float

Examples

>>> cf = surfacesquaretransient()
>>> cf.name = "SurfaceAltimetry"
>>> cf.definitionstring = "Outputdefinition1"
>>> cf.model_string = "Surface"
>>> cf.observations = np.vstack([md.geometry.surface, [0.0]])  # example
>>> cf.weights = np.ones((md.mesh.numberofvertices + 1, 1))
>>> md.outputdefinition.definitions.append(cf)
check_consistency(md, solution, analyses)

Check consistency of the [cf.surfacesquaretransient] 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:

pyissm.model.Model

classmethod issm_enum_string()

Default ISSM C++ enum string used during marshalling.

Historical behavior for outputdefinition was to capitalize the Python class name (e.g., ‘surfacesquare’ -> ‘Surfacesquare’). Subclasses can override this when ISSM expects a different enum string (e.g., ‘Cfsurfacesquare’).

Return type:

str

marshall_class(fid, prefix, md=None)

Marshall [cf.surfacesquaretransient] 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 (pyissm.model.Model, optional) – ISSM model object needed in some cases.

Return type:

None