$ ipython
Python 2.7.11 (default, Dec 15 2015, 16:46:19)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import dask.array as da
In [2]: x = da.fromfunction(lambda i, j, k: i + j + k**2, chunks=(5, 512, 512), shape=(100, 2048, 2048), dtype='f8')
In [3]: x.to_hdf5('myfile.hdf5', '/x', compression='lzf', shuffle=True)
In [4]: import h5py
In [5]: f = h5py.File('myfile.hdf5')
In [6]: dset = f['/x']
In [7]: dset
Out[7]: <HDF5 dataset "x": shape (100, 2048, 2048), type "<f8">
In [8]: dset.chunks
Out[8]: (5, 512, 512)
In [9]: import dask.array as da
In [10]: x = da.from_array(dset, chunks=(5, 512, 512))
In [11]: x
Out[11]: dask.array<from-ar..., shape=(100, 2048, 2048), dtype=float64, chunksize=(5, 512, 512)>
In [12]: a = x[0, :5, :5]
In [13]: b = x[:, :5, :5]
In [14]: c = a - b.mean()
In [15]: c.compute()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-15-0c5d552d1b01> in <module>()
----> 1 c.compute()
/usr/local/lib/python2.7/dist-packages/dask/base.pyc in compute(self, **kwargs)
32
33 def compute(self, **kwargs):
---> 34 return compute(self, **kwargs)[0]
35
36 @classmethod
/usr/local/lib/python2.7/dist-packages/dask/base.pyc in compute(*args, **kwargs)
100 for opt, val in groups.items()])
101 keys = [arg._keys() for arg in args]
--> 102 results = get(dsk, keys, **kwargs)
103 return tuple(a._finalize(a, r) for a, r in zip(args, results))
104
/usr/local/lib/python2.7/dist-packages/dask/threaded.pyc in get(dsk, result, cache, num_workers, **kwargs)
55 results = get_async(pool.apply_async, len(pool._pool), dsk, result,
56 cache=cache, queue=queue, get_id=_thread_get_id,
---> 57 **kwargs)
58
59 return results
/usr/local/lib/python2.7/dist-packages/dask/async.pyc in get_async(apply_async, num_workers, dsk, result, cache, queue, get_id, raise_on_exception, rerun_exceptions_locally, callbacks, **kwargs)
481 _execute_task(task, data) # Re-execute locally
482 else:
--> 483 raise(remote_exception(res, tb))
484 state['cache'][key] = res
485 finish_task(dsk, key, state, results, keyorder.get)
AttributeError: 'thread._local' object has no attribute 'astype'
Traceback
---------
File "/usr/local/lib/python2.7/dist-packages/dask/async.py", line 263, in execute_task
result = _execute_task(task, data)
File "/usr/local/lib/python2.7/dist-packages/dask/async.py", line 244, in _execute_task
args2 = [_execute_task(a, cache) for a in args]
File "/usr/local/lib/python2.7/dist-packages/dask/async.py", line 245, in _execute_task
return func(*args2)
File "/usr/local/lib/python2.7/dist-packages/dask/array/core.py", line 48, in getarray
c = a[b]
File "/usr/lib/python2.7/dist-packages/h5py/_hl/dataset.py", line 367, in __getitem__
if self._local.astype is not None:
$ uname -a
Linux lealpc 3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux