Skip to content

Fix hi l1a tests broken by upgrade to cdflib 1.3.9#3008

Open
tmplummer wants to merge 1 commit intoIMAP-Science-Operations-Center:devfrom
tmplummer:3006-bug---write_cdf-incorrectly-coded-for-xarray_to_cdf-istp-default
Open

Fix hi l1a tests broken by upgrade to cdflib 1.3.9#3008
tmplummer wants to merge 1 commit intoIMAP-Science-Operations-Center:devfrom
tmplummer:3006-bug---write_cdf-incorrectly-coded-for-xarray_to_cdf-istp-default

Conversation

@tmplummer
Copy link
Copy Markdown
Contributor

Change Summary

Overview

Hi L1A processing was broken by upgrading to cdflib 1.3.9. The problem was actually that Hi L1A code was not passing check_schema=False to the CDF attributes manager for epoch and other coordinate variables. This PR fixes that.

Testing: No testing changes because existing tests failed once I updated my cdflib.

Closes: #3006

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

Fixes IMAP-Hi L1A dataset finalization to be compatible with cdflib 1.3.9 by bypassing schema validation when fetching CDF metadata for certain coordinate variables, preventing attribute/schema enforcement issues during CDF writing.

Changes:

  • Pass check_schema=False when retrieving CDF variable attributes for epoch in histogram and memdump dataset finalizers.
  • Pass check_schema=False when retrieving CDF variable attributes for the histogram angle coordinate.
Comments suppressed due to low confidence (1)

imap_processing/hi/hi_l1a.py:415

  • For the angle coordinate, hi_hist_angle attributes in imap_hi_variable_attrs.yaml include a dtype (uint16). Currently that dtype stays in attrs (so it may be written out as a CDF attribute) and np.arange(2, 360, 4) will default to int64. Consider copying the attrs, popping dtype, and explicitly creating/casting the coordinate data to that dtype before assigning attrs, to keep metadata clean and ensure the coordinate type matches the spec.
    attrs = attr_mgr.get_variable_attributes("hi_hist_angle", check_schema=False)
    dataset.coords.update(
        {
            "angle": xr.DataArray(
                np.arange(2, 360, 4),

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

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

BUG - write_cdf incorrectly coded for xarray_to_cdf istp default

2 participants