Object-oriented Python is used throughout. Following sections discuss some of the more important class hierarchies.
The various data compilers such as iband8 are quite similar, with only minor variations in data formats. The overall flow is the same:
Read the appropriate authority files to establish the set of valid species and station codes.
Read a sequence of lines from the raw file.
If a line is a sheet header or band prefix line, save the information for the next encounter line.
When an encounter line is read, combine it with the previously saved sheet header and prefix line information to build and write an output record.
The design problem, then, is to unify the parts that are the same, and allow for the parts that are different, such as the various input file and authority file formats.
The principles of object-oriented design suggest the
application of inheritance here. We start with an abstract
BaseCompiler, that performs the
common operations such as reading and classifying lines.
This class also contains utility functions used by the
Then, each data compiler uses a class derived from that base class, and contains logic specific to that particular compiler.
For the details, see Section 19, “
class BaseCompiler: Base class for
banding data compilers”.