Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REVISITED - df.cdfepoch.encode_tt2000 and cdf.cdfepoch.breakdown_tt2000 - unexpected return values during or just after leap second #296

Open
EsaRiihonen opened this issue Jan 21, 2025 · 0 comments
Assignees

Comments

@EsaRiihonen
Copy link

I closed earlier issue as it seemed that the recent version corrected the problem – alas not. The output changed but the results are still erroneous.

cdflib-1.3.3
Python-3.9.7

Below are the results from a test around the latest leap second.

cdfepoch.parse seems to work correctly as the resulting tt2000 epoch values are as expected. However cdfepoch.encode has a problem during the leap second and cdfepoch.breakdown in addition also during the first second after the leap second.

TEST

import cdflib as cdf

tt2000_check = cdf.cdfepoch.parse(['2016-12-31T23:59:59.000000000',
                                   '2016-12-31T23:59:60.000000000',
                                   '2016-12-31T23:59:60.500000000',
                                   '2017-01-01T00:00:00.000000000',
                                   '2017-01-01T00:00:01.000000000',])
for tt2000 in tt2000_check:
    print(tt2000)

> 536500867184000000
> 536500868184000000
> 536500868684000000
> 536500869184000000
> 536500870184000000
cdf.cdfepoch.encode_tt2000(tt2000_check)

> ['2016-12-31T23:59:59.000000000',    <--- OK
>  '2016-12-31T23:60:00.000000000',    <--- ??? 
>  '2016-12-31T23:60:00.500000000',    <--- ???
>  '2017-01-01T00:00:00.000000000',    <--- OK
>  '2017-01-01T00:00:01.000000000']    <--- OK
cdf.cdfepoch.breakdown_tt2000(tt2000_check)

> array([[2016,   12,   31,   23,   59,   59,    0,    0,    0],    <--- OK
>        [2016,   12,   31,   23,   60,    0,    0,    0,    0],    <--- ???
>        [2016,   12,   31,   23,   60,    0,  500,    0,    0],    <--- ???
>        [2016,   12,   31,   23,   60,    0,    0,    0,    0],    <--- ???
>        [2017,    1,    1,    0,    0,    1,    0,    0,    0]])   <--- OK
@bryan-harter bryan-harter self-assigned this Jan 22, 2025
@bryan-harter bryan-harter moved this from To triage to Backlog in cdflib development Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
2 participants