Import / Export PTR
Contents
Import / Export PTR#
Export PTR as ESA timeline#
The JUICE Segment Harmonization Tool (a.k.a the JUICE timeline tool) is an online events visualization tool that can be used to display a collection of temporal events in different timelines. It allows the ESA-SOC to plan events computed with other planning tools.
It is possible to export a PTR file, PTR string or PointingRequestMessage
object into CSV and JSON files compatible with the pointing tool. You can do it programmatically:
from ptr import read_ptr, export_timeline
ptr = read_ptr('example.ptx')
export_timeline('example.csv', ptr)
PosixPath('example.csv')
# name,t_start,t_end,subgroup,source
PTR_OBS_BLOCK,2032-07-02T04:18:40Z,2032-07-02T04:32:00Z,,GENERIC
Or, you can do it in your terminal:
!ptr2seg --help
usage: ptr2seg [-h] [-o FILENAME] [--json] [--subgroup SUBGROUP]
[--source SOURCE] [--crema CREMA] [--timeline TIMELINE]
ptr
Convert PTR to segmentation file.
positional arguments:
ptr PTR/PTX input file.
optional arguments:
-h, --help show this help message and exit
-o FILENAME, --output FILENAME
Custom output filename (default: PTR filename).
--json Export as JSON (default CSV if not provided).
--subgroup SUBGROUP Subgroup field (default: `<EMPTY>`).
--source SOURCE Source field (default: `GENERIC`).
--crema CREMA Trajectory crema keyword in JSON export (default:
`CREMA_5_0`).
--timeline TIMELINE Timeline keyword in JSON export (default: `LOCAL`).
!ptr2seg --json example.ptx
Segmentation saved in: example.json
{"creationDate": "2023-03-07T14:03:00.806Z", "name": "example", "segments": [{"start": "2032-07-02T04:18:40Z", "end": "2032-07-02T04:32:00Z", "segment_definition": "PTR_OBS_BLOCK", "name": "PTR_OBS_BLOCK", "overwritten": false, "timeline": "LOCAL", "source": "GENERIC", "resources": []}], "segmentGroups": [], "trajectory": "CREMA_5_0", "localStoragePk": ""}
More details can be found here.