Repository navigation
Restore TT2000 typing for integer epoch attributes - #349
Merged
bryan-harter merged 1 commit intoOct 20, 2026
Merged
bryan-harter merged 1 commit into
bryan-harter merged 1 commit into
Conversation
bryan-harter
approved these changes
Oct 20, 2026
leowerneck
deleted the
348---bug-all-time-typed-variables-skipped-in-xarray_to_cdf
branch
October 20, 2026 21:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Closes #348. Closes IMAP-Science-Operations-Center/imap_processing#3579.
Description
#344 stopped casting
FILLVAL,VALIDMIN, andVALIDMAXto the variable's type for all time-typed variables (CDF_EPOCH,CDF_EPOCH16,CDF_TIME_TT2000). That was only needed for non-integer values that can't be represented as TT2000 and overflow on read-back. Integer attributes, the usual case for TT2000 variables, are now written asCDF_INT8instead ofCDF_TIME_TT2000, breaking ISTP compliance.This PR skips the cast for time-typed variables only when the attribute value is not an integer. Integer values are cast to the variable's type as they were before #344, and non-integer values are still left alone, so the #343 fix is kept.
Two regression tests are added to
tests/test_xarray_reader_writer.py:test_xarray_to_cdf_casts_istp_integer_epoch_attributes_to_tt2000: integer attributes on a TT2000 variable are written asCDF_TIME_TT2000, and integer attributes on a non-time variable stayCDF_INT8. Fails onmain.test_xarray_to_cdf_preserves_istp_float_epoch_attributes: float attributes on a TT2000 variable are not cast to TT2000 and round-trip throughcdf_to_xarraywithout overflowing. Fails if the cast is applied unconditionally, as it was before Fix datetime conversion failures observed with NumPy 2.5 #344.Testing
Running:
results in 113 passed.