-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix decode cf with dask #2047
Fix decode cf with dask #2047
Conversation
return Variable(dimensions, indexing.LazilyOuterIndexedArray(data), | ||
attributes, encoding=encoding) | ||
if not isinstance(data, dask_array_type): | ||
data = indexing.LazilyOuterIndexedArray(data) |
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.
This is the offending line which caused the dask arrays to stop being dask arrays. I have simply bypassed it for dask arrays. This didn't break any tests. But can we think of any unforeseen negative consequences? What does LazilyOuterIndexedArray
do here? I have to admit that I don't understand the details of our new indexing wrappers.
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.
LazilyOuterIndexedArray
makes indexing on non-dask arrays lazy. It's not necessary or useful for dask arrays.
'y': ('t', [5, 10, -999], {'_FillValue': -999}) | ||
}).chunk({'t': 1}) | ||
decoded = conventions.decode_cf(original) | ||
assert dask.is_dask_collection(decoded.y.data) |
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.
Is this an appropriate place to test for this? There is no other dask stuff in test_conventions.py
, but it seemed to make sense there.
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.
This looks like a fine place to me.
Travis failures are for |
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.
I don't think you're missing anything -- this looks good to me!
'y': ('t', [5, 10, -999], {'_FillValue': -999}) | ||
}).chunk({'t': 1}) | ||
decoded = conventions.decode_cf(original) | ||
assert dask.is_dask_collection(decoded.y.data) |
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.
This looks like a fine place to me.
return Variable(dimensions, indexing.LazilyOuterIndexedArray(data), | ||
attributes, encoding=encoding) | ||
if not isinstance(data, dask_array_type): | ||
data = indexing.LazilyOuterIndexedArray(data) |
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.
LazilyOuterIndexedArray
makes indexing on non-dask arrays lazy. It's not necessary or useful for dask arrays.
whats-new.rst
for all changes andapi.rst
for new APIThis was a very simple fix for an issue that has vexed me for quite a while. Am I missing something obvious here?