[docs]
class conesPathNotFound(Exception):
"""
Exception raised when the files are not found
"""
def __init__(self, path):
self.path = path
super().__init__(f"CONES ERROR: '{path}' not found")
[docs]
class conesKalmanGainInversionError(Exception):
"""
Exception raised when the Kalman gain matrix inversion check exceeds tolerance,
indicating a poorly conditioned (S@S.T + R) matrix
"""
def __init__(self, value, tolerance):
self.value = value
self.tolerance = tolerance
super().__init__(f"CONES ERROR: Kalman gain inversion check ({value}) exceeds tolerance ({tolerance})")
[docs]
class conesEnsembleSizeError(Exception):
"""
Exception raised when an ensemble holds too few members for the anomaly
normalisation, which divides by sqrt(N - 1)
"""
def __init__(self, nens):
self.nens = nens
super().__init__(
f"CONES ERROR: the anomaly matrix needs at least 2 members, got {nens}. "
"For MFEnKF the principal and control member counts follow from nens and "
"the cores per model, so check the rank layout rather than conesDict"
)
[docs]
class obsNotInClippingsError(Exception):
"""
Exception raised when an observation is not included in the cell list of any region
"""
def __init__(self, obsID):
self.obsID = obsID
super().__init__(
f"CONES ERROR: observation {obsID} does not belong to any clipping. "
"Please check and re-run your topoSetDict"
)
[docs]
class conesAlgorithmMismatch(Exception):
"""
Exception raised when the filter named by the 'algorithm' keyword of
conesDict is not the one implemented by the driver that was launched.
Each side is valid on its own, so neither fails: they simply run
different message sequences and the job deadlocks on the first
collective that does not match.
"""
def __init__(self, declared, driver):
self.declared = declared
self.driver = driver
super().__init__(
f"CONES ERROR: conesDict declares algorithm '{declared}' but the "
f"driver that was launched implements '{driver}'. Launch "
f"main_{declared}.py, or set 'algorithm \"{driver}\";' in conesDict"
)