Metadata-Version: 2.1
Name: viswaternet
Version: 2.2.3
Summary: A python package for easy generation and customization of water network graphs.
Home-page: https://github.com/tylertrimble/viswaternet
Author: Tyler Trimble
Author-email: TylerL.Trimble@gmail.com
License: MIT license
Keywords: viswaternet
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: pandas
Requires-Dist: openpyxl
Requires-Dist: numpy
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: wntr
Requires-Dist: imageio
Requires-Dist: imageio-ffmpeg
Requires-Dist: networkx<=3.3,>=2.7

.. image:: https://github.com/tylertrimble/viswaternet/blob/main/logo/viswaternet_logo.png?raw=true
		:target: https://github.com/tylertrimble/viswaternet/blob/main/logo/viswaternet_logo.png?raw=true

.. image:: https://joss.theoj.org/papers/10.21105/joss.05139/status.svg
        :target: https://doi.org/10.21105/joss.05139

.. image:: https://img.shields.io/pypi/v/viswaternet.svg
        :target: https://pypi.python.org/pypi/viswaternet

.. image:: https://readthedocs.org/projects/viswaternet/badge/?version=latest
        :target: https://viswaternet.readthedocs.io/en/latest/
        :alt: Documentation Status

.. image:: https://img.shields.io/pypi/l/ansicolortags.svg
        :target: https://pypi.python.org/pypi/ansicolortags/
    

An open-source Python package for easy generation and customization of water distribution network visualizations. Find the `documentation here`_.

.. _`documentation here`: https://viswaternet.readthedocs.io


Dependencies
------------
â—‰ WNTR â—‰ NetworkX 2.7+ â—‰ Matplotlib 3.5.0+ â—‰ Pandas â—‰ NumPy â—‰ imageio â—‰

VisWaterNet has been tested on Python **3.8+**.

Features
--------
VisWaterNet 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.

Installation
---------------
To install VisWaterNet, run this command in your terminal:

.. code:: python

    pip install viswaternet
    
Alternatively, the sources for VisWaterNet can be downloaded from the Github repo. You can clone the public repository:

.. code:: python

    git clone git://github.com/tylertrimble/viswaternet

Once you have a copy of the source, you can install it with:

.. code:: python

    python setup.py install

Getting Started
---------------
To get started, import the VisWaterNet package:

.. code:: python

    import viswaternet as vis
    
Next, initialize a VisWaterNet model and optionally a style object. For example purposes, we use the CTown network from `Ostfeld (2016)`_ included in the Examples folder:

.. code:: python

    model = vis.VisWNModel('Networks/CTown.inp')
    style = vis.NetworkStyle(discrete_legend_loc='lower left', legend_sig_figs=0)
.. _`Ostfeld (2016)`: https://uknowledge.uky.edu/wdst_models/2/
    
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 (in *psi*). This is a **continuous** node plot, where the nodal colors are assigned based a gradient scale:

.. code:: python

    model.plot_continuous_nodes(parameter="pressure", value='mean', unit="psi")
    
.. figure:: logo/readme1.png
   :width: 600
   :alt: Basic network layout

We can represent the same data in a different way by generating a **discrete** node 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:

.. code:: python

    model.plot_discrete_nodes(parameter="pressure", value='mean', unit="psi",
                              intervals = [0,40,80,120],
                              style=style)

.. figure:: logo/readme2.png
   :width: 600
   :alt: Basic network layout

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: 

.. code:: python

    plt.show()

Since several VisWaterNet function arguments rely on Matplotlib visualization inputs, it is recommended to visit the `Matplotlib docs`_ to view customization options for `colors`_, `colorbars`_, `node markers`_, `line styles`_, etc.

.. _`Matplotlib docs`: https://matplotlib.org/stable/index.html
.. _`colors`: https://matplotlib.org/stable/gallery/color/named_colors.html
.. _`colorbars`: https://matplotlib.org/stable/tutorials/colors/colormaps.html#sphx-glr-tutorials-colors-colormaps-py
.. _`node markers`: https://matplotlib.org/stable/gallery/lines_bars_and_markers/marker_reference.html
.. _`line styles`: https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html

More examples that demonstrate the range of VisWaterNet's plotting abilities can be found in the `Example Applications`_ section of the docs.

.. _`Example Applications`: https://viswaternet.readthedocs.io/en/latest/examples.html

Contributing
------------
We 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, and `run automated tests`_ in the `docs`_ or the `CONTRIBUTING page`_.

.. _`CONTRIBUTING page`: https://github.com/tylertrimble/viswaternet/blob/main/CONTRIBUTING.rst
.. _`docs`: https://viswaternet.readthedocs.io/en/latest/contributing.html
.. _`run automated tests`: https://viswaternet.readthedocs.io/en/latest/contributing.html#testing

Cite Us
-------

To cite VisWaterNet, please use the following publication: `VisWaterNet: A Python package for visualization of water distribution networks`_

.. _`VisWaterNet: A Python package for visualization of water distribution networks`: https://joss.theoj.org/papers/10.21105/joss.05139

::

    @article{doi:10.21105/joss.05139,
     title={VisWaterNet: A Python package for visualization of water distribution networks},
     author={Thomas, Meghna and Trimble, Tyler and Sela, Lina},
     journal={Journal of Open Source Software},
     volume={8},
     number={84},
     pages={5139},
     year={2023}}

Contact
-------
Tyler Trimble - tylerl.trimble@utexas.edu

Meghna Thomas - meghnathomas@utexas.edu

Lina Sela - linasela@utexas.edu

Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
History
=======
2.2.2 (2024-10-22)
-----------------------
*Fixed draw_links() issue when trying to customize specific links.
*Fixed default style typo causing error when link color is not specified.

2.2.1 (2024-7-30)
-----------------------
*Fix bug with models that use the same names for pipes and nodes.
*Allow for custom color maps

2.2.0 (2024-7-30)
-----------------------
*Added additional colorbar style options: Colorbar location, label location, font color, and font size.
*Updated Python dependency to be 3.8+

2.1.0 (2024-05-25)
-----------------------
* Added new style object
* Converted all functions to work with style objects

2.0.0 (2024-04-12)
-----------------------
* Added new label customization options
* Added ability to plot valves as links, and pumps as markers
* Added EPANET icons for pumps, valves, reservoirs, and tanks.
* Renamed, consolidated many arguments for clarity and to reduce # of aruments.
* Removed superfluous arguments.
* Added ability to make discrete legend text color align with interval color. 
* Legend label colors can now be changed independently for base legend and discrete legend.
* Title color for discrete legend can now be changed.
* Rewrote code to use data structures more consistently.
* Base links and nodes are now only drawn when necessary when not all nodes/links have data associated with them.
* Added ability to choose to include pump/valve or reservoir/tank data.
* Further improved animate plot speed for excel data plotting
* Animate plot output layout now conforms to normal plotting layout.
* Fixed discrete plotting when empty interval is present.
* Fixed animation issue where color bar label would be cut off.
* Fixed animation of custom data and excel data
* Fixed node size legend not properly showing up
* Fixed case where base elements legend and discrete legend were joined into one legend
* Fixed missing argument passes
* Fixed instances where network elements don't know show up when they should.

1.2.0 (2023-08-01)
------------------
* Overhauled animate_plot function to allow for plotting of custom data and use different file formats
* Plotting custom data now uses new parameter data_file instead of parameter
* Improved initilization time by switching to numpy
* Fixed blank figure appearing before plotting occurs

1.1.0a (2023-03-15)
-------------------
* Fixed colorbar functionality with subplots
* Added ability to customize colorbar size
* Legend/colorbar labels are automatically generated based on parameter/value type
* A default matplotlib figure and axis is created if no axis is specified
* Fixed deprecation issue with matplotlib colormaps
* Updated supported versions of dependecies
* Updated supported python versions 

1.0.0 (2023-02-07)
------------------
* Greatly improved animate_plot() function speed
* Fixed numerous bugs related to excel data plotting
* Added ability to use directional arrows with continuous plots

0.1.5 (2023-01-22)
------------------
* Complete documentation
* Fixed animate plot bugs
* Changed how num_interval parameter works
* Fixed warnings

0.1.4 (2022-12-19)
------------------
* Updated requirements

0.1.3 (2022-12-17)
------------------
* Bug fixes
* Some documentation added

0.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.


