A numpy-only toolkit for EPA SWMM file and engine I/O.
Reason this release was yanked:
macOS version hangs
Project description
SWMMer: lightweight SWMM I/O and engine runner
A numpy-only toolkit for EPA SWMM file and engine I/O.
swmmer builds a SWMM .inp, runs the EPA SWMM engine (bundled inside the wheel, so no
external dependencies are needed), and reads the binary .out results directly through
the EPA libswmm-output C library via ctypes. numpy is the only required
dependency.
The EPA SWMM Example 1 network and its system response, both produced with swmmer:
Capabilities
- Write input files.
SWMMInputGenerator, together with typed element defaults (junctions, conduits, subcatchments, storage, and more), assembles a valid.inp. - Build design storms.
build_nrcs_hyetographdistributes a total depth into an NRCS (SCS) Type II or Type III hyetograph, andwrite_rain_datwrites the SWMM rain file. - Run the engine.
run_swmminvokes the bundledrunswmmexecutable (also exposed as arunswmmcommand line tool). The engine is compiled into the wheel, so there is nothing to install separately. - Read results.
SWMMResultsreads the binary.outand returns NumPy arrays by element name and attribute (NodeAttr,LinkAttr,SubcatchAttr,SystemAttr), with optionalto_pandasandto_xarrayconverters. - Plot.
swmmer.plotdraws the network map and a longitudinal profile withmatplotlib, and can color elements by any result (peak flow, flooding, and so on).
Installation
pip install swmmer
The SWMM engine (runswmm and libswmm-output) is compiled from source and bundled
inside the wheel, so pip install swmmer is self-contained on Linux, macOS, and
Windows.
Optional extras:
pip install "swmmer[plot]" # matplotlib, for swmmer.plot
pip install "swmmer[pandas,xarray]" # SWMMResults.to_pandas() / to_xarray()
Usage
Build a design storm and write it as a SWMM rain file (pure and offline):
from swmmer import build_nrcs_hyetograph, write_rain_dat
hyeto = build_nrcs_hyetograph(150.0, storm_type="III", duration="24-hr")
write_rain_dat(hyeto, "rain.dat")
Run a model and read results by element name:
from swmmer import SWMMResults, SystemAttr, run_swmm
rpt, out = run_swmm("model.inp")
with SWMMResults(out) as res:
t = res.times_hours
q = res.system_series(SystemAttr.OUTFALL_FLOW)
Plot the network (requires the plot extra):
import swmmer
fig, ax = swmmer.plot.plot_network("model.inp", labels=True)
The example notebook in the documentation walks through the full workflow: run a model, plot the network, draw hydrographs and a profile, then analyze the results.
Contributing
Contributions are welcome. Please see CONTRIBUTING.md for details.
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swmmer-0.1.0.tar.gz.
File metadata
- Download URL: swmmer-0.1.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f1229190c11b3ff8ce698349bf08353de5bb8dbf5e98f4a03a8f87f202f8700
|
|
| MD5 |
d1f7f49bd06b93e814461d2749ae743e
|
|
| BLAKE2b-256 |
78317fda649c932f597ee13b263fb290a830223218b4a43d8884498242b42db2
|
File details
Details for the file swmmer-0.1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: swmmer-0.1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
340357a05d72708eebd86cbe80acb3c82726caf2e6e8e77e65f2dbe3d20b32ac
|
|
| MD5 |
9f2572c12a486927cdef368d154018d9
|
|
| BLAKE2b-256 |
ab3c5bfb1b4f355d7d1fd0bf6bea6edd025df32eac18803307b2635971502327
|
File details
Details for the file swmmer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: swmmer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 466.4 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f65ed524c16fa296018a67990ee58b6a8744a08ab439b43d20f1cbdd6cc80e85
|
|
| MD5 |
06d18e5cf34664aa50a9de416504cf05
|
|
| BLAKE2b-256 |
d1300e04bf1aee746df580db690fe50981b09979dbdf62dc566795dfce10d33d
|
File details
Details for the file swmmer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: swmmer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 444.5 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
789b1560cdde187cc58218c4e2459594d37a85a3b1d2dd8b44150e9888926ec9
|
|
| MD5 |
cb73f8d9d4b0aa1af990ca772282b1eb
|
|
| BLAKE2b-256 |
3080f1ac245f9c26661cc9696d44c886631f1074b391d959688897eb393a50e8
|
File details
Details for the file swmmer-0.1.0-py3-none-macosx_11_0_x86_64.whl.
File metadata
- Download URL: swmmer-0.1.0-py3-none-macosx_11_0_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db642a6c9c6c23f06b9b2280e504df73068a25e4e9c3a957b705a52d88a82e8
|
|
| MD5 |
16961a545f4c82de78744219e69ce3de
|
|
| BLAKE2b-256 |
77818c8880a099f2d5ea9cad2410ba85f6d5a749ddb9ddabcfc6f4e6ffcc2f70
|
File details
Details for the file swmmer-0.1.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: swmmer-0.1.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3fc6f8d0412554ad9817e9b395e97216ddc70b54e4366bb7f8181ca10ec948
|
|
| MD5 |
e23dc6b8cc1d60edfcea8fccd8014579
|
|
| BLAKE2b-256 |
750cae667d70c8ff09bf2fd594c917039c5d74380a9b54a47ba5cc215f7d4f5a
|