Skip to content

DATE-OBS issue in dar.py - SUPER-EASY FIX #52

@cdfassnacht

Description

@cdfassnacht

Hi, I recently got an error while reducing data, where the code crashed because the DATE-OBS header key wasn't in the expected format. See the traceback below. While I don't know if adding the time to the DATE-OBS value, via the "Thh:mm:ss.s" added to the end of the string is fits standard, I have definitely seen this format several times. The fix is a super-simple change to dar.py - in line 324 in the version on the dev branch or line 325 in the version on the main branch:
Just change day = int(date[2]) ---> day = int(date[2][:2])
I've done this in my local version of KAI, but since the change is so quick, you can probably put it in the distributed version without any trouble.

Traceback (last few lines)

data.clean_drizzle(distXgeoim, distYgeoim, _bp, _ce, _wgt, _dlog,

File "/Users/cdf/git/KAI/kai/reduce/data.py", line 2458, in clean_drizzle
(_xgeoim, _ygeoim) = dar.darPlusDistortion(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cdf/git/KAI/kai/reduce/dar.py", line 406, in darPlusDistortion
(darCoeffL, darCoeffQ) = kaidar(inputFits, instrument=instrument,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cdf/git/KAI/kai/reduce/dar.py", line 324, in kaidar
day = int(date[2])
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '28T00:00:00.0'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions