pyissm.model.classes.cf
cf classes for ISSM.
Classes
|
Level-set misfit response definition class for ISSM. |
|
Surface log-velocity misfit response definition class for ISSM. |
|
Surface-square cost-function (response) definition class for ISSM. |
|
Transient surface-square misfit response definition class for ISSM. |
- class pyissm.model.classes.cf.levelsetmisfit(other=None)
Bases:
manage_stateLevel-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
otherdiffer 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 allowsOutputdefinition1..``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.ndarrayorfloat
- 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.ndarrayorfloat
- 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:
- 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_stateSurface 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
otherdiffer 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 allowsOutputdefinition1..``Outputdefinition2000``.- Type:
str
- vxobs
Observed x-velocity component. MATLAB marshals this as a DoubleMat time series with
timeserieslength = nv + 1and applies a scale of1 / yts. Default is NaN (unset).- Type:
numpy.ndarrayorfloat
- 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.ndarrayorfloat
- 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.ndarrayorfloat
- 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(notvyobs) during extrusion. For strict parity, we replicate that behavior here. If you prefer symmetry, you can project bothvxobsandvyobs.vxobsandvyobsare written with ascale = 1/ytsin 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:
- 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_stateSurface-square cost-function (response) definition class for ISSM.
Python/pyISSM equivalent of ISSM MATLAB’s
cfsurfacesquareclass. 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
otherdiffer 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.ndarrayorfloat
- observation_string
Name/identifier for the observation dataset.
- Type:
str
- weights
Per-vertex weights (or timeseries weights). Default is NaN (unset).
- Type:
numpy.ndarrayorfloat
- 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:
- 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_stateTransient 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 withtimeserieslength = numberofvertices + 1andytsconversion.- 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.
- name
Identifier for this response definition.
- Type:
str
- definitionstring
Unique output definition identifier, typically
"OutputdefinitionN". MATLAB allowsOutputdefinition1..``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.ndarrayorfloat
- weights
Weights applied to the misfit, typically a time-series array with the same convention as
observations. Default is NaN (unset).- Type:
numpy.ndarrayorfloat
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:
- 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