Utility functions

The package has some more miscellaneous functions and utilities that are made publically available.

The functions are defined in deltametrics.utils.

Utility functions

deltametrics.utils._get_version()

Extract version number from single file, and make it availabe everywhere.

Utility Exceptions and Warnings

exception deltametrics.utils.NoStratigraphyError(obj, var=None)

Error message for access when no stratigraphy.

Parameters
  • obj (str) – Which object user tried to access.

  • var (str, optional) – Which variable user tried to access. If provided, more information is given in the error message.

Examples

Without the optional var argument:

>>> raise utils.NoStratigraphyError(rcm8cube) 
deltametrics.utils.NoStratigraphyError: 'DataCube' object
has no preservation or stratigraphy information.

With the var argument given as 'strat_attr':

>>> raise utils.NoStratigraphyError(rcm8cube, 'strat_attr') 
deltametrics.utils.NoStratigraphyError: 'DataCube' object
has no attribute 'strat_attr'.
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.