hermpy.net#

Submodules#

Attributes#

Classes#

ClientMESSENGER

Client for querying and downloading MESSENGER spacecraft data from the

ClientSPICE

Client for managing and loading SPICE kernels from remote and local sources.

Package Contents#

class hermpy.net.ClientMESSENGER(_PDS_BASE_URL: str = 'https://pds-ppi.igpp.ucla.edu/data/', _PDS_DATA_LOCATION: dict[str, Any] = {'MAG': 'mess-mag-calibrated/data/mso/', 'MAG 1s': 'mess-mag-calibrated/data/mso-avg/', 'MAG 5s': 'mess-mag-calibrated/data/mso-avg/', 'MAG 10s': 'mess-mag-calibrated/data/mso-avg/', 'MAG 60s': 'mess-mag-calibrated/data/mso-avg/', 'MAG RTN 60s': 'mess-mag-calibrated/data/rtn-avg/', 'FIPS': 'mess-epps-fips-calibrated/data/scan/'}, _FILE_PATTERN: dict[str, str] = {'MAG': '{{year:4d}}/{subdir}/MAGMSOSCI{{year:2d}}{{day_of_year:3d}}_V{{version}}.TAB', 'MAG 1s': '{{year:4d}}/{subdir}/MAGMSOSCIAVG{{year:2d}}{{day_of_year:3d}}_01_V{{version}}.TAB', 'MAG 5s': '{{year:4d}}/{subdir}/MAGMSOSCIAVG{{year:2d}}{{day_of_year:3d}}_05_V{{version}}.TAB', 'MAG 10s': '{{year:4d}}/{subdir}/MAGMSOSCIAVG{{year:2d}}{{day_of_year:3d}}_10_V{{version}}.TAB', 'MAG 60s': '{{year:4d}}/{subdir}/MAGMSOSCIAVG{{year:2d}}{{day_of_year:3d}}_60_V{{version}}.TAB', 'MAG RTN 60s': '{{year:4d}}/{subdir}/MAGRTNSCIAVG{{year:2d}}{{day_of_year:3d}}_60_V{{version}}.TAB', 'FIPS': '{{year:4d}}/{subdir}/FIPS_R{{year:4d}}{{day_of_year:3d}}CDR_V{{version}}.TAB'})#

Client for querying and downloading MESSENGER spacecraft data from the NASA Planetary Data System (PDS).

Supports multiple instruments and data products, including magnetometer (MAG) data at various cadences and the Fast Imaging Plasma Spectrometer (FIPS). Data is retrieved from the PDS Planetary Plasma Interactions Node and downloaded locally on request.

Parameters:
  • PDS_BASE_URL – Base URL for the PDS data server.

  • PDS_DATA_LOCATION – Mapping from instrument name to its path relative to PDS_BASE_URL. Supported keys include "MAG", "MAG 1s", "MAG 5s", "MAG 10s", "MAG 60s", "MAG RTN 60s", and "FIPS".

  • FILE_PATTERN – Mapping from instrument name to the filename pattern used by sunpy.net.Scraper to resolve individual files. Patterns may contain {subdir}, {year}, {day_of_year}, and {version} placeholders.

Example usage:

from sunpy.time import TimeRange
client = ClientMESSENGER()
time_range = TimeRange("2012-01-01", "2012-01-02")
urls = client.query(time_range, "MAG 1s")
files = client.fetch()
PDS_BASE_URL = 'https://pds-ppi.igpp.ucla.edu/data/'#
PDS_DATA_LOCATION#
FILE_PATTERN#
_query_buffer: list[str] = []#
property instruments: list[str]#

The instrument names supported by this client.

Derived from the keys of PDS_DATA_LOCATION.

query(time_range: sunpy.time.TimeRange, instrument: str) list[str]#

Query the PDS for available files for a given instrument and time range.

Resolves the appropriate monthly subdirectory structure, uses sunpy.net.Scraper to build candidate URLs, and filters the results to only those matching the day-of-year values spanned by time_range. Matched URLs are appended to the internal query buffer, making them available to fetch().

Parameters:
  • time_range – The time range over which to search for data.

  • instrument – The instrument to query. Must be one of the keys in instruments.

Raises:

KeyError – If instrument is not a recognised key.

fetch() list[pathlib.Path]#

Download all files currently held in the query buffer.

Files that have already been downloaded locally are retrieved from disk rather than re-downloaded. Clears the query buffer after completion, so subsequent calls to fetch() without an intervening query() will return an empty list.

class hermpy.net.ClientSPICE(KERNEL_LOCATIONS: Dict[str, Dict[str, Any]] = DEFAULT_KERNEL_LOCATIONS)#

Client for managing and loading SPICE kernels from remote and local sources.

Handles downloading kernels from NAIF (or other configured sources), resolving filename patterns against remote directory listings, and furnishing the resulting files to SpiceyPy via a context manager.

KERNEL_LOCATIONS#
_query_buffer: list[str] = []#
_local_buffer: list[pathlib.Path] = []#
add_local_kernels(paths: list[pathlib.Path]) None#

Stages local kernel files to be furnished on the next fetch.

Files are held in an internal buffer and included alongside any remotely downloaded kernels when fetch() is called.

fetch() list[str]#

Resolves, downloads, and returns all kernel file paths.

Expands each configured source’s filename patterns against its remote directory listing, downloads any files not already cached, appends any staged local kernels, and clears the remote query buffer. Returns the combined list of absolute file paths ready to be furnished to SpiceyPy.

KernelPool()#

Context manager that furnishes all configured kernels for the duration of the block.

Calls fetch() to resolve and download kernels, then delegates to spiceypy.KernelPool so that all furnished kernels are automatically unloaded on exit. Use this as the standard entry point for any SPICE computation that requires this client’s kernel set.

Example:
with client.KernelPool():

et = spice.utc2et(“2024-01-01”)

hermpy.net.DEFAULT_KERNEL_LOCATIONS: Dict[str, Dict[str, Any]]#