Skip to content

add new cf calendar 'tai' - #388

Merged
jswhit merged 7 commits into
masterfrom
tai
Jan 10, 2026
Merged

jswhit merged 7 commits into
masterfrom
tai

Conversation

@jswhit

@jswhit jswhit commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

same as 'proleptic_gregorian', but only valid for dates after 1958-01-01.

exceptions are raised if dates before 1958 are requested or a base date before 1958-01-01 is used.

Tests added by @ChrisBarker-NOAA

@jswhit

jswhit commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator Author

@ChrisBarker-NOAA could you take a look?

Comment thread src/cftime/_cftime.pyx
Comment thread src/cftime/_cftime.pyx Outdated

@ChrisBarker-NOAA ChrisBarker-NOAA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me -- thanks Jeff!

It could use some tests, though. maybe I'll find a bit of time to write a couple soon -- but don't wait for me.

Comment thread src/cftime/_cftime.pyx Outdated
Comment thread src/cftime/_cftime.pyx
@ChrisBarker-NOAA

ChrisBarker-NOAA commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Hmm -- I'm adding some tests -- stay tuned for that.

But looking at the code more, should assert_valid_date check for < 1958 for tai?

though it doesn't seem to know which calendar it's using, so I guess not, but there should be a check somewhere.

and there is -- before assert_valid_date() is called :-)

@ChrisBarker-NOAA

Copy link
Copy Markdown
Contributor

Looking, I can't tell for sure, but I think that a tai calendar could get a TZInfo attached to it, which should be illegal.

@ChrisBarker-NOAA

Copy link
Copy Markdown
Contributor

Scratch that -- I see that the cftime.datetime class init doesn't take that keyword anyway.

@ChrisBarker-NOAA

Copy link
Copy Markdown
Contributor

OK -- I did add tests -- see: #389

Once I was thinking about it, I figured why not?

@jswhit
jswhit merged commit 4b42d98 into master Jan 10, 2026
39 checks passed
@jswhit
jswhit deleted the tai branch January 10, 2026 15:38
@jswhit jswhit mentioned this pull request Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants