kipe.measurements.models module
Measurement models: from the sampled fields to predicted data, and their comparison.
A MeasurementModel predicts the measured data from the sampled state,
\(\hat{z} = M(y)\), and compares them with the measured data, giving the innovation
\(\Gamma(z, \hat{z})\). Models act on arrays only, so they are the same for every backend.
- class kipe.measurements.models.MeasurementModel[source]
Bases:
ABCTurns sampled model fields into predicted data and compares them with the measurement.
- gather_input: ClassVar[bool] = False
Request a complete globally ordered input and prediction on root only.
False selects rank-local input and prediction.
- clear_prediction() None[source]
Leave prediction state unchanged.
This default implementation does nothing. Overrides must clear only transient prediction results, retain persistent history and perform no MPI collectives.
- abstractmethod predict(y: NDArray_f64) NDArray_f64[source]
Predict the measured data from the sampled state, \(\hat{z} = M(y)\).
- Parameters:
y – sampled state \(y\)
- Returns:
predicted entries \(\hat{z}\), at the positions
layout()gives; globally gathered models return the complete output on root
- abstractmethod innovation(z_hat: NDArray_f64, z: NDArray_f64) NDArray_f64[source]
Compare predicted and measured data, \(\Gamma(z, \hat{z})\).
- Parameters:
z_hat – predicted data \(\hat{z}\), as returned by
predict()z – measured data at the current assimilation time, in the measurement space
- Returns:
innovation, before weighting with the measurement noise
- layout(sampler: SpatialSampler) tuple[int, NDArray_i64][source]
Return the size of the predicted data, and the positions of this rank’s entries.
Return the sampler’s global size and this rank’s sampled-entry indices unchanged.
- Parameters:
sampler – the measurement’s spatial sampler
- Returns:
the number of entries of the predicted data, over all ranks
the positions of this rank’s entries, in the order
predict()returns them
- class kipe.measurements.models.DifferenceModel[source]
Bases:
MeasurementModelThe measured data are the sampled fields: \(\hat{z} = y\), and the innovation is \(\Gamma = z - \hat{z}\).
- kipe.measurements.models.build_model(options: MeasurementModelOptions) MeasurementModel[source]
Construct the measurement model given by the
modeloptions of a measurement.- Parameters:
options –
modeloptions of the measurement- Returns:
the measurement model