mex

This submodule contains Mars Express mission file-discovery and download functionality used by LoadPDS.

Classes

MexMixin()

Mars Express mission file-discovery mixin.

class MexMixin[source]

Bases: object

Mars Express mission file-discovery mixin.

filter_mapping_dict_by_radio_observation_type(mapping_dict, radio_observation_type, start_date_mex, end_date_mex)[source]

Description:

Filters a mapping dictionary to extract entries based on a specified observation type and a date range. The function returns a new dictionary where each key corresponds to a filtered set of entries that match the specified observation type and fall within the given start and end dates.

Inputs:
  • mapping_dict (dict): A dictionary where keys represent categories and values are lists of entries. Each entry is expected to be a dictionary containing: - start_date_utc (str): The start date in UTC (format: YYYY-MM-DD). - radio_observation_type (str): The type of observation.

  • radio_observation_type (str): The type of observation to filter by (e.g., ‘Phobos Gravity’).

  • start_date_mex (str): The start date for filtering in UTC (format: YYYY-MM-DD).

  • end_date_mex (str): The end date for filtering in UTC (format: YYYY-MM-DD).

Outputs:
  • filtered_dict (dict): A dictionary where keys are the same as in mapping_dict, and values are lists of filtered entries that match the specified observation type and fall within the date range.

get_mex_files(local_folder, start_date, end_date, radio_observation_type=None)[source]

Description: This function downloads and organizes various types of SPICE kernels and radio science files for the MEX (Mars Express) mission. It supports downloading kernel files related to radio science, clock data, frame data, SPK (spacecraft position) data, CK (orientation) data, and tropospheric/ionospheric correction files. The function interacts with remote FTP servers to retrieve the data and organizes them into the specified local folder. The data is filtered by a given date range, and the function returns the downloaded files for further use.

Inputs:
  • local_folder (str): The local directory where the downloaded files will be saved.

  • start_date (datetime): The start date for downloading data. This will filter the data to include only those within the date range.

  • end_date (datetime): The end date for downloading data. This will filter the data to include only those within the date range.

  • radio_observation_type (str): The type of radio science files to download (e.g. phobos gravity, commissioning, etc…)

Outputs:
  • (dict, dict, dict): A tuple containing:

    • kernel_files_to_load (dict): A dictionary where the keys are kernel types (e.g., ‘ck’, ‘spk’, ‘fk’, ‘sclk’) and values are lists of paths to the successfully downloaded and loaded kernel files.

    • radio_science_files_to_load (dict): A dictionary where keys are categories of radio science data (e.g., ‘ifms_dp2’, ‘dsn_dps’) and values are lists of paths to the successfully downloaded radio science files.

    • ancillary_files_to_load (dict): A dictionary where keys are categories of ancillary data (e.g., ‘ion’, ‘tropospheric’) and values are lists of paths to the successfully downloaded ancillary files, such as tropospheric and ionospheric corrections.

get_mex_volume_ID(start_date, end_date, interval_dict)[source]

Return MEX volume identifiers overlapping a date interval.

Parameters:
  • start_date (datetime) – Start of the requested interval.

  • end_date (datetime) – End of the requested interval.

  • interval_dict (dict) – Mapping from date intervals to volume metadata.

Returns:

Matching MEX volume identifiers.

Return type:

list[str]

get_mex_volume_ID_mapping(url)[source]

Description: Fetches data from a given URL and extracts volume ID, date range, and observation type for the Mars Express mission. The data is returned as a dictionary mapping date intervals to volume IDs and metadata.

Inputs:
  • url (str): The URL from which to fetch the data (plain text format).

Outputs:
  • mapping_dict (dict): A dictionary where keys are tuples of (start_date_utc, end_date_utc), and values are dictionaries with:

    • volume_id (str): The volume ID.

    • start_date_file (str): Start date (YYYY-MM-DD).

    • end_date_file (str): End date (YYYY-MM-DD).

    • radio_observation_type (str): Type of observation.

get_url_mex_radio_science_files(start_date_mex, end_date_mex, radio_observation_type=None)[source]

Return MEX radio-science archive URLs for a date interval.

Parameters:
  • start_date_mex (datetime) – Start of the requested interval.

  • end_date_mex (datetime) – End of the requested interval.

  • radio_observation_type (str, optional) – Optional radio-science observation type filter.

Returns:

Matching MEX radio-science archive URLs.

Return type:

list[str]