hydro.exchange.exceptions ========================= .. py:module:: hydro.exchange.exceptions Exceptions ---------- .. autoapisummary:: hydro.exchange.exceptions.ExchangeError hydro.exchange.exceptions.ExchangeEncodingError hydro.exchange.exceptions.ExchangeBOMError hydro.exchange.exceptions.ExchangeLEError hydro.exchange.exceptions.ExchangeMagicNumberError hydro.exchange.exceptions.ExchangeEndDataError hydro.exchange.exceptions.ExchangeParameterError hydro.exchange.exceptions.ExchangeParameterUndefError hydro.exchange.exceptions.ExchangeParameterUnitAlignmentError hydro.exchange.exceptions.ExchangeDuplicateParameterError hydro.exchange.exceptions.ExchangeOrphanFlagError hydro.exchange.exceptions.ExchangeOrphanErrorError hydro.exchange.exceptions.ExchangeFlaglessParameterError hydro.exchange.exceptions.ExchangeFlagUnitError hydro.exchange.exceptions.ExchangeDataError hydro.exchange.exceptions.ExchangeDataColumnAlignmentError hydro.exchange.exceptions.ExchangeDataFlagPairError hydro.exchange.exceptions.ExchangeDataPartialKeyError hydro.exchange.exceptions.ExchangeDuplicateKeyError hydro.exchange.exceptions.ExchangeDataPartialCoordinateError hydro.exchange.exceptions.ExchangeDataInconsistentCoordinateError hydro.exchange.exceptions.ExchangeInconsistentMergeType hydro.exchange.exceptions.ExchangeRecursiveZip Module Contents --------------- .. py:exception:: ExchangeError Bases: :py:obj:`ValueError` This is the base exception which all the other exceptions derive from. It is a subclass of ValueError. .. py:exception:: ExchangeEncodingError Bases: :py:obj:`ExchangeError` Error raised when the bytes for some exchange file cannot be decoded as UTF-8. .. py:exception:: ExchangeBOMError Bases: :py:obj:`ExchangeError` Error raised when the exchange file has a byte order mark. .. py:exception:: ExchangeLEError Bases: :py:obj:`ExchangeError` Error raised when the exchange file does not have the correct line endings. .. py:exception:: ExchangeMagicNumberError Bases: :py:obj:`ExchangeError` Error raised when the exchange file does not start with ``BOTTLE`` or ``CTD``. .. py:exception:: ExchangeEndDataError Bases: :py:obj:`ExchangeError` Erorr raised when ``END_DATA`` cannot be found in the exchange file. .. py:exception:: ExchangeParameterError Bases: :py:obj:`ExchangeError` Base exception for errors related to parameters and units. .. py:exception:: ExchangeParameterUndefError(error_data) Bases: :py:obj:`ExchangeParameterError` Error raised when the library does not have a definition for a parameter/unit pair in the exchange file. .. py:attribute:: error_data .. py:exception:: ExchangeParameterUnitAlignmentError Bases: :py:obj:`ExchangeParameterError` Error raised when there is a mismatch between the number of parameters and number of units in the exchange file. .. py:exception:: ExchangeDuplicateParameterError Bases: :py:obj:`ExchangeParameterError` Error raised when the same parameter/unit pair occurs more than once in the excahnge file. .. py:exception:: ExchangeOrphanFlagError Bases: :py:obj:`ExchangeParameterError` Error raised when there exists a flag column with no corresponding parameter column. .. py:exception:: ExchangeOrphanErrorError Bases: :py:obj:`ExchangeParameterError` Error raised when there exists an error column with no corresponding parameter column. .. py:exception:: ExchangeFlaglessParameterError Bases: :py:obj:`ExchangeParameterError` Error raised when a parameter has a flag column when it is not supposed to. .. py:exception:: ExchangeFlagUnitError Bases: :py:obj:`ExchangeParameterError` Error raised if a flag column has a non empty units. .. py:exception:: ExchangeDataError Bases: :py:obj:`ExchangeError` Base exception for errors which occur when parsing the data porition of an exchange file. .. py:exception:: ExchangeDataColumnAlignmentError Bases: :py:obj:`ExchangeDataError` Error raised when the number of columns in a data line does not match the expected number of columns based on the parameter/unit lines. .. py:exception:: ExchangeDataFlagPairError(error_data) Bases: :py:obj:`ExchangeDataError` There is a mismatch between what the flag value expects, and the fill/data value. Examples -------- * something with a flag of ``9`` has a non fill value * something with a flag of ``2`` as a fill value instead of data .. py:attribute:: error_data .. py:exception:: ExchangeDataPartialKeyError Bases: :py:obj:`ExchangeDataError` Error raised when there is no value for one (or more) of the following parameters. * EXPOCODE * STNNBR * CASTNO * SAMPNO (only for bottle files) * CTDPRS (only for CTD files) These form the "composite key" which uniquely identify the "row" of exchange data. .. py:exception:: ExchangeDuplicateKeyError Bases: :py:obj:`ExchangeDataError` Error raised when there is a duplicate composite key in the exchange file. This would occur if the exact values for the following parameters occur in more than one data row: * EXPOCODE * STNNBR * CASTNO * SAMPNO (only for bottle files) * CTDPRS (only for CTD files) .. py:exception:: ExchangeDataPartialCoordinateError Bases: :py:obj:`ExchangeDataError` Error raised if values for latitude, longitude, or pressure are missing. It is OK by the standard to omit the time of day. .. py:exception:: ExchangeDataInconsistentCoordinateError Bases: :py:obj:`ExchangeDataError` Error raised if the reported latitude, longitude, and date (and time) vary for a single profile. A "profile" in an exchange file is a grouping of data rows which all have the same EXPOCODE, STNNBR, and CASTNO. The SAMPNO/CTDPRS is allowed/requried to vary for a single profile and is what identifies samples within one profile. .. py:exception:: ExchangeInconsistentMergeType Bases: :py:obj:`ExchangeError` Error raised when the merge_ex method is called on mixed ctd and bottle exchange types. .. py:exception:: ExchangeRecursiveZip Bases: :py:obj:`ExchangeError` Error raised if there are zip files inside the zip file that read exchange is trying to read.