validate

ccsdspy.utils.validate(file, valid_apids=None)[source]

Validate a file containing CCSDS packets and capturing any exceptions or warnings they generate. This function checks:

  • Primary header consistency (sequence counts in order, no missing sequence numbers, found APIDs)

  • File integrity (truncation, extra bytes)

Parameters:
file: `str | BytesIO`

A file path (str) or file-like object with a read() method.

valid_apids: `list[int]| None`, optional

Optional list of valid APIDs. If specified, warning will be issued when an APID is encountered outside this list.

Returns:
List of strings, each in the format “WarningType: message”, describing
potential validation issues. Returns an empty list if no warnings are issued.