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 makes the package the perfect way
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']
see examples/inp_file_reader.ipynb
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
see examples/out_file_reader.ipynb
Read the RPT-File
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.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
swmm_api-0.1a16-py3-none-any.whl
(56.1 kB
view hashes)
Close
Hashes for swmm_api-0.1a16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a8a6c703a43debf088b06f09f97d111ba6b2f516a8a9f5b6517702944e39634 |
|
MD5 | ab31eb15e31beacbe6f0392690b45d39 |
|
BLAKE2b-256 | c354363d60ac0e97048d913d2f2b9ba87bad62649d1eca6c14e1a5d53f2f67bd |