Skip to content

Commit

Permalink
Fix order of applying region bound and value bounds for flow limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA committed Feb 10, 2023
1 parent 2ce000a commit 9eb3717
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ocsmesh/hfun/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,14 @@ def add_subtidal_flow_limiter(
hfun_values = np.abs((1./3.)*(topobathy/dh))
# values = values.filled(np.max(values))

if hmin is not None:
hfun_values[np.where(hfun_values < hmin)] = hmin

if hmax is not None:
hfun_values[np.where(hfun_values > hmax)] = hmax

# Don't consider the applied values in the region
# outside the provided bounds
if upper_bound is not None:
idxs = np.where(topobathy > upper_bound)
hfun_values[idxs] = self.get_values(
Expand All @@ -1371,12 +1379,8 @@ def add_subtidal_flow_limiter(
hfun_values[idxs] = self.get_values(
band=1, window=window)[idxs]

if hmin is not None:
hfun_values[np.where(hfun_values < hmin)] = hmin

if hmax is not None:
hfun_values[np.where(hfun_values > hmax)] = hmax

# Apply global hmin and hmax
if self._hmin is not None:
hfun_values[np.where(hfun_values < self._hmin)] = self._hmin
if self._hmax is not None:
Expand Down

0 comments on commit 9eb3717

Please sign in to comment.