You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#66 enabled working dayofyr and dayofwk attributes for all cftime dates constructed manually, which is great!
I've noticed that if one constructs datetime objects using replace, that the dayofyr and dayofwk attributes are not automatically updated:
In [21]: date = cftime.DatetimeNoLeap(1, 2, 1)
In [22]: date.dayofyr
Out[22]: 32
In [23]: date.replace(year=2, month=5).dayofyr
Out[23]: 32
A workaround is to specify dayofwk=-1 within replace:
In [24]: date.replace(year=2, month=5, dayofwk=-1).dayofyr
Out[24]: 121
Is this intentional? Should we not pass down the old dayofyr and dayofwk attributes to the new date object in replace? I'm happy to provide a PR to change this behavior, if desired.
The text was updated successfully, but these errors were encountered:
I incorporated your workaround into the replace method. If you can come up with something more elegant, feel free to create an alternative pull request.
#66 enabled working
dayofyr
anddayofwk
attributes for all cftime dates constructed manually, which is great!I've noticed that if one constructs datetime objects using
replace
, that thedayofyr
anddayofwk
attributes are not automatically updated:A workaround is to specify
dayofwk=-1
withinreplace
:Is this intentional? Should we not pass down the old
dayofyr
anddayofwk
attributes to the new date object inreplace
? I'm happy to provide a PR to change this behavior, if desired.The text was updated successfully, but these errors were encountered: