PL1

Implement trajectory context

Currently the JUICE AGM API implement different trajectory contexts in https://juicept.esac.esa.int/assets/trajectory_contexts.json

[
  { "name" : "JUICE CREMA 3.0", "context": "30"},
  { "name" : "JUICE CREMA 3.1", "context": "31"},
  { "name" : "JUICE CREMA 3.2", "context": "32"},
  { "name" : "JUICE CREMA 5.0 Cruise", "context": "50c"},
  { "name" : "JUICE CREMA 5.0", "context": "50"},
  { "name" : "JUICE CREMA 5.0b23_1 Cruise", "context": "50b23_1c"},
  { "name" : "JUICE CREMA 5.0b23_1", "context": "50b23_1"},
  { "name" : "JUICE CREMA 5.1 150lb_23_1 Cruise", "context": "51c"},
  { "name" : "JUICE CREMA 5.1 150lb_23_1", "context": "51"}
]

Then, the description of the context can be found in https://juicept.esac.esa.int/<context_id>/serviceinfo to get the details of the configuration, including the metakernel to be used for the AGM calls, e.g. for the trajectory JUICE CREMA 5.1 150lb_23_1, we would use the context 51: https://juicept.esac.esa.int/51/serviceinfo

{
    "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",
}

Implementation proposal

  1. When a user provides a metakernel value to agm_simaulation(), this value should be checked against the JUICE_API, i.e.:
agm_simulation('Crema 5.1 150lb_23_1', 'example.ptx', 'JUICE_API')

# or 

agm_simulation('JUICE CREMA 5.0b23_1 Cruise', 'example.ptx', 'JUICE_API')

# or (less flavored)

agm_simulation('51', 'example.ptx', 'JUICE_API')

should be considered as valid inputs (metakernel=juice_crema_5_1_150lb_23_1_v420 will still be send to the API in the end).

  1. It should also be possible to list the different trajectory context:
>>> from ptr import JUICE_API

>>> JUICE_API
<AGM_API> JUICE_API | Endpoint: https://juicept.esac.esa.int/agm | Contexts:
- JUICE CREMA 3.0
- ...
- JUICE CREMA 5.1 150lb_23_1

>>> JUICE_API['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",
}
  1. These context should be also available in prm.simulate(...) and juice-agm --mk METAKERNEL cli as well.

/cc @nmanaud @lpenasa @mcosta @randres