Difference between revisions of "EPANET-Python"

From assela Pathirana
Jump to navigationJump to search
Line 22: Line 22:
* Install a python stack with numpy and matplotlib.  
* Install a python stack with numpy and matplotlib.  
** Can use: Python 2.7 [http://www.python.org/getit/], numpy [http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/] and Matplotlib [http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/]
** Can use: Python 2.7 [http://www.python.org/getit/], numpy [http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/] and Matplotlib [http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/]
* use the epanettools/dist/epanettools-0.1.win32-py2.7.msi file to install.
* use the copy <tt>_epanet2.pyd</tt> and <tt>epanet2.py</tt> files to <tt><pythong direcotory>\Lib\site-packages</tt> directory.  
* Then use <tt>epanet2_test.py</tt> program in src directory to test.


==Testing==
==Testing==

Revision as of 19:32, 17 April 2012

EPANET-Python can combine EPANET tools with sophisticated Python capabilities like this Matplotlib graph

When I started teaching programming for water professionals at UNESCO-IHE, I was compelled to use C/C++ as the language. This is due to the fact that EPANET2.0 and EPA-SWMM5.0 (Two main programes, students in my department had to learn) were written in C language. However, C/C++ is a horrible first language. Students have to cover at least three days of learning of arcane syntax and rules before they begin to write some semi-useful code. On the other hand, if I could conduct the classes in Python, they will see the `light' within a few hours! They can start doing interesting and useful things from the very beginning of the study. What a way to stimulate learning!

I wanted to make it possible to call EPANET2 and EPA-SWMM5.0 procedures from python. Following is the first attempt:

Download

/** Test program without graphics: swig_python_epanet_toolkit_pyplot.zip */

How to use

Linux

python setup.py build install 

OS-X

Should work similar to Linux, but I don't have a Mac to test on :-)

Windows

  • Install a python stack with numpy and matplotlib.
    • Can use: Python 2.7 [1], numpy [2] and Matplotlib [3]
  • use the copy _epanet2.pyd and epanet2.py files to <pythong direcotory>\Lib\site-packages directory.
  • Then use epanet2_test.py program in src directory to test.

Testing

  • go to netbeans/EPANET/src and run the epanet.py

See Also