Skip to content

Add pointing tool API context

Benoit Seignovert requested to merge implement-pointing-tool-api-contexts into main

Closes #9 (closed).

Add new JUICE_POINTING_TOOL object to get the metakernel contexts available on the JUICE pointing tool:

>>> from ptr import JUICE_POINTING_TOOL

>>> JUICE_POINTING_TOOL
<PointingToolApi> https://juicept.esac.esa.int | Contexts:
- JUICE CREMA 5.1 150lb_23_1
- ...
- JUICE CREMA 3.0

>>> 'JUICE CREMA 5.1 150lb_23_1' in JUICE_POINTING_TOOL
True

>>> JUICE_POINTING_TOOL['JUICE CREMA 5.1 150lb_23_1']
<PointingToolContext> JUICE CREMA 5.1 150lb_23_1
- coverage_start: 2031-01-19T19:14
- coverage_end: 2035-09-29T00:00
- sample_date: 2032-07-02T16:22
- metakernel: juice_crema_5_1_150lb_23_1_v420
- skd_version: v420_20221220_001
- trajectory: Crema 5.1 150lb_23_1
- mission: JUICE

>>> JUICE_POINTING_TOOL['JUICE CREMA 5.1 150lb_23_1'].mk
'juice_crema_5_1_150lb_23_1_v420'
  • Internal context_id are supported but not recommended:
>>> JUICE_POINTING_TOOL.contexts
[
    {"name": "JUICE CREMA 5.1 150lb_23_1", "context": "51"},
    ...
    {"name": "JUICE CREMA 3.0", "context": "30"},
]

>>> '51' in JUICE_POINTING_TOOL
True

>>> JUICE_POINTING_TOOL['51']
<PointingToolContext> JUICE CREMA 5.1 150lb_23_1
...

>>> JUICE_POINTING_TOOL['JUICE CREMA 5.1 150lb_23_1'].context_id
'51'
  • You can also use the POINTING_TOOL_ENDPOINTS dictionary to get the same result:
>>> from ptr import POINTING_TOOL_ENDPOINTS

>>> POINTING_TOOL_ENDPOINTS.keys()
['JUICE_POINTING_TOOL']

>>> POINTING_TOOL_ENDPOINTS['JUICE_POINTING_TOOL']
<PointingToolApi> https://juicept.esac.esa.int | Contexts:
- JUICE CREMA 5.1 150lb_23_1
- ...
- JUICE CREMA 3.0
  • The metakernel contexts list can also be retrieved from the command line:
juice-agm --contexts
  • The metakernel context name are now the default way to call AGM:
>>> agm_simulation('JUICE CREMA 5.1 150lb_23_1', 'example.ptx', 'JUICE_API')

# is now recommended over
>>> agm_simulation('juice_crema_5_1_150lb_23_1_v420', 'example.ptx', 'JUICE_API')
  • Similarly on the CLI:
juice-agm --mk "JUICE CREMA 5.1 150lb_23_1" example.ptx

Other changes

  • Update Juice AGM CLI (juice-agm) default metakernel from juice_crema_5_0 to "JUICE CREMA 5.1 150lb_23_1".
  • Removed AGM_URL_POINTING_TOOL_ENDPOINTS, replaced by POINTING_TOOL_ENDPOINTS.
Edited by Benoit Seignovert

Merge request reports