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


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.

  • 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.


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'.

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