Skip to content

Commit 813dd84

Browse files
committed
♻️ Rename pad to shift
1 parent 05358a1 commit 813dd84

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/pyiem/grid/util.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@
33
import numpy as np
44

55

6-
def grid_smear(grid: np.ndarray, pad: int = 4) -> np.ndarray:
6+
def grid_smear(grid: np.ndarray, shift: int = 4) -> np.ndarray:
77
"""Smear data around to fill in masked values (likely near coastlines).
88
99
Args:
1010
grid: 2D numpy array
11-
pad: number of pixels to smear the data around by in each direction
11+
shift: number of pixels to smear the data around by in each direction
1212
1313
Returns:
1414
2D numpy array with smeared data
1515
"""
1616
# Pad grid
1717
padded = np.ma.masked_all(
18-
(grid.shape[0] + pad * 2, grid.shape[1] + pad * 2)
18+
(grid.shape[0] + shift * 2, grid.shape[1] + shift * 2)
1919
)
2020
# set values from inbound grid
21-
padded[pad:-pad, pad:-pad] = grid
21+
padded[shift:-shift, shift:-shift] = grid
2222

23-
# shift the grid by 4 pixels in each direction to fill in the padded region
24-
for xorigin in [0, pad * 2]:
25-
for yorigin in [0, pad * 2]:
23+
# shift the grid by shift pixels in each direction to fill in the padded
24+
for xorigin in [0, shift * 2]:
25+
for yorigin in [0, shift * 2]:
2626
xslice = slice(xorigin, xorigin + grid.shape[0])
2727
yslice = slice(yorigin, yorigin + grid.shape[1])
2828
padded[xslice, yslice] = np.ma.where(
@@ -31,4 +31,4 @@ def grid_smear(grid: np.ndarray, pad: int = 4) -> np.ndarray:
3131
padded[xslice, yslice],
3232
)
3333

34-
return padded[pad:-pad, pad:-pad]
34+
return padded[shift:-shift, shift:-shift]

0 commit comments

Comments
 (0)