Converting objects and attributes to bytes¶
The way in which different objects are converted to DLIS-compliant bytes depends on the category these objects fall into, according to the earlier specified division.
Storage Unit Label has its own predefined bytes structure of fixed length. Its content varies minimally, taking into account the parameters specified at its creation, such as visible record length, storage set identifier, etc.
The main part of Frame Data (IFLR) - the numerical data associated with the Channels - is stored in the object as a row od a structured
numpy.ndarray
. Each entry of the array is converted to bytes using thenumpy
‘s built-intobytes()
method (with additionalbyteswap()
call before that to account for the big-endianness of DLIS). Additional bytes referring to the Frame and the index of the current Frame Data in the Frame are added on top.In No-Format Frame Data, the data part can be already expressed as bytes, in which case it is used as-is. Otherwise, it is assumed to be of string type and is encoded as ASCII. A reference to the parent No-Format object is added on top.
EFLR objects (EFLRSet and EFLRItem) are treated per
EFLRSet
instance.First, bytes describing the
EFLRSet
instance are made, including itsset_type
andset_name
(if present).Next, template bytes are added. These specify the order and names of
Attribute
s characterising theEFLRItem
instances belonging to the givenEFLRSet
.Finally, each of the
EFLRItem
‘s bytes are added. Bytes of anEFLRItem
instance consist of its name + origin reference + copy number description, followed by the values and other characteristics (units, repr. codes, etc.) of each of itsAttribute
s in the order specified in theEFLRSet
‘s template.