pyswmm

Python Wrapper for Stormwater Management Model.
https://github.com/pyswmm/pyswmm

Category: Natural Resources
Sub Category: Water Supply and Quality

Keywords

hydraulic-modeling hydrology-stormwater-analysis python stormwater swmm swmm5

Keywords from Contributors

hydrology hydraulics transforms measur archiving projections productivity generic watershed conversion

Last synced: about 3 hours ago
JSON representation

Repository metadata

Python Wrappers for SWMM

README.md

python wrappers for the Stormwater Management Model (SWMM5)

GitHub Actions Build Status
Documentation Status
License
Latest PyPI version
PyPI Monthly Downloads
Cite our Paper

Getting started

Introducing the SWAG STORE! All Proceeds go toward the hosting/service fees related to maintaining the PySWMM Project!!! Get yourself a hoodie or coffee cup!

🆘Do you need HELP?🆘

GitHub Discussions
to answer support questions related to PySWMM.

Cite our Paper

McDonnell, Bryant E., Ratliff, Katherine M., Tryby, Michael E., Wu,
Jennifer Jia Xin, & Mullapudi, Abhiram. (2020). PySWMM: The Python
Interface to Stormwater Management Model (SWMM). Journal of Open
Source Software, 5
(52), 2292, https://doi.org/10.21105/joss.02292

YouTube Training Vidoes

Setting a manhole inflow during a running simulation!

image

Overview

PySWMM is a Python language software package for the creation,
manipulation, and study of the structure, dynamics, and function of
complex networks.

With PySWMM you can load and manipulate USEPA Stormwater Management
Models. With the development of PySWMM, control algorithms can now be
developed exclusively in Python which allows the use of functions and
objects as well as storing and tracking hydraulic trends for control
actions.

As of version v1.1.0, PySWMM includes new features to process metadata
and timeseries stored in SWMM binary output file.

Who uses PySWMM?

PySWMM is used by engineers, modelers, and researchers who want to
streamline stormwater modeling optimization, controls, and
post-processing results.

Goals

PySWMM is intended to provide

  • tools for the study of the structure and dynamics within USEPA
    SWMM5,
  • a standard programming interface and graph implementation that is
    suitable for many applications,
  • a rapid development environment for collaborative, multidisciplinary
    projects,
  • an interface to USEPA SWMM5,
  • development and implementation of control logic outside of native
    EPA-SWMM Controls,
  • methods for users to establish their own node inflows,
  • a coding interface to binary output files,
  • new modeling possibilities for the SWMM5 Community.

Install

Get the latest version of PySWMM from
PyPI See the Quick
Guide
!

$ pip install pyswmm

As of version 1.3.1, pyswmm can be installed with specific versions of the SWMM engine ranging from 5.1.14 to 5.2.4 using pip extras:

$ pip install pyswmm[swmm5.2.4]

SWMM and Python Compatibility Table

pyswmm version swmm-toolkit compatibility(SWMM engine) python compatibility
1.0.0 - 1.1.1 0.8.2 (SWMM 5.1.13) 3.6 - 3.9
1.2.0 - 1.5.0 0.9.1 - 0.15.0 (SWMM 5.1.14 - 5.2.4)Note: 0.11.0 (SWMM 5.2.0) only supported on windows 3.7 - 3.12

Usage

A quick example that steps through a simulation:

Examples:

See the Latte Example

from pyswmm import Simulation, Nodes, Links

with Simulation(r'Example1.inp') as sim:
    Node21 = Nodes(sim)["21"]
    print("Invert Elevation: {}". format(Node21.invert_elevation))

    Link15 = Links(sim)['15']
    print("Outlet Node ID: {}".format(Link15.outlet_node))

    # Launch a simulation!
    for ind, step in enumerate(sim):
        if ind % 100 == 0:
            print(sim.current_time,",",round(sim.percent_complete*100),"%",\
                  Node21.depth, Link15.flow)

Opening a SWMM binary output file and accessing model metadata and
timeseries.

from pyswmm import Output, SubcatchSeries, NodeSeries, LinkSeries, SystemSeries

with Output('model.out') as out:
    print(len(out.subcatchments))
    print(len(out.nodes))
    print(len(out.links))
    print(out.version)

    sub_ts = SubcatchSeries(out)['S1'].runoff_rate
    node_ts = NodeSeries(out)['J1'].invert_depth
    link_ts = LinkSeries(out)['C2'].flow_rate
    sys_ts = SystemSeries(out).rainfall

Bugs

Our issue tracker is at
https://github.com/pyswmm/pyswmm/issues. Please report any
bugs that you find. Or, even better, fork the repository on GitHub and
create a pull request. All changes are welcome, big or small, and we
will help you make the pull request if you are new to git (just ask on
the issue).

Contributing

Please check out our Wiki
https://github.com/pyswmm/pyswmm/wiki for more information
on contributing, including an Author Contribution Checklist.

License

Distributed with a BSD2 license; see LICENSE.txt:

Copyright (C) 2014-2024 PySWMM Developers
Community-Owned See AUTHORS and CITATION.cff

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "McDonnell"
  given-names: "Bryant"
  orcid: "https://orcid.org/0000-0002-6250-2220"
- family-names: "Ratliff"
  given-names: "Katherine"
  orcid: "https://orcid.org/0000-0003-1410-2756"
- family-names: "Tryby"
  given-names: "Michael"
  orcid: "https://orcid.org/0000-0000-0000-0000"
- family-names: "Wu"
  given-names: "Jia Xin"
  orcid: "https://orcid.org/0000-0000-0000-0000"
- family-names: "Mullapudi"
  given-names: "Abhiram"
  orcid: "https://orcid.org/0000-0000-0000-0000"
title: "PySWMM: The Python Interface to Stormwater Management Model (SWMM)"
version: 1.0.1
doi: 10.21105/joss.02292
date-released: 2020-08-04
url: "https://github.com/OpenWaterAnalytics/pyswmm"

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 765
Total Committers: 24
Avg Commits per committer: 31.875
Development Distribution Score (DDS): 0.55

Commits in past year: 57
Committers in past year: 4
Avg Commits per committer in past year: 14.25
Development Distribution Score (DDS) in past year: 0.351

Name Email Commits
Bryant E. McDonnell b****l@g****m 344
Jenn Wu j****u@e****t 113
Katherine Ratliff r****e@e****v 69
Stephen Roberts s****s@a****u 50
Gonzalo Pena-Castellanos g****a@g****m 50
karosc c****s@o****m 40
bemason b****n@u****u 18
Michael Tryby t****l@e****v 15
Timothy Holmes t****s@g****m 12
jennwuu j****u@l****m 12
abhiramm7 a****m@u****u 12
Damon McDougall d****l@g****m 5
karosc k****c@c****m 4
Jiada 3****e 4
Kristina Macro k****o@e****t 3
Ruben Kertesz r****z@e****t 3
timothy-holmes 4****s 2
Caleb 7****n 2
James Westover w****r@p****u 2
Christian Urich c****h@g****m 1
Nick Santos n****n 1
dependabot[bot] 4****] 1
dokzai 3****i 1
unknown b****l@L****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 274
Total pull requests: 146
Average time to close issues: 8 months
Average time to close pull requests: 29 days
Total issue authors: 114
Total pull request authors: 23
Average comments per issue: 3.85
Average comments per pull request: 2.29
Merged pull request: 128
Bot issues: 0
Bot pull requests: 1

Past year issues: 14
Past year pull requests: 4
Past year average time to close issues: 2 days
Past year average time to close pull requests: 10 days
Past year issue authors: 12
Past year pull request authors: 2
Past year average comments per issue: 3.36
Past year average comments per pull request: 3.5
Past year merged pull request: 3
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/pyswmm/pyswmm

Top Issue Authors

  • bemcdonnell (61)
  • goanpeca (26)
  • jennwuu (13)
  • Jiadalee (7)
  • t298 (5)
  • katmratliff (5)
  • michaeltryby (5)
  • BrianN92 (4)
  • tscheuch (4)
  • lrntct (4)
  • jsadler2 (3)
  • xie-kun (3)
  • pdim21 (3)
  • KrushilM (3)
  • Freestyleyang (3)

Top Pull Request Authors

  • bemcdonnell (65)
  • goanpeca (16)
  • katmratliff (15)
  • karosc (12)
  • jennwuu (9)
  • Jiadalee (5)
  • abhiramm7 (4)
  • ghost (3)
  • timothy-holmes (3)
  • bemason (1)
  • christianurich (1)
  • kmmacro (1)
  • dcalsky (1)
  • lrntct (1)
  • sazzad-sharior (1)

Top Issue Labels

  • type:bug (68)
  • reso:completed (68)
  • type:enhancement (43)
  • type:feature (23)
  • type:task (20)
  • type:question (14)
  • type:maintenance (12)
  • type:docs (11)
  • feature_request (6)
  • type:discussion (5)
  • resolution:wontfix (4)
  • deprecate (3)
  • resolution:duplicate (2)
  • tag:help-wanted (1)
  • dependencies (1)

Top Pull Request Labels

  • type:enhancement (34)
  • reso:completed (20)
  • type:bug (10)
  • type:feature (9)
  • type:docs (6)
  • type:maintenance (5)
  • dependencies (1)

Package metadata

pypi.org: pyswmm

Python Wrapper for SWMM5 API

  • Homepage: https://www.pyswmm.org
  • Documentation: https://pyswmm.readthedocs.io/
  • Licenses: BSD2 License
  • Latest release: 2.0.1 (published 12 months ago)
  • Last Synced: 2025-04-29T16:04:56.126Z (1 day ago)
  • Versions: 30
  • Dependent Packages: 4
  • Dependent Repositories: 8
  • Downloads: 3,909 Last month
  • Docker Downloads: 40
  • Rankings:
    • Dependent packages count: 1.865%
    • Stargazers count: 4.05%
    • Forks count: 4.241%
    • Docker downloads count: 4.316%
    • Average: 4.494%
    • Dependent repos count: 5.165%
    • Downloads: 7.326%
  • Maintainers (4)

Dependencies

.github/workflows/python-package.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
docs/source/rtd-requirements.txt pypi
  • pyswmm *
requirements.txt pypi
  • aenum ==3.1.11
  • julian ==0.14
  • pytest *
  • swmm-toolkit ==0.9.0
  • wheel *

Score: 17.27470813240439