ccsds_ndm.ndm_kvn_io

CCSDS Navigation Data Messages KVN File I/O.

Classes

NdmKvnIo()

KVN read/write facade for CCSDS Navigation Data Messages.

class NdmKvnIo[source]

KVN read/write facade for CCSDS Navigation Data Messages.

Delegates the heavy lifting to the pipeline in ccsds_ndm.kvn_utils_tokenizer and ccsds_ndm.kvn_utils_parser (tokenise → block-split) and then constructs the appropriate xsdata dataclass tree.

from_path(kvn_read_file_path)[source]

Read a KVN file and return the corresponding NDM object tree.

Reads the file as plain text and forwards the content to from_string().

Parameters:

kvn_read_file_path (Path or str) – Path to the KVN input file.

Returns:

object – Root xsdata dataclass instance for the detected NDM type (e.g. OpmType, OemType, ApmType, …).

from_string(kvn_source)[source]

Parse a KVN string and return the corresponding NDM object tree.

Runs the three-step pipeline described in the module docstring:

  1. tokenize() classifies each line into a KvnLine subclass.

  2. parse_blocks() groups the tokens into a KvnDocument with the NDM type resolved from the CCSDS_*_VERS header line.

  3. The KvnDocument is mapped onto the xsdata dataclass tree for the identified NDM type.

Parameters:

kvn_source (str) – Raw KVN text (Windows or Unix line endings accepted).

Returns:

object – Root xsdata dataclass instance for the detected NDM type (e.g. OpmType, OemType, ApmType, …).

to_file(ndm_obj, kvn_write_file_path)[source]

Serialise an xsdata NDM object tree and write it to a KVN file.

Parameters:
  • ndm_obj (object) – Root xsdata dataclass instance (e.g. Opm, Oem, …).

  • kvn_write_file_path (Path or str) – Destination file path.

Return type:

None

to_string(ndm_obj)[source]

Serialise an xsdata NDM object tree to a KVN string.

Parameters:

ndm_obj (object) – Root xsdata dataclass instance (e.g. Opm, Oem, …).

Returns:

str – The NDM data formatted as a KVN string.

Raises:

NotImplementedError – Combined NDM input for KVN not implemented in CCSDS NDM Standard.

Return type:

str