Skip to content

Commit 1e07dce

Browse files
committed
use da.pad when dealing with dask arrays
1 parent 88320ef commit 1e07dce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xarray/core/variable.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,12 @@ def _shift_one_dim(self, dim, count, fill_value=dtypes.NA):
11071107
dim_pad = (width, 0) if count >= 0 else (0, width)
11081108
pads = [(0, 0) if d != dim else dim_pad for d in self.dims]
11091109

1110-
data = np.pad(
1110+
if isinstance(trimmed_data, dask_array_type):
1111+
pad_func = da.pad
1112+
else:
1113+
pad_func = np.pad
1114+
1115+
data = pad_func(
11111116
trimmed_data.astype(dtype),
11121117
pads,
11131118
mode="constant",

0 commit comments

Comments
 (0)