-
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
num2pydate loses millisecond information #144
Comments
Can you be more specific about what you mean by the 'millisecond information is lost'? Sorry this changed caused you grief. |
On second look, it seems to be related to parsing of arrays. I remember seeing an issue about this somewhere... import pprint
from cftime import num2date, num2pydate
time_calendar = 'gregorian'
time_unit = 'hours since 1970-01-01 00:00:00.0 +0000'
time_values = [0.0, 1.0, 2.0, 3.0, 4.0]
# Wrong?
pprint.pprint(num2date(time_values, units=time_unit, calendar=time_calendar))
# Correct?
pprint.pprint(num2pydate(time_values, units=time_unit, calendar=time_calendar))
# Correct?
pprint.pprint(num2date(time_values[2:3], units=time_unit, calendar=time_calendar)) Output:
|
This has been fixed by PR #146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 1.1.0 the num2pydate was added, as num2date no longer return a real_datetime. This change was rather annoying for me, as I was relying on the datetime'ish properties of real_datetime (e.g. being an instance of it). But as far as the bug is concerned:
One of my dates is 1970-01-01 02:00:00 and 13 milliseconds.
The text was updated successfully, but these errors were encountered: