hermpy.net ========== .. py:module:: hermpy.net Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/hermpy/net/client_messenger/index /autoapi/hermpy/net/client_spice/index Attributes ---------- .. autoapisummary:: hermpy.net.DEFAULT_KERNEL_LOCATIONS Classes ------- .. autoapisummary:: hermpy.net.ClientMESSENGER hermpy.net.ClientSPICE Package Contents ---------------- .. py:class:: 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. :param PDS_BASE_URL: Base URL for the PDS data server. :param 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"``. :param FILE_PATTERN: Mapping from instrument name to the filename pattern used by :class:`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() .. py:attribute:: PDS_BASE_URL :value: 'https://pds-ppi.igpp.ucla.edu/data/' .. py:attribute:: PDS_DATA_LOCATION .. py:attribute:: FILE_PATTERN .. py:attribute:: _query_buffer :type: list[str] :value: [] .. py:property:: instruments :type: list[str] The instrument names supported by this client. Derived from the keys of ``PDS_DATA_LOCATION``. .. py:method:: 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 :class:`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 :meth:`fetch`. :param time_range: The time range over which to search for data. :param instrument: The instrument to query. Must be one of the keys in :attr:`instruments`. :raises KeyError: If ``instrument`` is not a recognised key. .. py:method:: 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 :meth:`fetch` without an intervening :meth:`query` will return an empty list. .. py:class:: 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. .. py:attribute:: KERNEL_LOCATIONS .. py:attribute:: _query_buffer :type: list[str] :value: [] .. py:attribute:: _local_buffer :type: list[pathlib.Path] :value: [] .. py:method:: 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. .. py:method:: 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. .. py:method:: 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") .. py:data:: DEFAULT_KERNEL_LOCATIONS :type: Dict[str, Dict[str, Any]]