DRMS
raw JSON → 0.9.0 verified Fri May 01 auth: no python
A Python client for accessing HMI, AIA and MDI data from the Stanford JSOC DRMS (Data Record Management System). Version 0.9.0 requires Python >=3.10.
pip install drms Common errors
error ImportError: No module named 'drms' ↓
cause Library not installed or installed in wrong environment.
fix
Run
pip install drms in your active Python environment (check Python version >=3.10). error drms.exceptions.DrmsOperationError: No such series: hmi.v_45s ↓
cause Typo in series name; series names are case-sensitive and must match JSOC exactly.
fix
Check the series name on JSOC website. For valid series, use
c.series() to list available series. error ConnectionError: HTTPSConnectionPool ... Max retries exceeded ↓
cause JSOC server is down or network issue.
fix
Wait and retry. Use exponential backoff. Check status at http://jsoc.stanford.edu/.
error TypeError: export() missing required argument 'request' ↓
cause The `export` method signature changed in drms 0.7.0.
fix
Use new API:
req = c.export(hdu_list, protocol='as-is') then req.wait() and req.download(). error 'Series' object is not subscriptable ↓
cause Trying to index a Series object returned by `c.series('hmi.v_45s')` incorrectly.
fix
Use
c.series('hmi.v_45s').keys() to get available keywords. Warnings
breaking In version 0.7.0, the `Client` class removed support for Python 3.7 and below. The `export` method now returns a `ExportRequest` object instead of a dict. ↓
fix Update your code to use the new `ExportRequest` API: call `.wait()` or `.download()` on the returned object.
breaking The `query` method changed its return type from a list of strings to a pandas DataFrame in version 0.6.0. ↓
fix If you relied on list indexing, use DataFrame column selection or convert with `.values.tolist()`.
gotcha DRMS requires an internet connection and the JSOC server may be unreachable during maintenance. Always handle `ConnectionError` or `drms.DrmsOperationError`. ↓
fix Wrap calls in try/except blocks: try: ... except drms.DrmsOperationError as e: print(e)
gotcha When accessing private data or making many queries, you must set the `jsoc_email` parameter in the Client constructor, otherwise the server may throttle or reject requests. ↓
fix Use `Client(email='your.email@example.com')` instead of the default anonymous client.
Imports
- Client wrong
from drms.client import Clientcorrectfrom drms import Client - DrmsOperationError wrong
from drms.exceptions import DrmsOperationErrorcorrectfrom drms import DrmsOperationError
Quickstart
import os
from drms import Client
c = Client()
ts = c.query('hmi.v_45s', key='T_OBS', count=5)
print(ts)