Suppress erfa warnings for future times #138
Merged
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.
Methods for synthetic datamodels like
create_wfi_image
generate metadata (create_meta
) with exposures (create_exposure
). Exposures contain times represented withastropy.time.Time
objects, which have limited support for times sufficiently far in the future. This stems from uncertainty due to upcoming leap seconds, which may (or may not) be added between now and far-ish future times. Far-ish future times can be initialized without a problem in some formats/scales, but if you translate them to some other formats, you get an ERFA warning about a "dubious year", like this:The unix time chosen in the example above is the upper limit on the randomly drawn times used by
roman_datamodels
:roman_datamodels/src/roman_datamodels/random_utils.py
Lines 42 to 44 in 086dd88
so the later randomly drawn times within the range will throw an erfa warning. We can dodge the warning by suppressing it directly or by changing the time range. Since the time range is meant to mimic Roman's mission duration, I opted for the former, and put in a switch (
ignore_erfa_warnings
) to recover the old behavior.This PR is in support of spacetelescope/jdaviz#1822.