ESA API#

ESA Metakernels#

ESA_MK#

planetary_coverage.ESA_MK#

alias of <EsaMetakernelsCollection> 16 missions: - BEPICOLOMBO / MPO / BEPICOLOMBO MPO / MERCURY PLANETARY ORBITER / MTM / BEPICOLOMBO MTM / MERCURY TRANSFER MODULE / MMO / BEPICOLOMBO MMO / MERCURY MAGNETOSPHERIC ORBITER - ENVISION - COMET-INTERCEPTOR - EXOMARS2016 / TGO / EXOMARS 2016 TGO / TRACE GAS ORBITER / EDM / EXOMARS 2016 EDM / EDL DEMONSTRATOR MODULE - EXOMARSRSP / RM / EXM RSP RM / EXM ROVER / EXOMARS ROVER / SP / EXM RSP SP / EXM SURFACE PLATFORM / EXOMARS SP / CM / EXM RSP SCC / EXM SPACECRAFT COMPOSITE / EXOMARS SCC - GAIA - HERA - HUYGENS / CASP / CASSINI PROBE / HUYGENS PROBE - INTEGRAL - JUICE - JWST - MARS-EXPRESS / MEX / MARS EXPRESS / BEAGLE2 / BEAGLE 2 / BEAGLE-2 - ROSETTA / PHILAE - SMART-1 / S1 / SM1 / SMART1 - SOLAR-ORBITER / SOLO / SOLAR ORBITER - VENUS-EXPRESS / VEX / VENUS EXPRESS

EsaMetakernels#

class planetary_coverage.esa.metakernel.EsaMetakernels(mission, doi=None, alias=None)[source]#

Bases: object

ESA mission metakernels.

Parameters
  • mission (str) – Name of the mission.

  • doi (str, optional) – DOI of the dataset.

  • sc_alias (str) –

property latest#

[Cached] Latest version.

property versions: list#

Get all the releases available for a given mission.

version(version) list[source]#

List of all the metakernels for a given version.

property mks#

[Cached] List of all the latest metakernels.

EsaMetakernelsCollection#

class planetary_coverage.esa.metakernel.EsaMetakernelsCollection(*esa_kernels)[source]#

Bases: collections.UserDict

ESA metakernels collection.

get_mk()#

planetary_coverage.esa.get_mk(mission, mk='latest', version='latest')[source]#

Get metakernel file(s) from ESA Cosmos repo for a given tag.

https://s2e2.cosmos.esa.int/bitbucket/rest/api/1.0/projects/SPICE_KERNELS/repos/juice/browse/kernels/mk/?at=refs/tags/v270_20201113_001
https://s2e2.cosmos.esa.int/bitbucket/rest/api/1.0/projects/SPICE_KERNELS/repos/juice/raw/kernels/mk/juice_crema_3_0.tm?at=refs/tags/v270_20201113_001
Parameters
  • mission (str) – Mission name in the cosmos repo.

  • mk (str, optional) – Metakernel name/shortcut to download. If latest is provided (default), the lastest metakernel will be selected. If all is provided, the function will search all the available metakernel(s) for the provided tag.

  • version (str, optional) – Tagged version latest (default) or all. If the version provided is not fully defined, the API will be query to search for the closest version. If all is provided, the function will list all the available metakernel(s) for all the tags.

Returns

Metakernel file name.

Return type

str, list or EsaMissionMetakernels

Raises

get_tag()#

planetary_coverage.esa.get_tag(mission, version='latest', **params)[source]#

Get tag version(s) of the metakernels from ESA Cosmos repo.

https://s2e2.cosmos.esa.int/bitbucket/rest/api/1.0/projects/SPICE_KERNELS/repos/juice/tags
Parameters
  • mission (str) – Mission name in the cosmos repo.

  • version (str, optional) – Version short key or latest or all (default: ‘latest’).

  • **params – API paging parameters (limit/start/filterText).

Returns

Long SKD version key(s).

Return type

str or list

Raises

Note

If multiple version have the same short version key, only the most recent will be returned. If you want a specific version you need to be as precise as possible.

ESA export functions#

export_timeline()#

planetary_coverage.esa.export.export_timeline(fname, traj, roi=None, subgroup='', source='GENERIC', crema='CREMA_5_0')[source]#

Export a trajectory and ROI(s) intersection segments.

CSV and JSON files are natively compatible with the Juice timeline tool:

https://juicesoc.esac.esa.int/tm/?trajectory=CREMA_5_0

EVF files can be used in MAPPS.

Parameters
  • fname (str or pathlib.Path) – Output filename. Currently, only .json and .csv are supported. If you only need the intersection windows as a list you can force the fname to be set to None.

  • traj (Trajectory or MaskedTrajectory) – Trajectory to segment.

  • roi (ROI or ROIsCollection, optional) – ROI or ROIsCollection to use to intersect the trajectory (default: None).

  • subgroup (str, optional) – Subgroup keyword (default: <EMPTY>).

  • source (str, optional) – Source / working group entry (default: GENERIC).

  • crema (str, optional) – Input CReMA key (only used for JSON output).

Returns

Output filename.

Return type

pathlib.Path

Raises

ValueError – If the provided filename does not end with .json, .csv or .evf.

extract_segments()#

planetary_coverage.esa.export.extract_segments(traj, roi=None, subgroup='', source='GENERIC')[source]#

Extract trajectory and ROI(s) intersection segments windows.

Segment format:

[NAME, START_TIME, STOP_TIME, SUBGROUP, SOURCE]

Parameters
  • traj (Trajectory or MaskedTrajectory) – Trajectory to segment.

  • roi (ROI or ROIsCollection, optional) – ROI or ROIsCollection to use to intersect the trajectory (default: None).

  • subgroup (str, optional) – Subgroup keyword (default: <EMPTY>).

  • source (str, optional) – Source / working group entry (default: GENERIC).

Returns

List of segments.

Return type

list

Raises

TypeError – If the input roi is not None, a ROI nor a ROIsCollection.

Note

  • The NAME keyword is set to TRAJECTORY_SEGMENT if only a single trajectory is provided or ROI_INTERSECTION if a ROI or a ROIsCollection is provided.

  • START and STOP times are return as ISO format: 2032-07-08T15:53:52.350Z

  • The SUBGROUP is optional. If no subgroup is provided, the ROI key intersected will be used if available.

  • The SOURCE can be empty.

  • The output events are chronologically ordered by start time. If 2 events starts at the same time, the first one in the list will be the one with the shortest duration.

See also

juice_timeline

format_csv()#

planetary_coverage.esa.export.format_csv(segments, header='# name, t_start, t_end, subgroup, source')[source]#

Format segments as a CSV string.

Parameters
  • segments (list) – List of events as: [NAME, START_TIME, STOP_TIME, SUBGROUP, SOURCE]

  • header (str, optional) – Optional file header.

Returns

Formatted CSV string.

Return type

str

Note

The delimiter is a comma character (,).

format_json()#

planetary_coverage.esa.export.format_json(segments, fname, crema='CREMA_5_0', timeline='LOCAL', overwritten=False)[source]#

Format segments as a JSON string.

Parameters
  • segments (list) – List of events as: [NAME, START_TIME, STOP_TIME, SUBGROUP, SOURCE]

  • crema (str, optional) – Top level crema keyword.

  • timeline (str, optional) – Top level timeline keyword.

  • overwritten (bool, optional) – Segment event overwritten keyword.

Returns

Formatted JSON string.

Return type

str

Note

The SUBGROUP field is used to store the name that will be displayed in the Juice timeline tool. If none is provided, the NAME field will be used instead.

format_evf()#

planetary_coverage.esa.export.format_evf(segments)[source]#

Format segments as a EVF string (for MAPPS).

Parameters

segments (list) – List of events as: [NAME, START_TIME, STOP_TIME, SUBGROUP, SOURCE]

Returns

Formatted EVF string.

Return type

str

Note

  • The SUBGROUP field is used as the main key. If none is provided, the NAME field will be used instead.

  • SOURCE field are not used in EVF formatting.