-
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
Show microseconds in str() output, and suggestied change to repr() output #118
Comments
A pull request for both of these would be welcome, thanks. One comment on changing the repr() output for Datetime objects, the proposed change would be inconsistent with python datetime behaviour (which is similar to the current cftime behavior). I don't really mind - but someone might. |
Thanks. I'll put together a pull request, and see if any further comments or objections arise. |
thinking about it some more, it seems like >>> repr(dt)
'cftime.DatetimeGregorian(2000-02-13 12:34:23.123456)' implies that the DatetimeGregorian constructor accepts an ISO 8601 string. I think I'd prefer we leave the repr() behavior as it is, but keep your improvement to str(). |
Fair enough. I'm thinking of writing a pull request that would allow the |
Sure, that would be fine. |
PR merged, thansk! |
Hello,
Currently, fractions of seconds are not shown in the str() representation of a
cftime
date-time object:I would like to suggest that they are shown, in a ISOI 8601-compliant fashion (https://en.wikipedia.org/wiki/ISO_8601#General_principles), so that the str() output would look like:
I am happy to provide a pull request if this idea is accepted.
On a related note, might it be possible to alter the repr() output to improve its readaibility? I fully appreciate that this is subjective, and the developers have the last word, but I'll describe how it could perhaps be changed in case you agree!
We currently have:
I would like to suggest:
My use case for this is that I frequently inspect
numpy
arrays ofcftime
objects, and the current repr() output delivered bynumpy
is hard for a (this!) human to parse quickly. We currently have:... but I think the following is easier to read:
I think that this output is still true to that required by repr - i.e you can still recreate the original object from this information.
Again, I would happy to include this in a pull request.
Many thanks for considering this,
David
The text was updated successfully, but these errors were encountered: