Skip to content

Commit 4371a31

Browse files
committed
Simplify get_pads
1 parent c91c2e2 commit 4371a31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

xarray/core/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,15 @@ def get_pads(
10001000
"""
10011001
pads = {}
10021002
for d, win, cent, p in zip(dim, window, center, pad):
1003+
if not p:
1004+
pads[d] = (0, 0)
1005+
continue
1006+
10031007
if cent:
10041008
start = win // 2 # 10 -> 5, 9 -> 4
10051009
end = (win - 1) // 2 # 10 -> 4, 9 -> 4
1006-
pads[d] = (start, end) if p else (0, 0)
1010+
pads[d] = (start, end)
10071011
else:
1008-
pads[d] = (win - 1, 0) if p else (0, 0)
1012+
pads[d] = (win - 1, 0)
10091013

10101014
return pads

0 commit comments

Comments
 (0)