-
Notifications
You must be signed in to change notification settings - Fork 39
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
Consequences of changing the default calendar in cftime.datetime #173
Comments
I'm confused - you reported the bug that led to this change. Now it seems you are advocating a return to the state that triggered the bug? cftime.DatetimeGregorian instantiates cftime.datetime with calendar='gregorian' (which is the same thing as 'standard'). It looks to me that the calendar attribute is only used by the dayofwk and dayofyr properties. As you point out, setting calendar='' will cause those properties, or anything that uses them, to raise an exception. It doesn't make sense to me to have a datetime instance without a calendar. |
Hi - Sorry to be confusing! What I wish I'd said is "Can we further modify This would look like:
I am happy to create a PR for this, if everyone thinks that it is OK. The use case for this is that retaining the ability to not set a calendar on Whilst setting Thanks for your patience, |
Hello - I have just discovered that the calendar reverts to
I'm happy to suggest a fix, if you like, to preserve the input calendar for the output, unless it has been set with a kwarg. Thanks, |
OK, I understand better now. Please go ahead and submit a PR. |
Return the default values of dayofwk and dayofyr when calendar is '' (issue #173)
If I set a non-gregorian calendar in the initialization of a
cftime.datetime
object, then it is ignored in thedaysinmonth
calculation:This is surprising! The
dayofwk
attribute does indeed take the calendar into account.On a related note, is it still possible to encode a datetime with an unspecified calendar. This was possible when the default calendar was
''
, and was extremely useful for encoding a datetime that is meant to be interpreted in the context of one or calendars that are not yet known. At inspection time, the calendar value of''
tells my code to define a new datetime in the appropriate calendar so that comparisons can be made. I can't setcalendar=''
, as other things break (as expected):Is
cftime.datetime
any different, now, tocftime.DatetimeGregorian
? If so, can the calendar default on the base classcftime.dateime
be reverted to''
. In this case,dayofwk
, etc. would beNone
(say) when called on the base class. Is there a use case for having the default as'standard'
?Apologies for realizing these questions when these changes were being discussed - I have just found out when my units tests failed with 1.1.3!
Thanks, David
The text was updated successfully, but these errors were encountered: