Skip to content

OEM — Orbit Ephemeris Message

Parses and writes CCSDS Orbit Ephemeris Messages containing time-ordered state vectors with optional covariance data.


OEM

OEM(originator: Any, format_version: Any = 3.0, classification: Any = None)

Python wrapper for CCSDS Orbit Ephemeris Message (OEM).

OEM messages contain time-ordered sequences of state vectors (position and velocity), optionally with accelerations and covariance matrices.

Header-level fields are properties with getters and setters. Segment data is accessed via the segments property which supports indexing, iteration, and mutation.

Example
from brahe.ccsds import OEM
from brahe import Epoch

# Parse existing
oem = OEM.from_file("ephemeris.oem")
print(oem.originator)
seg = oem.segments[0]
sv = seg.states[0]
print(sv.position)

# Construct from scratch
start = Epoch.from_datetime(2024, 1, 1, 0, 0, 0)
stop = Epoch.from_datetime(2024, 1, 1, 1, 0, 0)
oem = OEM(originator="MY_ORG")
oem.add_segment(
    object_name="SAT1", object_id="2024-001A",
    center_name="EARTH", ref_frame="GCRF", time_system="UTC",
    start_time=start, stop_time=stop,
)
oem.segments[0].add_state(
    epoch=start, position=[7000e3, 0, 0], velocity=[0, 7500, 0],
)

Initialize instance.

classification property

classification: str

Classification of the message, or None.

Returns:

Name Type Description
str str

Classification string, or None

creation_date property

creation_date: Epoch

Creation date of the message.

Returns:

Name Type Description
Epoch Epoch

Creation date

format_version property

format_version: float

CCSDS format version.

Returns:

Name Type Description
float float

Format version

message_id property

message_id: str

Message ID, or None.

Returns:

Name Type Description
str str

Message ID, or None

originator property

originator: str

Originator of the message.

Returns:

Name Type Description
str str

Originator string

segments property

segments: OEMSegments

Segment collection, supporting len/indexing/iteration.

Returns:

Name Type Description
OEMSegments OEMSegments

Collection of OEM segments

add_segment method descriptor

add_segment(object_name: str, object_id: str, center_name: str, ref_frame: str, time_system: str, start_time: Epoch, stop_time: Epoch, interpolation: str | None = None, interpolation_degree: int | None = None, trajectory: OrbitTrajectory | None = None) -> int

Add a new segment to the OEM.

Parameters:

Name Type Description Default
object_name str

Spacecraft name

required
object_id str

International designator

required
center_name str

Central body name

required
ref_frame str

Reference frame name

required
time_system str

Time system name

required
start_time Epoch

Start time of ephemeris data

required
stop_time Epoch

Stop time of ephemeris data

required
interpolation str | None

Interpolation method

None
interpolation_degree int | None

Interpolation degree

None
trajectory OrbitTrajectory | None

Optional trajectory to populate states from

None

Returns:

Name Type Description
int int

Index of the new segment

Example
from brahe import Epoch
from brahe.ccsds import OEM
oem = OEM(originator="MY_ORG")
start = Epoch.from_datetime(2024, 1, 1, 0, 0, 0)
stop = Epoch.from_datetime(2024, 1, 1, 1, 0, 0)
idx = oem.add_segment(
    object_name="SAT1", object_id="2024-001A",
    center_name="EARTH", ref_frame="GCRF", time_system="UTC",
    start_time=start, stop_time=stop,
    trajectory=prop.trajectory,
)

from_file staticmethod

from_file(path: str) -> OEM

Parse an OEM from a file, auto-detecting the format.

Parameters:

Name Type Description Default
path str

Path to the OEM file

required

Returns:

Name Type Description
OEM OEM

Parsed OEM message

from_str staticmethod

from_str(content: str) -> OEM

Parse an OEM from a string, auto-detecting the format (KVN, XML, or JSON).

Parameters:

Name Type Description Default
content str

String content of the OEM message

required

Returns:

Name Type Description
OEM OEM

Parsed OEM message

remove_segment method descriptor

remove_segment(idx: int) -> Any

Remove a segment by index.

Parameters:

Name Type Description Default
idx int

Index of the segment to remove

required

segment_to_trajectory method descriptor

segment_to_trajectory(segment_idx: int) -> SOrbitTrajectory

Convert a single OEM segment to an OrbitTrajectory.

The trajectory contains Cartesian state vectors (position/velocity) in the reference frame specified by the segment metadata.

Parameters:

Name Type Description Default
segment_idx int

Index of the segment to convert (0-based)

required

Returns:

Name Type Description
OrbitalTrajectory SOrbitTrajectory

Trajectory containing the segment's state vectors

Raises:

Type Description
BraheError

If segment index is out of range or frame is unsupported

Example
1
2
3
4
from brahe.ccsds import OEM
oem = OEM.from_file("ephemeris.oem")
traj = oem.segment_to_trajectory(0)
print(f"States: {len(traj)}")

state method descriptor

state(segment_idx: int, state_idx: int) -> OEMStateVector

Get a state vector from a segment by index (shortcut).

This is a convenience method equivalent to oem.segments[segment_idx].states[state_idx].

Parameters:

Name Type Description Default
segment_idx int

Segment index (0-based)

required
state_idx int

State vector index (0-based)

required

Returns:

Name Type Description
OEMStateVector OEMStateVector

State vector proxy

to_dict method descriptor

to_dict() -> dict

Convert the OEM to a Python dictionary.

Epochs are serialized as CCSDS datetime strings for JSON/dict compatibility.

Returns:

Name Type Description
dict dict

Dictionary representation of the OEM

to_file method descriptor

to_file(path: str, format: str) -> Any

Write the OEM to a file in the specified format.

Parameters:

Name Type Description Default
path str

Output file path

required
format str

Output format - "KVN", "XML", or "JSON"

required

to_json_string method descriptor

to_json_string(uppercase_keys: bool = False) -> str

Write the OEM to JSON with explicit key case control.

Parameters:

Name Type Description Default
uppercase_keys bool

If True, use uppercase CCSDS keywords. Default: False.

False

Returns:

Name Type Description
str str

Serialized JSON string

to_string method descriptor

to_string(format: str) -> str

Write the OEM to a string in the specified format.

Parameters:

Name Type Description Default
format str

Output format - "KVN", "XML", or "JSON"

required

Returns:

Name Type Description
str str

Serialized OEM string

to_trajectories method descriptor

to_trajectories() -> list[OrbitalTrajectory]

Convert all OEM segments to OrbitTrajectory objects.

Returns one trajectory per segment, each containing the segment's state vectors in its reference frame.

Returns:

Type Description
list[OrbitalTrajectory]

list[OrbitalTrajectory]: One trajectory per segment

Raises:

Type Description
BraheError

If any segment's frame is unsupported

Example
1
2
3
4
5
from brahe.ccsds import OEM
oem = OEM.from_file("multi_segment.oem")
trajs = oem.to_trajectories()
for t in trajs:
    print(f"{t.name}: {len(t)} states")

See Also