wntr.metrics.misc module

The wntr.metrics.misc module contains metrics that do not fall into the topographic, hydraulic, water quality, water security, or economic categories.

Contents

query(arg1, operation, arg2) Returns a boolean mask using comparison operators, i.e.
population(wn[, R]) Compute population per node, rounded to the nearest integer [USEPA15].
population_impacted(pop, arg1[, operation, arg2]) Computes population impacted using comparison operators.
wntr.metrics.misc.query(arg1, operation, arg2)[source]

Returns a boolean mask using comparison operators, i.e. “arg1 operation arg2”. For example, this can be used to return the node-time pairs when demand < 90% expected demand.

Parameters:
arg1 : pandas DataFrame, pandas Series, numpy array, list, scalar

Argument 1

operation : numpy ufunc

Numpy universal comparison function, options = np.greater, np.greater_equal, np.less, np.less_equal, np.equal, np.not_equal

arg2 : same size and type as arg1, or a scalar

Argument 2

Returns:
A boolean mask (same size and type as arg1)
wntr.metrics.misc.population(wn, R=8.76157e-06)[source]

Compute population per node, rounded to the nearest integer [USEPA15].

\[pop=\dfrac{expected_demand}{R}\]
Parameters:
wn : wntr WaterNetworkModel
R : float (optional, default = 0.00000876157 m3/s = 200 gallons/day)

Average volume of water consumed per capita per day in m3/s

Returns:
A pandas Series that contains population per node
wntr.metrics.misc.population_impacted(pop, arg1, operation=None, arg2=None)[source]

Computes population impacted using comparison operators. For example, this can be used to find the population impacted when demand < 90% expected.

Parameters:
pop : pd.Series (index = node names)

A pandas Series that contains population per node

arg1 : pd.DataFrame (columns = node names) or pd.Series (index = node names)

Argument 1

operation : numpy.ufunc

Numpy universal comparison function, options = np.greater, np.greater_equal, np.less, np.less_equal, np.equal, np.not_equal

arg2 : same size and type as arg1, or a scalar

Argument 2

Returns:
A pandas Series that contains population impacted per node