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
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.
This package is based on the command line SWMM syntax. (see Appendix D in the SWMM User Manual 5.1)
Install the package:
pip install swmm-api
Read the INP-File
from swmm_api.input_file.inp_sections.labels import TIMESERIES from swmm_api import read_inp_file from swmm_api.input_file.inp_helpers import InpSection inp = read_inp_file('inputfile.inp', convert_sections=[TIMESERIES]) # type: swmm_api.input_file.inp_helpers.InpData # 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: InpSection ts = inp[TIMESERIES]['regenseries'].frame # type: pandas.Series
see examples/inp_file_reader.ipynb
Write the manipulated INP-File
from swmm_api import write_inp_file write_inp_file(inp, 'new_inputfile.inp')
Run SWMM
from swmm_api import swmm5_run swmm5_run('new_inputfile.inp')
Read the OUT-File
from swmm_api import read_out_file out = read_out_file('new_inputfile.out') # type: swmm_api.output_file.out.SwmmOutHandler df = out.to_frame() # type: pandas.DataFrame
see examples/out_file_reader.ipynb
Read the RPT-File
from swmm_api import read_rpt_file rpt = read_rpt_file('new_inputfile.rpt') # type: swmm_api.report_file.report.Report node_flooding_summary = rpt.node_flooding_summary # type: pandas.DataFrame
see examples/rpt_file_reader.ipynb
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size swmm_api-0.1a23-py3-none-any.whl (115.9 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Close
Hashes for swmm_api-0.1a23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31afadcc539970ccacbcd180f3d97d03ad52bc382871def1fe57bc1f8ae50b8a |
|
MD5 | aa097d1001c614445b0b4d7ae3c6d6ac |
|
BLAKE2-256 | 959f0e05ab18a884df0b47972a2a0c4a50619406c40eab90a213505243d1d318 |