bronx.datagrip.varbcheaders

Utility class to read the headers of a VarBC files.

Classes

class bronx.datagrip.varbcheaders.VarbcHeadersFile(varbclines)[source]

Bases: Mapping

Class to handle the headers of a VarBC file.

By headers, we mean the first 3 lines that contain informations about the file’s version, date, experiment number (expver) and size (e.g. the number of entries in the file).

This object behaves like a Mapping:

>>> print(VarbcHeadersFile.DOCTEST_DATA)
VARBC_cycle.version006
MINI  20200101         0
        11     10980
other stuff...
>>> vbch = VarbcHeadersFile(VarbcHeadersFile.DOCTEST_DATA.split("\n"))
>>> len(vbch)
4
>>> set(vbch) == set(['version', 'date', 'nentries', 'expver'])
True
>>> vbch['version']
6
>>> vbch['nentries']
11
Parameters:

varbclines – Iterable over lines read from a VarBC file. Note: Only the first 3 lines of the VarBC file will be used.