Skip to content

Fix hi goodtimes CDF to txt convertor#2888

Merged
subagonsouth merged 6 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2879-bug---hi-goodtimes-text-convertor-write-out-goodtimes-only
Apr 3, 2026
Merged

Fix hi goodtimes CDF to txt convertor#2888
subagonsouth merged 6 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2879-bug---hi-goodtimes-text-convertor-write-out-goodtimes-only

Conversation

@subagonsouth
Copy link
Copy Markdown
Contributor

@subagonsouth subagonsouth commented Mar 30, 2026

Change Summary

This PR only changes logic used to write CDF files to txt. This is not used in producing goodtimes products. It is only used by the IT to convert the CDF to a txt format used on IBEX so that Paul's tools will work with the goodtimes txt file.

The previous logic was not what Paul wanted. He wants the list to indicate the goodtimes only. I was previously writing out the culled times.

Closes: #2879

@subagonsouth subagonsouth requested a review from Copilot March 30, 2026 20:14
@subagonsouth subagonsouth self-assigned this Mar 30, 2026
@subagonsouth subagonsouth added the Ins: Hi Related to the IMAP-Hi instrument label Mar 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates IMAP-Hi goodtimes interval extraction and TXT export so the generated TXT represents good time/bin regions (rather than writing out culled regions), matching the requested downstream “IBEX-style” goodtimes text format conversion workflow.

Changes:

  • Reworked GoodtimesAccessor.get_good_intervals() to group by ESA sweeps and emit intervals only for good bin regions.
  • Updated write_txt() output formatting and updated unit tests to reflect sweep-based grouping and “good-only” intervals.
  • Adjusted tests to use xarray.Dataset.sizes where appropriate.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
imap_processing/hi/hi_goodtimes.py Changes interval extraction to sweep-grouping and updates TXT writer formatting to output good-only intervals.
imap_processing/tests/hi/test_hi_goodtimes.py Updates expectations for the new sweep-based grouping and good-only interval output, plus minor xarray API usage tweaks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@subagonsouth subagonsouth added this to the April 2026 milestone Apr 1, 2026
Copy link
Copy Markdown
Contributor

@lacoak21 lacoak21 left a comment

Choose a reason for hiding this comment

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

Looks good to me! I just had one clarifying question.

# Find transitions: +1 = start of group, -1 = end of group
diff = np.diff(padded.astype(int))
starts = np.flatnonzero(diff == 1)
# We need to adjust ends for the shortening from diffs performed.
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.

Nice comment addition

@subagonsouth subagonsouth merged commit 8681161 into IMAP-Science-Operations-Center:dev Apr 3, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this to Done in IMAP Apr 3, 2026
@subagonsouth subagonsouth deleted the 2879-bug---hi-goodtimes-text-convertor-write-out-goodtimes-only branch April 3, 2026 21:29
@subagonsouth subagonsouth removed this from the April 2026 milestone Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ins: Hi Related to the IMAP-Hi instrument

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BUG - Hi Goodtimes text convertor write out goodtimes only

3 participants