Skip to content

Commit

Permalink
update(Raster): added min and max resampling for hydrologic resamplin…
Browse files Browse the repository at this point in the history
…g and streamflow representation
  • Loading branch information
jlarsen-usgs committed Nov 10, 2021
1 parent 3e770ec commit d6da642
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions flopy/utils/rasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ def resample_to_grid(
method=method,
)

elif method in ("median", "mean"):
# these methods are slow and could use a speed u
elif method in ("median", "mean", "min", "max"):
# these methods are slow and could use a speed up
ncpl = modelgrid.ncpl
data_shape = modelgrid.xcellcenters.shape
if isinstance(ncpl, (list, np.ndarray)):
Expand Down Expand Up @@ -455,8 +455,12 @@ def resample_to_grid(

if method == "median":
val = np.nanmedian(rstr_data)
else:
elif method == "mean":
val = np.nanmean(rstr_data)
elif method == "max":
val = np.nanmax(rstr_data)
else:
val = np.nanmin(rstr_data)

data[node] = val
else:
Expand Down Expand Up @@ -533,8 +537,12 @@ def __threaded_resampling(

if method == "median":
val = np.nanmedian(rstr_data)
else:
elif method == "mean":
val = np.nanmean(rstr_data)
elif method == "max":
val = np.nanmax(rstr_data)
else:
val = np.nanmin(rstr_data)
q.put((node, val))
container.release()

Expand Down

0 comments on commit d6da642

Please sign in to comment.