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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.13Windows x86-64

epaswmm-5.3.0.dev4-cp313-cp313-win32.whl (1.0 MB view details)

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.12Windows x86-64

epaswmm-5.3.0.dev4-cp312-cp312-win32.whl (1.0 MB view details)

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9Windows x86

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

Uploaded CPython 3.8Windows x86-64

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

Uploaded CPython 3.8Windows x86

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3de57c77cd02c1bab3ca9cfce0af28dc199757dbf85bf34d009b100f0689548a
MD5 9021804856f739839c129358424b2e8a
BLAKE2b-256 b968f658b0d3a1a0bab24d1b3eaa2ae228a4c5c51ed5ea6649af62b3d8b0d40e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-cp313-cp313-win32.whl
  • Upload date:
  • Size: 1.0 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.dev4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 cea260422eb28d133bf4efccdb4922779c728d453c90133204d684c710986c5f
MD5 59942a54739b320c33ddee6addad09c1
BLAKE2b-256 a97b23f9c128a08c31174a33b34b1d65ec2b2d74d456841ce319965f5019b145

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5123d4a6e0867aeaaad3810f5770fca456406a49cd1b1f83cd3cb6be1e48d060
MD5 87324209b7a62626e0f5e29f6073c451
BLAKE2b-256 af14f23a3373b97e134a45d95b9db9b8b706c47cca97c09d40cdb5c1089f3fba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-cp312-cp312-win32.whl
  • Upload date:
  • Size: 1.0 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.dev4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 285f31bd1dfdb2beaa1a4c5423872a0006455912b2ea70bbc3822ac623b2b89f
MD5 1a8b58cf4884966fd96423171973e701
BLAKE2b-256 969f7235f93ba90396fc45c92ef55e5e6de97d85c0aad1fb055d6f29c684dea9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 db859c9c4de049d7bcac9f8a22473327980fb3fc4586bfa569ed61a6ca6da705
MD5 4fbb68fefe36e0219b79f41e08bf4eb6
BLAKE2b-256 8f8c53ba46e1bc4adc2836a5aef1ffdb4a1e0563aafcab7f02cce8d2674349cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-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.dev4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d3d3e01356050ca8d38b4fa3cea710c285c015204a3fd16b9c3910e5186d1739
MD5 e8e1d702d6655f48f6799b46ce69c4f4
BLAKE2b-256 fbb6648db6e4fe05026a080a851d320792225d1b838c7a9875deaf46102f58d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2e9565f3d3549b99868659d6b6b7b577a7fcaeecc46713fa0cb9569194770650
MD5 af7a62e12675fbdc112391ccaea3c340
BLAKE2b-256 c13eb170c94f0ed34ad94d1ffa5df9861c0954307d818dabeaf534cfabf7a4d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-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.dev4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 78e65b1f9410a63e850d9a54ad6f3930110f4d6eb2b172bebe298e1aeee6b511
MD5 729ba2dde97c405104b52c8e25279b5d
BLAKE2b-256 0bfd1970152e227b201942bc98d25a6b847ac82f426d6e91c7ece9ba71faef4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 559ee2fe89c80b9bae6501f8825b306cbbc039f9e1d95bf78c66990423ed9bff
MD5 4a16417c9c8da792293e3a3724b13646
BLAKE2b-256 f55ea453cb2bbf0df3233622102ed18059823f9fcd7de0eed039b289c7c20d5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-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.dev4-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 fafd134cda62f1f26860176a6f582887a24ef76926de16e86030b2e7f29ce4be
MD5 10eb5386f84029e8d012e520b86c3264
BLAKE2b-256 586c9f66a9b29c55412ab083e1f91add7e77f0ad488c0402ac896c55451d500c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 25ecb5839ab3aabc479789948e56170b8dbee1a9b3c98088450314ed14e948f3
MD5 a72de8958265fe187e8b495bc0726cde
BLAKE2b-256 a7e0a7580b27fc52be2018d78c44f6b6a077f4b0f6b1826764932669e5a04650

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epaswmm-5.3.0.dev4-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.dev4-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f49f6ed6a27bcc2e2dbc658fd36b278481aae228ba2510f3f6327b1719a52436
MD5 83c63c4e8df94c6642d002b7016eedd5
BLAKE2b-256 f31e9f339d61a5ad9544bf78ea38b38cb617d3bebe45969fe7a0ac46c53a467f

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