Skip to main content

A thin wrapper for epanet-msx toolkit

Project description

epanet-msx-python

The python wrapper for epanet-msx.

Installation

  • Python version: 3.6+
pip install epanetmsx

Usage

Most of the functions are used in the same fashion as they would be in the C API, however it is not necessary to check the return values for an error code anymore. If an error occurs, an exception will be thrown stating the error code. The only major difference in calling functions using the python wrapper for epanet-msx is the way that values are returned. If a function in the C API took in a pointer as a parameter that was intended to be used as an output, it now will be returned by the function. For example:

// In C
int MSXgetindex(int type, char *id, int *index);
# In Python
index = msx.getindex(type, id)

If there are multiple pointers given that will be used for output. Python handles it like this:

// In C
int MSXgetspecies(int index, int *type, char *units, double *aTol, double *rTol);
# In Python
type, units, aTol, rTol = msx.getspecies(index)

Currently, there is only one function that uses a pointer variable for both input and output and it is the "t" variable in MSXstep. Example usage:

t, tleft = msx.step(t)

Check out this example for more details.

Development

Prerequisites

  • Install Cmake
  • Install Swig
  • pip install scikit-build

Ensure the epanet-msx subproject is initialized by running git submodule update --init. Then run and running the following commands (only run clean if you can run bash scripts). The following method uses scikit-build to invoke cmake for compiling and linking the shared libaries, and builds a python wheel.

./scripts/clean.sh
python setup.py sdist bdist_wheel
pip install dist/*.whl

There is also a script called build that will run the three commands from above. (build.sh should be called from the root)

./scripts/build.sh

Tests

There is a tests directory with a file that can be run using pytest for unit tests. All of the tests that are currently available are very basic, and mainly only test functions that are not utilized in either of the examples. Both of the examples are working, and therefore all of the critical functions that those use are working. It is more important that the example functions are running properly than the tests passing since the examples use more critical functions. To run the tests:

pytest tests/test_msx.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epanetmsx-2.0.0.tar.gz (192.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

epanetmsx-2.0.0-cp39-cp39-win_amd64.whl (189.4 kB view details)

Uploaded CPython 3.9Windows x86-64

epanetmsx-2.0.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (155.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

epanetmsx-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl (345.0 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

epanetmsx-2.0.0-cp38-cp38-win_amd64.whl (189.1 kB view details)

Uploaded CPython 3.8Windows x86-64

epanetmsx-2.0.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (155.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

epanetmsx-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl (345.2 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

epanetmsx-2.0.0-cp37-cp37m-win_amd64.whl (193.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

epanetmsx-2.0.0-cp37-cp37m-win32.whl (188.6 kB view details)

Uploaded CPython 3.7mWindows x86

epanetmsx-2.0.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (154.9 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

epanetmsx-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (344.7 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

epanetmsx-2.0.0-cp36-cp36m-win_amd64.whl (193.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

epanetmsx-2.0.0-cp36-cp36m-win32.whl (188.7 kB view details)

Uploaded CPython 3.6mWindows x86

epanetmsx-2.0.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (154.9 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

epanetmsx-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl (344.7 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file epanetmsx-2.0.0.tar.gz.

File metadata

  • Download URL: epanetmsx-2.0.0.tar.gz
  • Upload date:
  • Size: 192.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c2584251cc9ce716524fa120012f039ba562653f30bba0ea3dd76b4393ca797b
MD5 3fd38dfb967b4f0fef6c842ea9301b4b
BLAKE2b-256 368fae08999c9c87509013b452d1cdd6d42a5ba5dd5f9368c2f76c9e39ef05ad

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 189.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 835f0d2af032dd0e6659272cb1b32a0519ab4ae63cf3b9d292f6a410f3367068
MD5 2d2e2e17c5008be6d051a30d7bab08f0
BLAKE2b-256 8f133407b75e508bdb03864d7632e1bdcff612796eef1b88fb0b034cb99da518

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for epanetmsx-2.0.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e8783a3135221c7b3b195f3a96c5169664746eac9e075be3fca1dc6a45b13297
MD5 602b8cd35fed631231b6185773499231
BLAKE2b-256 1c6ad812b488b482c28b415a0bbfbddd0e655d51b7826553de5572bd4bcc4062

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 345.0 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d2eef6f33948a05079bba1ac439505e8951fb73c8f2f64c46a8f8067b4cc8ba7
MD5 e5b35f75f636562a7640607fd89a7a9d
BLAKE2b-256 d39c8d8eb4604d5dd70d367d5a49bf2a4dac98ebb02af3d5fe1f37b4f972fdc1

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 189.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d6a2b0b77b7e1bef284870d6ad1e04a57955ac97b33e7e2f311a24d8db428475
MD5 335a16c8cf5470693bdccdec9a447892
BLAKE2b-256 70aa4812349997f819b403530add6f79e6785e7c6d54ae3a53d86d1f5b262fe5

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for epanetmsx-2.0.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1b6d0c12945d1334c396343bedbb2d86c6a0f9c977af0ce8735be5b29e2b7f84
MD5 e13d82934914437a7ef78304184dfb0b
BLAKE2b-256 d993f1367ed6c58e5e7e6b18cb90ccd051f6845f85f32d6fb865334f60a8f039

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 345.2 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5f8e53f72accc265ecf9aa627fa7f8db3bd534059606736c54b31a11a29d578d
MD5 9ca4d4746dcffeedb56f03d3c61a0a8b
BLAKE2b-256 c9ead6e9605a9a4b55759584bfa04ab6868fb9405d4f37e0001789c3b1d113b1

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 193.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bff56ba4992d6edfb11d4fd01ad063f99a4255dd873794ea233a3a82c6c0f3c8
MD5 1e1b8306cefa51e920c3355dd9a2795b
BLAKE2b-256 5f7c275f792e1578efc20b3279f766667ed222f6242981f3c0fc4d956daa014e

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 188.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 7234896508148ffbce1fed09c0d83d73aa9dc23cb73beb0e50665f86469cd962
MD5 74925290313155e20a27effb77b1fc12
BLAKE2b-256 add285411db287e414d32a33b02ef9a3a4164cda26c6da11b4f32f2085f6b88b

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for epanetmsx-2.0.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 db4c8edecabf5681ad8bf3b09074fc95cce3144e5e9f0092ce043758ae9117d6
MD5 fd57b31d84456d882ea8934fe67d5205
BLAKE2b-256 1b67a42b96f5b12eba39b0f723916c8617b1277ad2faa1cf6d7a6e957cc576fd

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 344.7 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3a9aba2d3235d0558f1d65f320116c54ce336e8dd3c58bb1b75fcbc93672a490
MD5 0ff3bf4a8ff6e6438b15453899d9b807
BLAKE2b-256 a1cf69eec4d9900f71b4a86090ad4452760ccd413611a7f1040a1f22b145411e

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 193.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f669d932f28f3cc487a1d3f3111647e82b2ade665bb539995049003c9237bf63
MD5 715d4210187a73607cd9eeb7c625cf64
BLAKE2b-256 11779b29688f51ece52c919a23ad5650bacc9739d5e0a63dc847bc096f117a18

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 188.7 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 4b811d7c21ce283d20b234377c73a1369a416a1401ffcaa0ec08d6441e963065
MD5 06f05df042f2f4ff36ac27fa96ff2637
BLAKE2b-256 db76b711308151840c8339cb2d5b0c37827a7455cddb7082e2bb772e4bcb819b

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for epanetmsx-2.0.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 742c8173b9963991d93c8cecf1a2b638ff0569e13b58be1f0f65e70f6aa07fea
MD5 f7c7bfc5eb00e52a98c8649d72e00152
BLAKE2b-256 67604f442427ce0e2ed09a837a163ca40e8b4eabd88f9db96fd69be6700437dc

See more details on using hashes here.

File details

Details for the file epanetmsx-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: epanetmsx-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 344.7 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for epanetmsx-2.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 70fb7bd5c194ceb4ede4021429f1e5f1ade123bc27bd3c617cdb2152b671cf03
MD5 227b98bbe9adaf67231a18c2cb54e5cc
BLAKE2b-256 9051a24c5cacf73d6548abe5370bd7cdeb4d27a6f2af2635ba13a2a7d0dc1c43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page