Package: viswaternet
An open-source Python package for easy generation and customization of water distribution network visualizations. Find thedocumentation here.Dependenciesâ—‰ WNTR â—‰ NetworkX 2.7+ â—‰ Matplotlib 3.5.0+ â—‰ Pandas â—‰ NumPy â—‰ imageio â—‰VisWaterNet has been tested on Python3.8and3.9.FeaturesVisWaterNet is designed to plot simulation data onto a network graph, with a large variety of customization options available. The package includes the capabilities to:Discretize network or simulation data.Visualize discretized or continuous data on network graphs.Import data from excel files or data generated with Python.Create GIFs of data across simulation timesteps.Customize style of virtually every element of the network graph, including: reservoirs, tanks, valves, pumps, links, and nodes.Draw labels relative to nodes or based on an absolute position on the figure.Draw specific nodes or links with their own data and style.InstallationTo install VisWaterNet, run this command in your terminal:pipinstallviswaternetAlternatively, the sources for VisWaterNet can be downloaded from the Github repo. You can clone the public repository:gitclonegit://github.com/tylertrimble/viswaternetOnce you have a copy of the source, you can install it with:pythonsetup.pyinstallGetting StartedTo get started, import the VisWaterNet package:importviswaternetasvisNext, initialize a VisWaterNet model. For example purposes, we use the CTown network fromOstfeld (2016)included in the Examples folder:model=vis.VisWNModel('Networks/CTown.inp')Then, call on any of the plotting functions with the argument inputs of your choice. For example, the following line of code displays the network layout of CTown with each node colored according its mean pressure (inpsi). This is acontinuousnode plot, where the nodal colors are assigned based a gradient scale:model.plot_continuous_nodes(parameter="pressure",value='mean',unit="psi")We can represent the same data in a different way by generating adiscretenode plot in which mean pressure data is grouped into 4 discrete intervals and node colors are assigned based on the corresponding value shown on a legend:model.plot_discrete_nodes(parameter="pressure",value='mean',unit="psi",legend_loc_2='lower left',intervals=[0,40,80,120],legend_sig_figs=0)If the plot does not show up after you run the script, it is possible that your IDE does not support interactive plotting (e.g., IDLE) or interactive mode is off. To see the plot, add the following line to display the figures:plt.show()Since several VisWaterNet function arguments rely on Matplotlib visualization inputs, it is recommended to visit theMatplotlib docsto view customization options forcolors,colorbars,node markers,line styles, etc.More examples that demonstrate the range of VisWaterNet’s plotting abilities can be found in theExample Applicationssection of the docs.ContributingWe welcome contributions in the form of suggestions, feedback, reports of bugs, and additions to code functionality and documentation from all users! You can find instructions to raise issues, submit pull requests, andrun automated testsin thedocsor theCONTRIBUTING page.ContactTyler Trimble -tylerl.trimble@utexas.eduMeghna Thomas -meghnathomas@utexas.eduLina Sela -linasela@utexas.eduCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History1.2.0 (2023-08-01)Overhauled animate_plot function to allow for plotting of custom data and use different file formatsPlotting custom data now uses new parameter data_file instead of parameterImproved initilization time by switching to numpyFixed blank figure appearing before plotting occurs1.1.0a (2023-03-15)Fixed colorbar functionality with subplotsAdded ability to customize colorbar sizeLegend/colorbar labels are automatically generated based on parameter/value typeA default matplotlib figure and axis is created if no axis is specifiedFixed deprecation issue with matplotlib colormapsUpdated supported versions of dependeciesUpdated supported python versions1.0.0 (2023-02-07)Greatly improved animate_plot() function speedFixed numerous bugs related to excel data plottingAdded ability to use directional arrows with continuous plots0.1.5 (2023-01-22)Complete documentationFixed animate plot bugsChanged how num_interval parameter worksFixed warnings0.1.4 (2022-12-19)Updated requirements0.1.3 (2022-12-17)Bug fixesSome documentation added0.1.2 (2022-11-11)Rename package once more to avoid confusion with R package ‘visnetwork’.0.1.1 (2022-11-11)Fix import errors due to package name change.0.1.0 (2022-11-11)First release on PyPI.