Skip to content

Commit

Permalink
add logical "==" to filter_modpath_by_travel_time() (#1736)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarsen-usgs authored Feb 24, 2023
1 parent fb3504b commit ff9b926
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions flopy/plot/crosssection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def plot_pathline(
less than or equal to the passed time are plotted. If a
string is passed a variety logical constraints can be added
in front of a time value to select pathlines for a select
period of time. Valid logical constraints are <=, <, >=, and
period of time. Valid logical constraints are <=, <, ==, >=, and
>. For example, to select all pathlines less than 10000 days
travel_time='< 10000' would be passed to plot_pathline.
(default is None)
Expand Down Expand Up @@ -1184,7 +1184,7 @@ def plot_timeseries(
less than or equal to the passed time are plotted. If a
string is passed a variety logical constraints can be added
in front of a time value to select pathlines for a select
period of time. Valid logical constraints are <=, <, >=, and
period of time. Valid logical constraints are <=, <, ==, >=, and
>. For example, to select all pathlines less than 10000 days
travel_time='< 10000' would be passed to plot_pathline.
(default is None)
Expand Down
4 changes: 2 additions & 2 deletions flopy/plot/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ def plot_pathline(self, pl, travel_time=None, **kwargs):
less than or equal to the passed time are plotted. If a
string is passed a variety logical constraints can be added
in front of a time value to select pathlines for a select
period of time. Valid logical constraints are <=, <, >=, and
period of time. Valid logical constraints are <=, <, ==, >=, and
>. For example, to select all pathlines less than 10000 days
travel_time='< 10000' would be passed to plot_pathline.
(default is None)
Expand Down Expand Up @@ -809,7 +809,7 @@ def plot_timeseries(self, ts, travel_time=None, **kwargs):
less than or equal to the passed time are plotted. If a
string is passed a variety logical constraints can be added
in front of a time value to select pathlines for a select
period of time. Valid logical constraints are <=, <, >=, and
period of time. Valid logical constraints are <=, <, ==, >=, and
>. For example, to select all pathlines less than 10000 days
travel_time='< 10000' would be passed to plot_pathline.
(default is None)
Expand Down
18 changes: 14 additions & 4 deletions flopy/plot/plotutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2571,10 +2571,19 @@ def advanced_package_bc_helper(pkg, modelgrid, kper):

def filter_modpath_by_travel_time(recarray, travel_time):
"""
Helper method for filtering particles by travel time. Used in modpath
plotting routines
:param recarray:
:param travel_time:
:return:
Parameters
----------
recarray : np.recarray
recarray of modpath particle information
travel_time : str, float
travel time logical argument to filter modpath output
Returns
-------
np.recarray
"""
if travel_time is None:
tp = recarray.copy()
Expand All @@ -2583,6 +2592,7 @@ def filter_modpath_by_travel_time(recarray, travel_time):
funcs = {
"<=": lambda a, b: a["time"] <= b,
">=": lambda a, b: a["time"] >= b,
"==": lambda a, b: a["time"] == b,
"<": lambda a, b: a["time"] < b,
">": lambda a, b: a["time"] > b,
}
Expand All @@ -2600,7 +2610,7 @@ def filter_modpath_by_travel_time(recarray, travel_time):
raise Exception(
"flopy.map.plot_pathline travel_time variable cannot "
"be parsed. Acceptable logical variables are , "
"<=, <, >=, and >. "
"<=, <, ==, >=, and >. "
"You passed {}".format(travel_time)
)
else:
Expand Down

0 comments on commit ff9b926

Please sign in to comment.