NASA Logo
Ocean Color Science Software

ocssw V2022
Inheritance diagram for VariableLength:
[legend]
Collaboration diagram for VariableLength:
[legend]

Public Member Functions

def __init__ (self, fields)
 
def load (self, file, include_primary_header=False)
 
- Public Member Functions inherited from _BasePacket
def from_file (cls, file)
 
def add_converted_field (self, input_field_name, output_field_name, converter)
 

Detailed Description

Define a variable length packet to decode binary data.

Variable length packets are packets which have a different length each
time.  Variable length fields are defined as `~ccsdspy.PacketArray` fields
where `array_shape="expand"` (causing the field to grow to fill the packet) or
`array_shape="other_field"` (causes the field named `other_field` to set the number
of elements in this array).

Please note that while this class is able to parse fixed length packets, it
is much slower. Use the :py:class:`~ccsdspy.FixedLength` class instead.

Rules for variable length packets:
  * Do only specify a `~ccsdspy.PacketArray` with the `array_shape="other_field"`
    when `other_field` precedes it in the packet definition
  * Do not provide more than one expanding `~ccsdspy.PacketArray` with `array_shape="expand"`
  * Do not specify the primary header fields manually
  * Do not specify explicit bit_offsets (they will be computed automatically)

Definition at line 186 of file packet_types.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  fields 
)
Parameters
----------
fields : list of :py:class:`~ccsdspy.PacketField` or :py:class:`~ccsdspy.PacketArray`
    Layout of packet fields contained in the definition. No more than
    one field should have array_shape="expand". The field must have no
    bit_offset's. Do not include the primary header fields.

Raises
------
ValueError
    one or more of the arguments are invalid, or do not follow the
    specified rules.

Definition at line 206 of file packet_types.py.

Member Function Documentation

◆ load()

def load (   self,
  file,
  include_primary_header = False 
)
Decode a file-like object containing a sequence of these packets.

Parameters
----------
file : str
   Path to file on the local file system, or file-like object
include_primary_header : bool
   If True, provides the primary header in the output

Returns
-------
field_arrays : dict, string to NumPy array
    dictionary mapping field names to NumPy arrays, with key order matching
    the order of fields in the packet.

Warns
-----
UserWarning
    If the ccsds sequence count is not in order
UserWarning
    If the ccsds sequence count is missing packets
UserWarning
    If there are more than one APID

Definition at line 262 of file packet_types.py.


The documentation for this class was generated from the following file:
  • /gfs-oceanweb/web/ocssw/ocssw_src/src/scripts/telemetry/ccsdspy/packet_types.py