dask: Data_asreftime; Data._asdatetime; Data.year & friends#322
dask: Data_asreftime; Data._asdatetime; Data.year & friends#322davidhassell merged 3 commits intoNCAS-CMS:lama-to-daskfrom
Data_asreftime; Data._asdatetime; Data.year & friends#322Conversation
|
|
||
| **Examples** | ||
|
|
||
| >>> import numpy as np |
There was a problem hiding this comment.
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.
For the equivalent reason to the above:
| >>> import numpy as np |
|
|
||
| **Examples** | ||
|
|
||
| >>> import numpy as np |
There was a problem hiding this comment.
| >>> import numpy as np |
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
|
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.