-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #427 from kaklise/demos
Updates to the basic and geospatial demos
- Loading branch information
Showing
4 changed files
with
3,523 additions
and
726 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
""" | ||
The following example demonstrates how to import WNTR, generate a water network | ||
model from an INP file, simulate hydraulics, and plot simulation results on the network. | ||
The following example demonstrates how to import WNTR, create a water | ||
network model from an EPANET INP file, simulate hydraulics, and plot | ||
simulation results on the network. | ||
""" | ||
# Import WNTR | ||
import wntr | ||
|
||
# Create a water network model | ||
inp_file = 'networks/Net3.inp' | ||
wn = wntr.network.WaterNetworkModel(inp_file) | ||
|
||
# Graph the network | ||
wntr.graphics.plot_network(wn, title=wn.name) | ||
|
||
# Simulate hydraulics | ||
sim = wntr.sim.EpanetSimulator(wn) | ||
results = sim.run_sim() | ||
|
||
# Plot results on the network | ||
pressure_at_5hr = results.node['pressure'].loc[5*3600, :] | ||
wntr.graphics.plot_network(wn, node_attribute=pressure_at_5hr, node_size=30, | ||
title='Pressure at 5 hours') | ||
wntr.graphics.plot_network(wn, node_attribute=pressure_at_5hr, | ||
node_size=30, title='Pressure at 5 hours') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters