Skip to content

bgc_data_processing.exceptions

Specific exceptions.

VariableInstantiationError

Bases: Exception

Exception class to raise when instantiating variables.

IncorrectVariableNameError

Bases: Exception

Exception raised when trying to access a variable using an incorrect name.

DuplicatedVariableNameError

Bases: Exception

Exception raised when trying to add a variable with an already used name.

IncompatibleVariableSetsError

Bases: Exception

Exception raised when performing operation on incompatible variable sets.

FeatureConstructionError

Bases: Exception

Exception raised when unsuccessfully trying to build a feature.

CSVLoadingError

Bases: Exception

Exception class to raise when loading CSV files.

NetCDFLoadingError

Bases: Exception

Exception class to raise when loading NetCDF files.

ABFileLoadingError

Bases: Exception

Exception class to raise when loading NetCDF files.

UnsupportedLoadingFormatError(file_format)

Bases: Exception

Exception raised when trying to load data with unsupported format.

Source code in src/bgc_data_processing/exceptions.py
43
44
45
def __init__(self, file_format: str) -> None:
    error_msg = f"File format: {file_format} can not be loaded."
    super().__init__(error_msg)

IncompatibleCategoriesError

Bases: Exception

Exception raised when performing operation on incompatible data categories.

DifferentSliceOriginError

Bases: Exception

Exception raised when performing operation ons torers with differents storers.

IncomparableStorersError

Bases: Exception

Exception raised when storers with uncomparable properties are compared.

ImpossibleSaveError

Bases: Exception

Exception raised when it is impossible to save a Storer.

ImpossibleTypeParsingError(keys, filepath)

Bases: Exception

Exception raised when a TOML parser can not access to a variable's type.

Source code in src/bgc_data_processing/exceptions.py
69
70
71
def __init__(self, keys: list[str], filepath: Path | str) -> None:
    error_msg = f"Type of {'.'.join(keys)} can't be parsed from {filepath}"
    super().__init__(error_msg)

InvalidParameterKeyError(keys, filepath)

Bases: Exception

Exception raised when accessing a parsed parameter using an incorrect name.

Source code in src/bgc_data_processing/exceptions.py
77
78
79
def __init__(self, keys: list[str], filepath: Path | str) -> None:
    error_msg = f"Variable {'.'.join(keys)} does not exist in {filepath}"
    super().__init__(error_msg)

IncompatibleMaskShapeError(correct_shape, incorrect_shape)

Bases: Exception

Exception raised when a Mask with an incorrect shape is trying to be set.

Source code in src/bgc_data_processing/exceptions.py
86
87
88
89
90
91
def __init__(self, correct_shape: tuple, incorrect_shape: tuple) -> None:
    error_msg = (
        f"Mask shape should be {correct_shape}. "
        f"Given mask shape is {incorrect_shape}."
    )
    super().__init__(error_msg)

InvalidDateInputsError

Bases: Exception

Exception raised when a DateIntervalPattern is set with invalid dates.

InvalidPrecisionError

Bases: Exception

Exception raised when a DateIntervalPattern is set with invalid precision.