Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

IMAP Data Access Package

This lightweight Python package allows users to download, query, and upload data from the IMAP Science Data Center (SDC).

For more information see the detailed instructions.

Command Line Utility

To install

pip install imap-data-access
imap-data-access -h

Base Command Arguments

$ imap-data-access query # or
$ imap-data-access download # or
$ imap-data-access upload

Add the '-h' help flag with any base command for more information

Query / Search for data

Find all files from the SWE instrument

$ imap-data-access query --instrument swe
Found [3] matching files
|-----------------------------------------------------------------------------------------------------------------------------------|
| Instrument | Data Level | Descriptor      | Start Date | Repointing | Version | Filename                                          |
|-----------------------------------------------------------------------------------------------------------------------------------|
| swe        | l0         | raw             | 20240510   |            | v022    | imap_swe_l0_raw_20240510_v022.pkts                |
| swe        | l1a        | sci             | 20240510   |            | v022    | imap_swe_l1a_sci_20240510_v022.cdf                |
| swe        | l1b        | sci             | 20240510   |            | v022    | imap_swe_l1b_sci_20240510_v022.cdf                |
|-----------------------------------------------------------------------------------------------------------------------------------|

Find all SWE files ingested since a specific date (useful as a "since" filter to get newly available data)

$ imap-data-access query --instrument swe --ingestion-start-date 20240501
Found [2] matching files
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| Instrument | Data Level | Descriptor | Start Date | Repointing | Version | Ingestion Date | Filename                                          |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| swe        | l1a        | sci        | 20240510   |            | v022    | 20240512       | imap_swe_l1a_sci_20240510_v022.cdf                |
| swe        | l1b        | sci        | 20240510   |            | v022    | 20240513       | imap_swe_l1b_sci_20240510_v022.cdf                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|

You can also bound the ingestion date range with --ingestion-end-date

$ imap-data-access query --instrument swe --ingestion-start-date 20240501 --ingestion-end-date 20240601

Find all files during the year 2024 and return the response as raw json

$ imap-data-access query --start-date 20240101 --end-date 20241231 --output-format json
[{'file_path': 'imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts', 'instrument': 'swe', 'data_level': 'l0', 'descriptor': 'sci', 'start_date': '20240105', 'version': 'v001', 'extension': 'pkts'}, {'file_path': 'imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts', 'instrument': 'swe', 'data_level': 'l0', 'descriptor': 'sci', 'start_date': '20240105', 'version': 'v001', 'extension': 'pkts'}]

Find all latest predicted ephemeris kernels

$ imap-data-access query --table spice --ingestion-start-date 20260301 --type ephemeris_predicted --version latest

An equivalent curl command is shown.

$ curl "https://api.imap-mission.com/spice-query?start_ingest_date=20260301&type=ephemeris_predicted&latest=true"

Download a predicted ephemeris kernel

$ imap-data-access download spk/imap_pred_od025_20260303_20260414_v01.bsp

An equivalent curl command is shown.

$ curl "https://api.imap-mission.com/download/imap/spice/spk/imap_pred_od025_20260303_20260414_v01.bsp" --output imap_pred_od025_20260303_20260414_v01.bsp

Download a file

Download a level 0 SWE file on 2024/01/05

$ imap-data-access download imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts
Successfully downloaded the file to: <IMAP_DATA_DIR>/imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts

Upload a file

Upload a l1a file after decoding the l0 CCSDS ".pkts" file

$ imap-data-access upload /imap/swe/l1a/2024/01/imap_swe_l1a_sci_20240105_v001.cdf
Successfully uploaded the file to the IMAP SDC

Importing as a package

import imap_data_access

# Search for files
results = imap_data_access.query(instrument="mag", data_level="l0")
# results is a list of dictionaries
# [{'file_path': 'imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts', 'instrument': 'swe', 'data_level': 'l0', 'descriptor': 'sci', 'start_date': '20240105','version': 'v001', 'extension': 'pkts'}, {'file_path': 'imap/swe/l0/2024/01/imap_swe_l0_sci_20240105_v001.pkts', 'instrument': 'swe', 'data_level': 'l0', 'descriptor': 'sci', 'start_date': '20240105', 'version': 'v001', 'extension': 'pkts'}]

# Search for files ingested since a specific date ("since" query)
results = imap_data_access.query(instrument="swe", ingestion_start_date="20240501")
# Optionally bound the range
results = imap_data_access.query(
    instrument="swe", ingestion_start_date="20240501", ingestion_end_date="20240601"
)

# Download a file that was returned from the search
imap_data_access.download("imap/mag/l0/2024/01/imap_mag_l0_raw_202040101_v001.pkts")

# Upload a calibration file that exists locally
imap_data_access.upload("imap/swe/l1a/2024/01/imap_swe_l1a_sci_20240105_v001.cdf")

Configuration

Data directory

The folder structure for data files within the IMAP SDC is rigidly defined, so the data access will mimic that structure to make sure all data is stored in the same heirarchical structure as the SDC. This will enable seamless transition between a user's local system and the SDC. This is only used for downloads.

A user's root data location can be specified as an environment variable IMAP_DATA_DIR or through a configuration dictionary within the package itself imap_data_access.config["DATA_DIR"]. If the IMAP_DATA_DIR variable is not set, the program defaults to the user's current working directory + data/.

The following is the directory structure the IMAP SDC uses.

<IMAP_DATA_DIR>/
  imap/
    <instrument>/
      <data_level>/
        <year>/
          <month>/
            <filename>

for example, with IMAP_DATA_DIR=/data:

/data/
  imap/
    swe/
      l0/
        2024/
          01/
            imap_swe_l0_sci_20240105_v001.pkts

Data Access URL

To change the default URL that the package accesses, you can set the environment variable IMAP_DATA_ACCESS_URL or within the package imap_data_access.config["DATA_ACCESS_URL"]. The default is the production server https://api.imap-mission.com.

Use with API Keys

The default for the CLI is to use the public endpoints. To access some unreleased data products and quicklooks, you may need elevated permissions. To get that, you need an API Key, which can be requested from the SDC team.

There are two ways to provide your API Key:

  1. Environment variable: Set the IMAP_API_KEY environment variable
IMAP_API_KEY=<your-api-key> imap-data-access ...
  1. Command line flag: Use the --api-key flag
imap-data-access --api-key <your-api-key> ...

The command line flag will override the environment variable if both are set.

Automated use with Access token (for software)

An alternative to using an API key to access protected data is using an access token provided by our authentication server, which uses keycloak authentication.

To use an access token with imap-data-access you can set the following environment variable:

IMAP_ACCESS_TOKEN={{Access token from our auth server}}

Any queries or downloads made with imap-data-access will now use these credentials.

Troubleshooting

Network issues

SSL

If you encounter SSL errors similar to the following:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

That generally means the Python environment you're using is not finding your system's root certificates properly. This means you need to tell Python how to find those certificates with the following potential solutions.

  1. Upgrade the certifi package

    pip install --upgrade certifi
    
  2. Install system certificates Depending on the Python version you installed the program with the command will look something like this:

    /Applications/Python\ 3.10/Install\ Certificates.command
    

HTTP Error 502: Bad Gateway

This could mean that the service is temporarily down. If you continue to encounter this, reach out to the IMAP SDC at imap-pipeline@princeton.edu.

FileNotFoundError

This could mean that the local data directory is not set up with the same paths as the SDC. See the data directory section for an example of how to set this up.

File Validation

This package validates filenames and paths to check they follow our standards, as defined by the filename conventions. There is also a class available for use by other packages to create filepaths and filenames that follow the IMAP SDC conventions.

To use this class, use imap_data_access.ScienceFilePath.

Usage:

science_file = imap_data_access.ScienceFilePath("imap_swe_l0_sci_20240101_v001.pkts")

# Filepath = /imap/swe/l0/2024/01/imap_swe_l0_sci_20240101_v001.pkts
filepath = science_file.construct_path()

Dependency configuration

The imap_data_access.dependencies subpackage describes what each SDC processing job reads and writes. Each instrument's jobs are defined in one YAML file, imap_data_access/dependencies/config_files/imap_<instrument>_dependencies.yaml, which ships with this package. The SDC processing pipeline reads these files from the version of imap-data-access it uses, so a change to one of them takes effect only once it's in an imap-data-access release and the pipeline has been updated to that release.

To change a job's dependencies, open a pull request against this repository that edits the instrument's YAML file. The format reference describes every field, how the processing pipeline uses it, and what happens when you change a major version. Before you open the pull request, run this from the root of your checkout to check that the major versions in the files are consistent:

python -m imap_data_access.dependencies.validation

To read the configuration from Python:

from imap_data_access.dependencies import DependencyConfigReader

reader = DependencyConfigReader()
# Jobs are keyed by (instrument, data level, descriptor)
job = reader.config[("swe", "l1b", "sci")]
job.inputs  # what the job reads
job.outputs  # what the job writes

Metadata

Release files for imap-data-access 1.4.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imap-data-access 1.4.0.dev1
File Size Uploaded Provenance Actions
imap_data_access-1.4.0.dev1.tar.gz 99.1 kB With provenance Details for imap_data_access-1.4.0.dev1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imap-data-access 1.4.0.dev1
File Interpreter ABI Platform Actions
imap_data_access-1.4.0.dev1-py3-none-any.whl Python 3 none any Details for imap_data_access-1.4.0.dev1-py3-none-any.whl

Total release size: 182.2 kB

Release files / imap_data_access-1.4.0.dev1.tar.gz

Download URL imap_data_access-1.4.0.dev1.tar.gz
Size 99.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d47fd4949a368cdcd7f40867b7171b1f7a7ea24871156cd83b542eb0605472ce
BLAKE2b-256 checksum
How to use checksums
d2a1f8b23cd41f8db343479acf25f7e8d5243be03035425630b800da722c94e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / imap_data_access-1.4.0.dev1-py3-none-any.whl

Download URL imap_data_access-1.4.0.dev1-py3-none-any.whl
Size 83.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0305068219086d175aa8efd9ac4ea6e379943f4bf019620393eb922d8afcfc21
BLAKE2b-256 checksum
How to use checksums
19b84ff2ea94054394e72b2a165b7d311ae4c870df8e46985508435f696b1e2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for imap-data-access 1.4.0.dev1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for imap_data_access-1.4.0.dev1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page