Package kenozooid :: Module logbook

Module logbook

source code

Dive logbook functionality.

Dive, dive site and buddy data display and management is implemented.

Functions
 
find_dive_nodes(files, nodes=None, dives=None)
Find dive nodes in UDDF files using optional numeric ranges or total dive number as search parameters.
source code
 
find_dive_gas_nodes(files, nodes=None)
Find gas nodes referenced by dives in UDDF files using optional node ranges as search parameter.
source code
 
find_dives(files, nodes=None, dives=None)
Find dive data in UDDF files using optional node ranges or total dive number as search parameters.
source code
 
list_dives(dives)
Get generator of preformatted dive data.
source code
 
add_dive(dive, lfile, qsite=None, qbuddies=())
Add new dive to logbook file.
source code
 
upgrade_file(fin)
Upgrade UDDF file to newer version.
source code
 
copy_dives(files, nodes, n_dives, lfile)
Copy dive nodes to logbook file.
source code
 
enum_dives(files, total=1)
Enumerate dives with day dive number (when UDDF 3.2 is introduced) and total dive number.
source code
Variables
  ichain = itertools.chain.from_iterable
  log = logging.getLogger('kenozooid.logbook')
Function Details

find_dive_nodes(files, nodes=None, dives=None)

source code 

Find dive nodes in UDDF files using optional numeric ranges or total
dive number as search parameters.

The collection of dive nodes is returned.

:Parameters:
 files
    Collection of UDDF files.
 nodes
    Numeric ranges of nodes, `None` if all nodes.
 dives
    Numeric range of total dive number, `None` if any dive.

.. seealso:: :py:func:`parse_range`
.. seealso:: :py:func:`find_dives`

find_dive_gas_nodes(files, nodes=None)

source code 

Find gas nodes referenced by dives in UDDF files using optional node
ranges as search parameter.

The collection of gas nodes is returned.

:Parameters:
 files
    Collection of UDDF files.
 nodes
    Numeric ranges of nodes, `None` if all nodes.

.. seealso:: :py:func:`parse_range`

find_dives(files, nodes=None, dives=None)

source code 

Find dive data in UDDF files using optional node ranges or total dive
number as search parameters.

The collection of dive data is returned.

:Parameters:
 files
    Collection of UDDF files.
 nodes
    Numeric ranges of nodes, `None` if all nodes.
 dives
    Numeric range of total dive number, `None` if any dive.

.. seealso:: :py:func:`parse_range`
.. seealso:: :py:func:`find_dive_nodes`

list_dives(dives)

source code 

Get generator of preformatted dive data.

The dives are fetched from logbook file and for each dive a tuple of formatted dive information is returned

  • dive number, i.e. 102
  • date and time of dive, i.e. 2011-03-19 14:56
  • maximum depth, i.e. 6.0m
  • dive average depth, i.e. 2.0m
  • duration of dive, i.e. 33:42
  • temperature, i.e. 8.2°C
Parameters:
  • dives - Collection of dive data.

add_dive(dive, lfile, qsite=None, qbuddies=())

source code 

Add new dive to logbook file.

The logbook file is created if it does not exist.

If dive number is specified and dive cannot be found then ValueError exception is thrown.

Parameters:
  • dive - Dive data.
  • lfile - Logbook file.
  • qsite - Dive site search term.
  • qbuddies - Buddy search terms.

upgrade_file(fin)

source code 
Upgrade UDDF file to newer version.
Parameters:
  • fin - File with UDDF data to upgrade.

copy_dives(files, nodes, n_dives, lfile)

source code 

Copy dive nodes to logbook file.

The logbook file is created if it does not exist.

Parameters:
  • files - Collection of files.
  • nodes - Collection of dive ranges.
  • n_dives - Numeric range of total dive number, None if any dive.
  • lfile - Logbook file.

enum_dives(files, total=1)

source code 
Enumerate dives with day dive number (when UDDF 3.2 is introduced) and total dive number.
Parameters:
  • files - Collection of UDDF files having dives to enumerate.
  • total - Start of total dive number.