Skip to main content

CCSDS-NDM

Project description

CCSDS-NDM CircleCI Status CCSDS-NDM Codecov Status Documentation Status DOI

Description

The Consultative Committee for Space Data Systems (CCSDS) develops communications and data systems standards for spaceflight. CCSDS Navigation Data Messages (NDM) is the set of file standards to define common data types such as trajectory, orbit, attitude and conjunction events. These data types are routinely generated and exchanged within and between spacecraft operators, space agencies, researchers, amateurs and commercial companies. As such, accurate definition and common interpretation of the data is crucial (and sometimes mission-critical).

The standard description for each data type is encapsulated in an XML Schema file. This project ccsds-ndm aims to be the reference open-source Python implementation to read and write the NDM XML and KVN files, through an object tree API, auto-generated by these schema files. It supports the up-to-date NDM XML 2.0.0 standard.

The source code is on Github and the documentation is on Readthedocs.

Current functionality:

Read

Write

XML

All NDM Types

All NDM Types

KVN

All except NDM Combined Instantiation

All except NDM Combined Instantiation

JSON

Not specified in CCSDS Standards

Not specified in CCSDS Standards

Usage and Examples

There are two use cases:

  • The ccsds-ndm library reads the NDM file, fills an object tree and offers it to the users. The users will then have to fill their own attitude, orbit or trajectory objects used in their libraries.

  • The user fills an object tree from their own attitude, orbit or trajectory object. The ccsds-ndm library writes the NDM file using this object tree.

For the first use case, reading an OEM file from xml_read_path is as simple as:

>>> cdm = NdmIo().from_path(xml_read_path)

Note that file format (XML or KVN) and data type (e.g. CDM or NDM) are inferred automatically. The output cdm is the object tree for a Conjunction Data Message (CDM). The contents can then be reached going deeper in the object tree as specified in the corresponding NDM Standard. This example shows how to reach the orbit normal position component of the relative state vector:

>>> print(cdm.body.relative_metadata_data.relative_state_vector.relative_position_n)

The data can sometimes be of type NDM Combined Instantiation. This means that there are multiple NDM data bodies (e.g. 2 AEMs, 3 OEMs and one OMM) within a single file. The file reader supports these types as well and they are kept within the Ndm object as individual lists for each of the file types. The following example retrieves the second Omm object in the NDM file and then continues to dive deeper into the object tree to retrieve the eccentricity value.

>>> print(ndm.omm[1].body.segment.data.mean_elements.eccentricity)

If the file is of the type NDM Combined Instantiation but there is only a single data (e.g. OMM) in it, the ndm tags are stripped and only the single data is presented to the user.

Filling the objects with data properly requires some care. As the standard is understandably strict, the object tree derived from the XSD files are also rather exacting in how they accept data. The recommended way to fill the objects is with value and unit information:

>>> # This is the proper way to write data into the object
>>> cdm.body.relative_metadata_data.relative_state_vector.relative_position_t = LengthType(Decimal(800), LengthUnits.M)

Finally, once filled with the relevant data, the cdm object can be written to xml_write_path in XML data format as:

>>> NdmIo().to_file(cdm, NDMFileFormats.XML, xml_write_path)

The ndm object trees are not very user friendly and most probably will have to be filled by the users’ own equivalent objects (trajectory, orbit, attitude etc.).

Installing ccsds-ndm

The ccsds-ndm package is on PyPI and you can install it simply by running:

pip install ccsds_ndm

You can also install it via conda-forge:

conda install -c conda-forge ccsds_ndm

Do not install ccsds-ndm using sudo.

More Information Regarding the CCSDS-NDM

The top-level description of the standard is given in the Navigation Data — Definitions and Conventions Green Book and Navigation Data Messages Overview Green Book. Individual data types are defined in their individual definitions (e.g. Conjunction Data Message and Orbit Data Message). The centre for all the standards are CCSDS Mission Operations and Information Management Services Area.

The Schema files are found in the SANA Registry.

Design and Limitations

The object tree is created by xsdata library, which also handles parsing and writing of the XML data. As such, there is no documentation generated for this object tree.

File read is usually fast (on the order of seconds) for small files. That said, KVN parsing for large files can take some time. A 12 MB OEM file lasts about a minute to parse on a good consumer grade computer. Due to the fragility of the KVN format and the restrictions the standards put on the order of keys, no parallelization has been attempted.

Requirements

  • xsData is used to read and write XML files (and also to generate the object tree)

  • lxml to support XML object creation

Citation

Please use the DOI for citations. This is the latest version:

DOI

License

This project is Copyright (c) Egemen Imre and licensed under the terms of the GNU GPL v3+ license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccsds_ndm-2.2.tar.gz (115.1 kB view details)

Uploaded Source

Built Distribution

ccsds_ndm-2.2-py2.py3-none-any.whl (132.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ccsds_ndm-2.2.tar.gz.

File metadata

  • Download URL: ccsds_ndm-2.2.tar.gz
  • Upload date:
  • Size: 115.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for ccsds_ndm-2.2.tar.gz
Algorithm Hash digest
SHA256 2a604318dd4cdb1b5d151c2594831336c4017e66ff2d035cc544bed2492d6028
MD5 57c9b47159b0bf277140097237673902
BLAKE2b-256 d1b37cfbe12e7a7966b23a904e60e2d6eb4c86359e75e27211d956e2354589f0

See more details on using hashes here.

File details

Details for the file ccsds_ndm-2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: ccsds_ndm-2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 132.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.26.0

File hashes

Hashes for ccsds_ndm-2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1f8359ca04a950686a5f48d464f619f16b1a65223932257fb5c3807411a2b64e
MD5 2ea7bb9d6cc4fb63dd517ac7969681fb
BLAKE2b-256 6602752b8e2cc5cdd2d77f66184329db264afb3483b4a6fdb5f9c6afad0a2e00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page