Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Python interface for the popular urban drainage model EPANET 2.0 engine. EPANET2 is realeased by United States Environmental Protection Agency to public domain. This python package is copyrighted by Assela Pathirana and released under GNU General Public License version 3.

README.txt

Epanet 2.0 Python calling interface

Since version 0.4.0.1 the library is compatible with Python 3.0

What is it?

A python package enabling user to call all the epanet programmers toolkit functions within python scripts.

Installation

Windows:

Download the MS Windows installer and run to install. Since version 0.4.0.1 “python wheels “ packages are also provided. So, the following command can also be used to install on windows

pip install epanet2
POSIX (e.g. Linux, OS-X):

Download source archive (zip file), extract and run (as root)

[sudo] python setup.py install

or just type

[sudo]  pip install epanet2

Usage:

>>> from epanet2 import epanet2 as et
    >>> p="epanet2/examples/simple/"
>>> ret=et.ENopen(p+"Net3.inp",p+"Net3.rpt","")
Example 1:

Retrieve simulation properties.

Basic properties of the network

>>> ret,result=et.ENgetcount(et.EN_LINKCOUNT)
>>> print(ret)
0
    >>> print(result)
    119
>>> ret,result=et.ENgetcount(et.EN_NODECOUNT)
>>> print(ret)
0
>>> print(result)
97
    >>> node='105'
    >>> ret,index=et.ENgetnodeindex(node)
    >>> print(ret)
    0
    >>> print ("Node " + node + " has index : " + str(index))
    Node 105 has index : 12

Get the list of nodes

>>> ret,nnodes=et.ENgetcount(et.EN_NODECOUNT)
>>> nodes=[]
>>> pres=[]
>>> time=[]
>>> for index in range(1,nnodes):
...     ret,t=et.ENgetnodeid(index)
...     nodes.append(t)
...     t=[]
...     pres.append(t)
>>> print (nodes)       #doctest: +ELLIPSIS
...                     #doctest: +NORMALIZE_WHITESPACE
    ['10', '15', '20', '35', '40', '50', '60', ..., '275', 'River', 'Lake', '1', '2']

Hydraulic Simulation

>>> et.ENopenH()
0
>>> et.ENinitH(0)
0
>>> while True :
...    ret,t=et.ENrunH()
...    time.append(t)
...    # Retrieve hydraulic results for time t
...    for  i in range(0,len(nodes)):
...        ret,p=et.ENgetnodevalue(i+1, et.EN_PRESSURE )
...        pres[i].append(p)
...    ret,tstep=et.ENnextH()
...    if (tstep<=0):
...        break
>>> ret=et.ENcloseH()
>>> print([round(x,4) for x in pres[0]])   #doctest: +ELLIPSIS
...                                         #doctest: +NORMALIZE_WHITESPACE
    [-0.6398, 40.1651, 40.891, 41.0433, ..., 0.569, -0.8864, 0.2997]

Pressure at the node ‘10’

>>> ret,ind=et.ENgetnodeindex("10")
>>> print (ind)
1
>>> print([round(x,4) for x in pres[ind+1]]) # remember epanet count starts at 1.
...                                          #doctest: +ELLIPSIS
...                                          #doctest: +NORMALIZE_WHITESPACE
    [12.5657, 12.9353, 13.4351, 14.0307, ..., 13.1174, 13.3985, 13.5478]

Metadata

Release files for EPANET2 0.4.0.1dev

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EPANET2 0.4.0.1dev
File Size Uploaded Provenance Actions
EPANET2-0.4.0.1dev.zip 158.6 kB Without provenance Details for EPANET2-0.4.0.1dev.zip

Built distributions (wheels)

Table of built distributions (wheels) for EPANET2 0.4.0.1dev
File Interpreter ABI Platform Actions
EPANET2-0.4.0.1dev.win-amd64-py3.3.exe Details for EPANET2-0.4.0.1dev.win-amd64-py3.3.exe
EPANET2-0.4.0.1dev-cp33-none-win_amd64.whl CPython 3.3 none Windows x86-64 Details for EPANET2-0.4.0.1dev-cp33-none-win_amd64.whl

Total release size: 633.8 kB

Release files / EPANET2-0.4.0.1dev.zip

Download URL EPANET2-0.4.0.1dev.zip
Size 158.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf25995b9f41cc5e1d661a8122533dae8cfcd6d7b53ec87f82d57dc2ad56c494
BLAKE2b-256 checksum
How to use checksums
c08521bec0739db1ebbc11f404a65cc414007bbc1e3e4e596c928cbdbbbfaeeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / EPANET2-0.4.0.1dev.win-amd64-py3.3.exe

Download URL EPANET2-0.4.0.1dev.win-amd64-py3.3.exe
Size 349.5 kB
Tags Source
SHA-256 checksum
How to use checksums
05ef4403a3e21efdb16b4a4cc6d6982a5d00e24911bcc3f6e3cadae1e19d0de1
BLAKE2b-256 checksum
How to use checksums
e43f834d5003a2f346d8a9057ae878ddef5bf03f945663405e851d5a67d19077
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / EPANET2-0.4.0.1dev-cp33-none-win_amd64.whl

Download URL EPANET2-0.4.0.1dev-cp33-none-win_amd64.whl
Size 125.7 kB
Tags CPython 3.3 Windows x86-64
SHA-256 checksum
How to use checksums
8cc8f0d2ebd31982d59baf14cf751f45027b2adc435c17e3e9ab797aec2546ee
BLAKE2b-256 checksum
How to use checksums
75447452ebc5f25b8b3a2cc2bc9da419344094bde8941c91d733bbcad844919a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for EPANET2 0.4.0.1dev

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page