Hi @thekozak,
I went through this pretty recently - fairly simple to get an appendable for writing out CCSDS stuff. Here is how I did it for an OEM (should be similar for a TDM).
TL:DR: use a StringBuilder()
from java.lang
import
# Imports for this to work
from java.lang import StringBuilder
from org.orekit.files.ccsds.ndm import WriterBuilder
# At this point I already have build the following:
# oem_header -> Header from org.orekit.files.ccsds.section
# oem_segment -> OemSegment
writer = WriterBuilder().buildOemWriter() # TDM writer for you
oem_output_java_string = StringBuilder()
kvn_gen = KvnGenerator(oem_output_java_string, 1, 'ephemeris', 0)
# Write header and segment
writer.writeHeader(kvn_gen, oem_header)
writer.writeSegmentContent(kvn_gen, 2.0, oem_segment)
# Write the file
with open(ephem_output_path, 'w') as fp:
fp.write(oem_output_java_string.toString())
That output will be a string in the KVN format with \n
delimiters. So if you wanted it back in a python list or whatnot, could just do a string split.