Skip to content

Commit

Permalink
update(resample_to_grid): filter raster nan values from scipy resampl…
Browse files Browse the repository at this point in the history
…ing routines
  • Loading branch information
jlarsen-usgs committed Aug 7, 2024
1 parent 4321b0b commit 59037ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flopy/utils/rasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,13 @@ def resample_to_grid(
arr = self.get_array(band, masked=True)
arr = arr.flatten()

# filter out nan values from the original dataset
if np.isnan(np.sum(arr)):
idx = np.isfinite(arr)
rxc = rxc[idx]
ryc = ryc[idx]
arr = arr[idx]

# step 3: use griddata interpolation to snap to grid
data = griddata(
(rxc, ryc),
Expand Down

0 comments on commit 59037ef

Please sign in to comment.