-
Notifications
You must be signed in to change notification settings - Fork 19
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
dask: Data_asreftime
; Data._asdatetime
; Data.year
& friends
#322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic. All good, save some typos and possibly one minor aspect as raised in-line. Thanks again David, please merge when ready (and feel free to mark the properties as @daskified
as well if you would like to).
|
||
**Examples** | ||
|
||
>>> import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably unnecessary and somewhat distracting - the example snippet is not doctest-able anyway as-is unless you instead use cf.data.dask_utils.cf_YMDmhs
...
>>> import numpy as np |
|
||
**Examples** | ||
|
||
>>> import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the equivalent reason to the above:
>>> import numpy as np |
|
||
**Examples** | ||
|
||
>>> import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> import numpy as np |
Hi Sadie, thanks for the review. I found that the @daskified decorator didn't work with methods decorated with # Not @daskified
>>> cf.Data([1, 2], 'days since 2000-01-01').second
<CF Data(2): [0, 0]>
# @daskified
>>> cf.Data([1, 2], 'days since 2000-01-01').second
<bound method daskified.<locals>.decorator.<locals>.wrapper of <CF Data(2): [2000-01-02 00:00:00, 2000-01-03 00:00:00]>> so I'll leave that for now. I'm inclined to leave the numpy imports :) I find it useful to for everything to be defined for the reader. Happy to be persuaded otherwise, though! |
Whilst testing the decorator, I found that initialising a Data object with a size 1 datetime wasn't working. I'll put in a fix as another commit on this PR: >>> cf.Data([1, 2], 'days since 2000-01-01')
<CF Data(2): [2000-01-02 00:00:00, 2000-01-03 00:00:00]>
>>> cf.Data([1], 'days since 2000-01-01')
traceback
...
AttributeError: 'cftime._cftime.DatetimeGregorian' object has no attribute 'dtype' |
... OK, it's not in the |
Hi David, that's all fine to me! Regarding:
I guess you tried to add it above the
So hopefully just popping it below will work. To help us keep track I'll try adding those in now as a follow-up commit. |
Ah ha! Thanks for showing me how to decorate the properties. |
No description provided.