Skip to content

SWAPI: Add velocity, covariance, and uncertainty in GSE coordinates - #221

Open
leowerneck wants to merge 21 commits into
IMAP-Science-Operations-Center:mainfrom
leowerneck:lw/issue21-gse-sun
Open

leowerneck wants to merge 21 commits into
IMAP-Science-Operations-Center:mainfrom
leowerneck:lw/issue21-gse-sun

Conversation

@leowerneck

@leowerneck leowerneck commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Change Summary

Related to #21.

Overview

This PR is a simplified version of #165 intended to add the transformation to GSE coordinates in the Earth frame. It does not introduce GSM or HAE-J2000, which will be left for a future PR (if still desired).

Testing

All newly added tests pass locally.

Note

The vast majority of the diff in this commit is due to reformatting with ruff format, which mostly affect the test files.

@leowerneck
leowerneck requested a review from jtniehof October 2, 2026 20:28
@leowerneck leowerneck self-assigned this Oct 2, 2026
@leowerneck leowerneck added enhancement New feature or request Ins: SWAPI Related to the SWAPI instrument labels Oct 2, 2026
@leowerneck leowerneck added this to IMAP Oct 2, 2026
@leowerneck leowerneck moved this to PR Open in IMAP Oct 2, 2026
@leowerneck

Copy link
Copy Markdown
Collaborator Author

@hafarooki Your review would also be appreciated.

@leowerneck leowerneck changed the title Lw/issue21 gse sun SWAPI: Add *_gse_earth and *_gse_sun quantities Oct 2, 2026
Comment thread docs/swapi/alpha-sw.md Outdated
Comment thread docs/swapi/proton-sw.md Outdated
Comment thread docs/swapi/alpha-sw.md Outdated
Comment thread docs/swapi/proton-sw.md Outdated
Comment thread imap_l3_processing/cdf/config/imap_swapi_l3a_global_cdf_attrs.yaml Outdated
Comment thread imap_l3_processing/cdf/config/imap_swapi_l3a_global_cdf_attrs.yaml Outdated
NAME: proton_sw_velocity_gse_earth
DATA_TYPE: CDF_REAL4
FIELDNAM: Proton Solar Wind Velocity (GSE, Earth Frame)
CATDESC: Solar wind proton bulk velocity vector in GSE coordinates (Earth frame)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CATDESC supposed to have a period at the end?

@leowerneck leowerneck Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any other example in that file that ends with a period:

grep -E '^[[:space:]]*CATDESC:.*\.$' imap_l3_processing/cdf/config/imap_swapi_l3a_variable_attrs.yaml

returns nothing.

Comment thread imap_l3_processing/cdf/config/imap_swapi_l3a_variable_attrs.yaml Outdated
Comment thread imap_l3_processing/cdf/config/imap_swapi_l3a_variable_attrs.yaml Outdated
Comment thread imap_l3_processing/swapi/l3a/utils.py Outdated
Comment thread imap_l3_processing/swapi/l3a/utils.py Outdated
Comment thread imap_l3_processing/swapi/swapi_processor.py Outdated
eclipj2000_from_rtn = get_rotation_matrix(
et, SpiceFrame.IMAP_RTN, SpiceFrame.ECLIPJ2000
)
gse_from_eclipj2000 = spiceypy.sxform(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments are needed to explain the shapes and dimensions of these arrays

@leowerneck leowerneck changed the title SWAPI: Add *_gse_earth and *_gse_sun quantities SWAPI: Add velocity, covariance, and uncertainty in GSE coordinates Oct 7, 2026
@jtniehof

jtniehof commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

My big question before looking at details: have we confirmed exactly what WIND is reporting as GSE? Is it GSE relative to Sun, GSE less a fixed 30km/s in Y, or a "proper" aGSE rotated into SW (nominal or actual)? Since matching WIND (and other L1) is a key driver, we should be as precise as we can. Has someone looped in with Savvas?

(Slow on the uptake here because I've been focusing on the release 2 issues).

@leowerneck

leowerneck commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

After discussions with @mmshaw and @mecuesta, combined with the result of the long email thread, my understanding is that IMAP will report GSE in the Earth's frame, and that it should be called "_gse" (not "_gse_earth"). We won't try to match other missions if they use something else.

My goal for this PR was to introduce GSE (not aGSE) coordinates in the Earth's frame. The steps I took were:

  • Rotate the Sun-frame RTN velocity into ECLIPJ2000.
  • Use SPICE to subtract Earth's velocity.
  • Use SPICE to apply a full 6x6 state transform from ECLIPJ2000 to GSE.

Hameed can correct me if I'm wrong, but I believe he found that WIND/OMNI use GSE coordinates in the Sun's frame. I haven't looped in with Savvas.

@leowerneck

Copy link
Copy Markdown
Collaborator Author

Pinging @mmshaw and @mecuesta for comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Ins: SWAPI Related to the SWAPI instrument

Projects

Status: PR Open

Development

Successfully merging this pull request may close these issues.

3 participants