Skip to content
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

Merged
merged 2 commits into from
Apr 12, 2018
Merged

Conversation

rabernat
Copy link
Contributor

@rabernat rabernat commented Apr 10, 2018

This was a very simple fix for an issue that has vexed me for quite a while. Am I missing something obvious here?

return Variable(dimensions, indexing.LazilyOuterIndexedArray(data),
attributes, encoding=encoding)
if not isinstance(data, dask_array_type):
data = indexing.LazilyOuterIndexedArray(data)
Copy link
Contributor Author

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.

Copy link
Member

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.

@rabernat rabernat requested a review from fujiisoup April 10, 2018 15:58
'y': ('t', [5, 10, -999], {'_FillValue': -999})
}).chunk({'t': 1})
decoded = conventions.decode_cf(original)
assert dask.is_dask_collection(decoded.y.data)
Copy link
Contributor Author

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.

Copy link
Member

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.

@rabernat
Copy link
Contributor Author

Travis failures are for GenericNetCDFDataTest.test_cross_engine_read_write_netcdf3 and appear to be unrelated to this PR.

Copy link
Member

@shoyer shoyer left a 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)
Copy link
Member

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)
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decode_cf() loads chunked arrays
2 participants