Skip to content

Commit d98b8d1

Browse files
committed
refactor of preview to avoid rechunking
1 parent f97050e commit d98b8d1

File tree

4 files changed

+638
-163
lines changed

4 files changed

+638
-163
lines changed

xrspatial/perlin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _fade(t):
5151

5252
@jit(nopython=True, nogil=True)
5353
def _gradient(h, x, y):
54-
out = np.zeros(h.shape)
54+
out = np.zeros(h.shape, dtype=np.float32)
5555
for j in nb.prange(h.shape[1]):
5656
for i in nb.prange(h.shape[0]):
5757
hv = h[i, j] & 3
@@ -65,8 +65,8 @@ def _perlin(p, x, y):
6565
# coordinates of the top-left (floor, not truncate, so negatives work)
6666
x_floor = np.floor(x)
6767
y_floor = np.floor(y)
68-
xi = x_floor.astype(int)
69-
yi = y_floor.astype(int)
68+
xi = x_floor.astype(np.int32)
69+
yi = y_floor.astype(np.int32)
7070

7171
# mask to 0-255 range for 512-element table
7272
xi = xi & 255

0 commit comments

Comments
 (0)