Skip to main content

A python package for EPA SWMM5 preprocessing, solver, and post-processing.

Project description

EPA ORD Stormwater Management Model (SWMM)

Stormwater Management Model (SWMM) computational engine and output post-processing codebase

Build Status

Build and Unit Testing Build and Regression Testing Deployment Documentation PythonVersion PyPi

Introduction

This is the official SWMM source code repository maintained by US EPA Office of Research and Development, Center For Environmental Solutions & Emergency Response, Water Infrastructure Division located in Cincinnati, Ohio.

SWMM is a dynamic hydrology-hydraulic water quality simulation model. It is used for single event or long-term (continuous) simulation of runoff quantity and quality from primarily urban areas. SWMM source code is written in the C Programming Language and released in the Public Domain.

Build Instructions

The 'src' folder of this repository contains the C source code for version of Storm Water Management Model's computational engine. Consult the included 'Roadmap.txt' file for an overview of the various code modules. The code can be compiled into both a shared object library and a command line executable. Under Windows, the library file (swmm5.dll) is used to power SWMM's graphical user interface.

Also included is a python interface for the SWMM computational engine and output post-processing application programming interfaces located in the python folder.

The 'CMakeLists.txt' file is a script used by CMake (https://cmake.org/) to build the SWMM binaries. CMake is a cross-platform build tool that generates platform native build systems for many compilers. To check if the required version is installed on your system, enter from a console window and check that the version is 3.5 or higher.

cmake --version

To build the SWMM engine library and its command line executable using CMake and the Microsoft Visual Studio C compiler on Windows:

  1. Open a console window and navigate to the directory where this Readme file resides (which should have 'src' as a sub-directory underneath it).

  2. Use the following command to create the directory for storing the built binaries:

mkdir build
  1. Then the following CMake commands to build the binaries:
cmake -G <compiler> .. -A <platform> -B .\build
cmake --build . --config Release

where <compiler> is the name of the compiler being used in double quotes (e.g., "Visual Studio 15 2017", "Visual Studio 16 2019", or "Visual Studio 17 2022") and <platform> (e.g., Win32 for a 32-bit build or x64 for a 64-bit build). The resulting engine shared libraries (i.e., swmm5.dll), command line executable (i.e., runswmm.exe), and output processing libraries (i.e., swmm-output.dll) will appear in the build\Release directory.

For other platforms, such as Linux or MacOS, Step 3 can be replaced with:

cmake .
cmake --build .\build

The resulting shared object library (libswmm5.so or libswmm5.dylib) and command line executable (runswmm) will be compiled to the build directory.

Python Bindings (Experimental)

Experimental python bindings for the SWMM API are being developed to support regression and benchmark testing as well as for other applications. These bindings are still under development and testing and has yet to be cleared through US EPA ORD's official quality assurance review process. The exprimental python bindings can be built and installed locally using the following command.

cd python
python -m pip install -r requirements.txt
python -m pip install . 

Users may also build python wheels for installation or distribution. Once the python bindings have been validated and cleared through EPA's quality assuracnce clearance process, they will be available for installation via package indexing repositories such as pypi.

Example usage of python bindings can be found below. More extensive documentation will be provided once cleared.

from epaswmm import solver
from epaswmm.solver import Solver 
from epaswmm.output import Output

with Solver(inp_file="input_file.inp") as swmm_solver:
   
   # Open swmm file and initialize objects
   swmm_solver.initialize()

   # Set initialization parameters e.g., time step stride, start date, end date etc.
   swmm_solver.time_stride = 600 

   for elapsed_time in swmm_solver:

      # Get and set attributes per timestep
      print(swmm_solver.current_datetime)

      swmm_solver.set_value(
         object_type=solver.SWMMObjects.RAIN_GAGE,
         property_type=solver.SWMMRainGageProperties.GAGE_RAINFALL,
         index=0,
         value=3.6
      )
   
swmm_output = Output(output_file='output_file.out')

# Dict[datetime, float]
link_timeseries = swmm_output.get_link_timeseries(
   element_index=5,
   attribute=output.LinkAttribute.FLOW_RATE,
)

Unit and Regression Testing

Unit tests and regression tests have been developed for both the natively compiled SWMM computational engine and output toolkit as well as their respective python bindings. Unit tests for the natively compiled toolkits use the Boost 1.67.0 library and can be compiled by adding DBUILD_TESTS=ON flag during the cmake build phase as shown below:

ctest --test-dir .  -DBUILD_TESTS=ON --config Debug --output-on-failure

Unit testing on the python bindings may be executed using the following command after installation.

cd python\tests
pytest .

Regression tests are executed using the python bindings using the pytest and pytest-regressions extension using the following commands.

cd ci
pytest --data-dir <path-to-regression-testing-files> --atol <absolute-tolerance> --rtol <relative-tolerance> --benchmark-compare --benchmark-json=PATH

Find Out More

The source code distributed here is identical to the code found at the official SWMM website. The SWMM website also hosts the official manuals and installation binaries for the SWMM software.

A live web version of the SWMM documentation of the API and user manuals can be found on the SWMM GitHub Pages website. Note that this is an experimental version that is still under development and has yet to go through EPA'S official quality assurance review process.

Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.

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

epaswmm-5.3.0.dev5.tar.gz (52.8 kB view details)

Uploaded Source

Built Distributions

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

epaswmm-5.3.0.dev5-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

epaswmm-5.3.0.dev5-cp313-cp313-win32.whl (1.1 MB view details)

Uploaded CPython 3.13Windows x86

epaswmm-5.3.0.dev5-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

epaswmm-5.3.0.dev5-cp312-cp312-win32.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86

epaswmm-5.3.0.dev5-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

epaswmm-5.3.0.dev5-cp311-cp311-win32.whl (1.1 MB view details)

Uploaded CPython 3.11Windows x86

epaswmm-5.3.0.dev5-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

epaswmm-5.3.0.dev5-cp310-cp310-win32.whl (1.1 MB view details)

Uploaded CPython 3.10Windows x86

epaswmm-5.3.0.dev5-cp39-cp39-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9Windows x86-64

epaswmm-5.3.0.dev5-cp39-cp39-win32.whl (1.1 MB view details)

Uploaded CPython 3.9Windows x86

epaswmm-5.3.0.dev5-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8Windows x86-64

epaswmm-5.3.0.dev5-cp38-cp38-win32.whl (1.1 MB view details)

Uploaded CPython 3.8Windows x86

File details

Details for the file epaswmm-5.3.0.dev5.tar.gz.

File metadata

  • Download URL: epaswmm-5.3.0.dev5.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5.tar.gz
Algorithm Hash digest
SHA256 6e15c9ebff31a65ca001590256edcfa7edd9a96f9ff6a87ad62e3381befafde2
MD5 c33c03e6329dc244d0d1118b27ace134
BLAKE2b-256 af9817ae4d790b6e6a4885e7f0f5acd6508d64a235cc5a9e42f2932210cd7394

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 435d9cc6bb55e6d366f699e323257701763a69584767209ee70e14b8ce7f518e
MD5 4ab4a93efe4b22b33b37b8764e0e9fa6
BLAKE2b-256 7ee6ad6a5f90860589637b92c68964be7a3aeee358c82d770e2ffdef89aa9676

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp313-cp313-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp313-cp313-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 eb8ea918e17bafaf28f33934163bc9e27ede550cc66067325d9daa642fd19ed2
MD5 950ebc9b4e48e2037f16238c066da0cf
BLAKE2b-256 c235178bf418008590c27856775fb633f4e9ef3816129cc896d0140cf67f2eae

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 41239b20be69c8981bf23a2891da7cb068f59155079cb935e20b4d2f937f3d40
MD5 0dcd957029de1f654886f3539ebbe884
BLAKE2b-256 bf2f8a58b3952254893d17802d9040a7340c0f1e4c324ec42eea750f0b8611de

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp312-cp312-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 24b370625397fe1637b09614b5592b77e8cb442e923058713888a2ff78107ae1
MD5 b831cd10b1956200db7525637c617601
BLAKE2b-256 9bf629c02b711a500dded8f9aaf74eb9c8bed2a926b0f035c4403951a8a62e32

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c761bd89d8916bfbda60e601fe211b1974f06a7b9c59b9d293554b7c0d98d764
MD5 bac6c3d25b6d5ba2d2f06e712a8b685f
BLAKE2b-256 cafa85628e9ec5cce554613198b9d732c5dff69132ab0aefd0e819ce67d8d670

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp311-cp311-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp311-cp311-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 222a5dac7da4e949def0105a23899cbd1b64527807ee0f178302ed157d8f1943
MD5 d79eeba3d5d93584ef77534282825696
BLAKE2b-256 3d5b21995d6134dd6455223be8e5f3d86f51bde640cecd1731112e8bb6ac2cdc

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cd3169662fc1e8b2d5e1e160a0f64a5429eb3df4c7f269eda06f098002a76b87
MD5 fb2e964ee9fa1aa03ab541636eec737e
BLAKE2b-256 41736acd32a6016b36876440232f340f5a0d28af20d85f814ccb5384b9ee2fdd

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp310-cp310-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp310-cp310-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 cd12aa4f1a26744a9fd5c4302f839a088981d6ebba4fb1b059e77fbc0fa1a5d5
MD5 a50c79e14c944af0a09b2c0a5278d7a9
BLAKE2b-256 06259d5ca651339d00bf27ea0cb63e483b51d1d6b1156545a561c968703ffe95

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 24494593a852f8cfb88b8a2d07c1848ee28d43e7e655d7d9e031790fe9b7d3ec
MD5 da88c3022030f3017b0c1e40176545cb
BLAKE2b-256 d9fd9f650f0c4e3984aded44be1b827debcd292d62bab089ea931a9e8528ba4d

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp39-cp39-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp39-cp39-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 f57ca248da5bec76ba6123b0787471c9e508ca27ff0cd967b34c597f0f99cba4
MD5 8c42d5ecc7ec241712b1e6b95f908c64
BLAKE2b-256 662333b14671992bc07ed3437d7b42c52c0031b9c194efdefbbe11e72390872e

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 76f7b76f53950f7af965df05698ec0d4ef85873459b3322f81492a16f8163f80
MD5 0453f064f5556e57e7a456ec4b090f88
BLAKE2b-256 3ee88de9aefd59eddd0a255a084217265ab7c602b41a84861aaa62e0b5e22d7d

See more details on using hashes here.

File details

Details for the file epaswmm-5.3.0.dev5-cp38-cp38-win32.whl.

File metadata

  • Download URL: epaswmm-5.3.0.dev5-cp38-cp38-win32.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.4

File hashes

Hashes for epaswmm-5.3.0.dev5-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 4d19a6295e9dbd816c878fe432a88fbf908d222e8af8d7f46e68025fa25e2e11
MD5 b346eb6870eae79e609b2a88523d2047
BLAKE2b-256 785d7c3d93184f9bc34c795a78e651c62a6a1cbcc3e939c95f373b528ebc4dda

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