Skip to main content

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:

swmmer network map of EPA SWMM Example 1

system hyetograph and hydrograph for EPA SWMM Example 1

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_hyetograph distributes a total depth into an NRCS (SCS) Type II or Type III hyetograph, and write_rain_dat writes the SWMM rain file.
  • Run the engine. run_swmm invokes the bundled runswmm executable (also exposed as a runswmm command line tool). The engine is compiled into the wheel, so there is nothing to install separately.
  • Read results. SWMMResults reads the binary .out and returns NumPy arrays by element name and attribute (NodeAttr, LinkAttr, SubcatchAttr, SystemAttr), with optional to_pandas and to_xarray converters.
  • Plot. swmmer.plot draws the network map and a longitudinal profile with matplotlib, 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

BSD 3-Clause License. See LICENSE for details.

Download files

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

Source Distribution

swmmer-0.1.2.tar.gz (1.0 MB view details)

Uploaded Source

Built Distributions

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

swmmer-0.1.2-py3-none-win_amd64.whl (1.1 MB view details)

Uploaded Python 3Windows x86-64

swmmer-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (467.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

swmmer-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (445.4 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

swmmer-0.1.2-py3-none-macosx_11_0_x86_64.whl (1.2 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

swmmer-0.1.2-py3-none-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file swmmer-0.1.2.tar.gz.

File metadata

  • Download URL: swmmer-0.1.2.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d48c5cb19d71aa1714cc90e048619114d46754a10068ec0c3da2554ab3d79489
MD5 7c07a39dc5bddeb8da15253f6aa49f6a
BLAKE2b-256 caa3b6448ebb96d657e2ce0a255016704ccafd0a7bfa550e5e075751fd480182

See more details on using hashes here.

File details

Details for the file swmmer-0.1.2-py3-none-win_amd64.whl.

File metadata

  • Download URL: swmmer-0.1.2-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.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 fb1325f1d009fab3bbd55838498bd8ea64c407ed73c46e1953d5ba66f3301233
MD5 daa9ecfae941d2e404f4dd0e65ada3ce
BLAKE2b-256 828c6d5805bccb50ef51814a890f8736683cf16689bc01243a11af42353ff6d3

See more details on using hashes here.

File details

Details for the file swmmer-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: swmmer-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 467.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.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7fdc8c76a8b017921b92848460a11e8b89f1cfda2f342f396f39ea3e6d0552c3
MD5 83c33102dc3f032ca963b76d21fae542
BLAKE2b-256 619a5123673d0cd8973cd838bcd8788a16cf1eefecb58358bb33196aa9188939

See more details on using hashes here.

File details

Details for the file swmmer-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: swmmer-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 445.4 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 01d055340594030768313d80b5c8054a73eb1514507e977e32721a9a04a935eb
MD5 2d7bd43416f007607c625373febfae3c
BLAKE2b-256 02d6de3d03ab1903fee57e07d59787e4f1880198f0542861d79f5809307f8d8a

See more details on using hashes here.

File details

Details for the file swmmer-0.1.2-py3-none-macosx_11_0_x86_64.whl.

File metadata

  • Download URL: swmmer-0.1.2-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.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 778d567cf898796ad30a494140c91cbb3b6241dacc353f3924da67dc5c1f3129
MD5 7d7f9f8e2e18d2e43b3e8cacddc21081
BLAKE2b-256 ffbf1004aae41c7f7f64423b18d9c6f9032450a8d2524a5f3e0fa5cad74f4cbc

See more details on using hashes here.

File details

Details for the file swmmer-0.1.2-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: swmmer-0.1.2-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.28 {"installer":{"name":"uv","version":"0.11.28","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

Hashes for swmmer-0.1.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2dedf4981dbf457b7b539aaf34ef43b7ddce68f6c9e30b7c125e6926d6f9d6e
MD5 61139fb47ebde3c65abd38dcfff5d100
BLAKE2b-256 ef89a8d1ba65f20d16e2a739c3860df780e86c79d385700e6dcbc270f94cd318

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

6 files

0.1.1

6 files

0.1.0

6 files

Supported by

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