water_service_availability#

module wntr.metrics.hydraulic

water_service_availability(expected_demand, demand)[source]#

Compute water service availability (WSA) at junctions, defined as follows:

\[WSA = \dfrac{demand}{expected\_demand}\]

where \(demand\) is the actual demand computed from a hydraulic simulation, and \(expected\_demand\) is the expected demand computed from base demands and demand patterns. Expected demand can be computed using the expected_demand method.

WSA can be averaged over times and/or nodes (see below). If expected demand is 0 for a particular junction, water service availability will be set to NaN for that junction.

  • To compute water service availability for each junction and timestep, expected_demand and demand should be pandas DataFrames (index = times, columns = junction names).

  • To compute an average water service availability for each junction (averaged over time), expected_demand and demand should be a pandas Series, indexed by junction. To convert a DataFrame (index = times, columns = junction names) to a Series indexed by junction, use the following code:

    \(expected\_demand.sum(axis=0)\)

    \(demand.sum(axis=0)\)

  • To compute an average water service availability for each timestep (averaged over junctions), expected_demand and demand should be a pandas Series, indexed by time. To convert a DataFrame (index = times, columns = junction names) to a Series indexed by time, use the following code:

    \(expected\_demand.sum(axis=1)\)

    \(demand.sum(axis=1)\)

Parameters:
  • expected_demand (pandas DataFrame or pandas Series (see note above)) – Expected demand at junctions

  • demand (pandas DataFrame or pandas Series (see note above)) – Actual demand (generally from a PDD hydraulic simulation) at junctions

Returns:

  • A pandas DataFrame or pandas Series that contains water service

  • availability.