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.dev6.tar.gz (393.7 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.dev6-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

epaswmm-5.3.0.dev6-cp313-cp313-win32.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86

epaswmm-5.3.0.dev6-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

epaswmm-5.3.0.dev6-cp312-cp312-win32.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86

epaswmm-5.3.0.dev6-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

epaswmm-5.3.0.dev6-cp311-cp311-win32.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86

epaswmm-5.3.0.dev6-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

epaswmm-5.3.0.dev6-cp310-cp310-win32.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86

epaswmm-5.3.0.dev6-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

epaswmm-5.3.0.dev6-cp39-cp39-win32.whl (1.5 MB view details)

Uploaded CPython 3.9Windows x86

epaswmm-5.3.0.dev6-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86-64

epaswmm-5.3.0.dev6-cp38-cp38-win32.whl (1.5 MB view details)

Uploaded CPython 3.8Windows x86

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6.tar.gz
Algorithm Hash digest
SHA256 f9bb1d7c87b38d7f224d43a05e438ac950da64a6c5d93c220006c29b3999f094
MD5 06acc13df66a985fb1ec6133476bb35a
BLAKE2b-256 708304375a37e8f9998849597ebb54271cc53d835542881baad7339b91fa46cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b538510eac13c03dc322e850f054e3d0b2e4bfb83fbd74abcc245fe3d7f218f2
MD5 3d5c58dd6890f67ddb60dff93b701732
BLAKE2b-256 c569904ca07e7120ffb52ff4a8fdc7b45c622d06e19d5692fd411afbc1fc2f17

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 6490dbcc869c4c9fe2d0373cee942976fec7ffdd811a265250873b0b93e58ddf
MD5 b7bb419276ce6b203e3d4fe093393249
BLAKE2b-256 799b53bc54ce547d6471d2bd6494f892a80ae149a8e1666a25e28e930ada7ec9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5aea9ebe9c77b186dce2fc815f57af5d953b4aef4dbb1a275a71398523a172f5
MD5 5ea950aa4318aa262715fde2448e9ee3
BLAKE2b-256 a71cec24fa9e4119eba192cc28e21c01edf33927b714f930faf1fe51f9dda74e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 8150c358da0034ca696d7996e24098ab56ab48f89dac4131aba03a7170eb29b7
MD5 10c009aedd3c23dfadf297b12c3cc499
BLAKE2b-256 f89db745af75588ccbb357681a950fbb18489f06748a06438799ebb964b2a107

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 733e37240b3394384e4d289c1dc8b2d6c0c5a949f744e1f4335d36fa3eb647fc
MD5 9b85f38f3c26900d225b4e98e3cd060e
BLAKE2b-256 5d57629b6c1f861adc90ce777987e99af11f7c9b7824bcca40a54d9201cce2b6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 34d5ee43fce5e29cc3f843ea332da577d05aec5523d9e148da03fbd5a312f887
MD5 f0da9f24bbcfae150694cee1bc743f80
BLAKE2b-256 3c251084d7fad3244d243cffe9e7d06309a7ff0513ace4ec8cffd2707430b503

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for epaswmm-5.3.0.dev6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d8d342ab3ecd7121e27f893f2bbaaa443d714a95e342929f3242e8ec26227fbe
MD5 f03319d812222d3e28ea6e96d6ecb57c
BLAKE2b-256 c1a21508757cba72e4f896543e2cadbbefd9ad2e3fd9125938bf327b75c9504e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 28714eeb7bc1bfa41a59d6479db9d0713fb32f1aeb26005811efe4a62c31ee40
MD5 fec21256e82a0e25571e75b82f5f9163
BLAKE2b-256 1c3a71f2963cd58786701758942a1e1e5402db7ac4bc199ef7de85bfc1106532

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 147064fbf4f02990ed750d0864913b4ebc91d0863065ecefb3d1505b2aa08518
MD5 e4ae2184604f7e6d44cafd3be536b4a3
BLAKE2b-256 3521b1d66f7dc5367cb67da4f45de4577c2384727a2b466b975a129b28be92e6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 637763e5b502f27fe440e2993b9fcd73027d694ce2c887778d96fe172b79f530
MD5 9fb2b2fed2d9de4e12505593f9bd2649
BLAKE2b-256 f682568f7ad9dac39c36662c4b69ade7b93e744bcbba29b507a76e066c0ee8ca

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 64bd26488b345e2ae6bbd7bad26ca7609f3fb12b439c788ddc62abf61cacf120
MD5 f663b47ea04c04d4db2752c10bc98029
BLAKE2b-256 71b9d9a498ba40fb015706c9147c353b0780944b3bd900e02bfd5b96ee4552f4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epaswmm-5.3.0.dev6-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 caf5666fbc8d3a86ad68647a603763e228e7103589970287b4e51ba34dced863
MD5 505dff65cd9be4d7813dc40b67e0a1fc
BLAKE2b-256 45b96de2b942df2cae7feddc2167533df1362214b1e4f6ca1b9508230c937257

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