Skip to main content

US-EPA-SWMM python interface

Project description

© Institute of Urban Water Management and Landscape Water Engineering, Graz University of Technology and Markus Pichler

This is an API for reading, manipulating and running SWMM-Projects

PyPI pipeline status

With this package you can read INP-files, manipulate them and write new ones. You can run swmm within the python api. And you can read the OUT-file as a pandas DataFrame for further analysis.

Install the package:

pip install swmm-api

Read the INP-File

from swmm_api.input_file.helpers.sections import TIMESERIES
from swmm_api.input_file import read_inp_file
from swmm_api.input_file.inp_sections_generic import TimeseriesSection
inp = read_inp_file('inputfile.inp', convert_sections=[TIMESERIES])

# convert_sections limits the convertions during the reading of the file to the following section
# remove "convert_sections" to convert all sections 
# converting sections helps manipulating the inp file
# unconverted sections will be loaded as the raw string

sec_timeseries = inp[TIMESERIES]  # type: TimeseriesSection
timeseries_dict = sec_timeseries.to_pandas  # type: Dict[str, pandas.Series]
ts = timeseries_dict['regenseries']

Write the manipulated INP-File

from swmm_api.input_file import write_inp_file
write_inp_file(inp, 'new_inputfile.inp')

Run SWMM

from swmm_api.run import swmm5_run
swmm5_run('new_inputfile.inp')

Read the OUT-File

from swmm_api.output_file import out2frame
df = out2frame('new_inputfile.out')  # type: pandas.DataFrame

MORE INFORMATIONS COMMING SOON

Project details


Release history Release notifications | RSS feed

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 Distribution

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

swmm_api-0.1a8-py3-none-any.whl (50.5 kB view details)

Uploaded Python 3

File details

Details for the file swmm_api-0.1a8-py3-none-any.whl.

File metadata

  • Download URL: swmm_api-0.1a8-py3-none-any.whl
  • Upload date:
  • Size: 50.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for swmm_api-0.1a8-py3-none-any.whl
Algorithm Hash digest
SHA256 1b56ea4902150e676e4c79aac78356fc98c6dae6f4104baf23033cdaa66c8444
MD5 ce36fe4df05d81f006a539e4a9c8cef9
BLAKE2b-256 72a8517644396838610e307862964cee069b0999adbd9f33c19fb3bac66fd651

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