Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions flopy/utils/rasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ def resample_to_grid(
arr = arr.flatten()

# step 3: use griddata interpolation to snap to grid
data = griddata((rxc, ryc), arr, (xc, yc), method=method)
rescale = method in ("linear", "nearest")
data = griddata((rxc, ryc), arr, (xc, yc), method=method, rescale=rescale)

elif method in ("median", "mean", "min", "max", "mode"):
# these methods are slow and could use speed ups
Expand Down Expand Up @@ -578,7 +579,9 @@ def resample_to_grid(
ryc = ryc[idx]
arr = arr[idx]

extrapolate = griddata((rxc, ryc), arr, (xc, yc), method="nearest")
extrapolate = griddata(
(rxc, ryc), arr, (xc, yc), method="nearest", rescale=True
)
data = np.where(np.isnan(data), extrapolate, data)

# step 4: return grid to user in shape provided
Expand Down
Loading