Created
February 12, 2020 13:29
-
-
Save astrofrog/d833250615bf45104f3f67f7920a5c7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import uuid | |
import numpy as np | |
import dask.array as da | |
class ArrayLikeObject: | |
def __init__(self): | |
self._array = np.ones((20, 30), dtype=float) | |
def __getitem__(self, item): | |
return self._array[item] | |
@property | |
def shape(self): | |
return self._array.shape | |
@property | |
def ndim(self): | |
return self._array.ndim | |
@property | |
def size(self): | |
return self._array.size | |
@property | |
def dtype(self): | |
return self._array.dtype | |
meta = np.zeros((0,), dtype=float) | |
start = time.time() | |
chunks = [[[[da.from_array(ArrayLikeObject(), name=str(uuid.uuid4()), meta=meta)] * 269] * 6] * 4] | |
print(time.time() - start) | |
data = da.block(chunks) | |
print(time.time() - start) | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I run this I get:
the shape is wrong?