Skip to content

Commit 34f504e

Browse files
authored
Merge pull request #94 from karosc/dev
Update swmm-python to latest OWA SWMM
2 parents 3a47f19 + 40c80d8 commit 34f504e

21 files changed

+515
-62
lines changed

.github/workflows/python-package.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ jobs:
7171
strategy:
7272
fail-fast: false
7373
matrix:
74-
os: [windows-2016, macos-10.15]
75-
py: [3.6, 3.7, 3.8, 3.9]
74+
os: [windows-2022, macos-10.15]
75+
py: ["3.7", "3.8", "3.9", "3.10"]
7676
include:
77-
- os: windows-2016
77+
- os: windows-2022
7878
sys_pkgs: choco install swig
7979
activate: ./build-env/Scripts/activate
8080

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "swmm-toolkit/swmm-solver"]
22
path = swmm-toolkit/swmm-solver
33
url = https://github.com/OpenWaterAnalytics/Stormwater-Management-Model.git
4-
branch = swig
4+
branch = develop

swmm-toolkit/AUTHORS

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ Michael Tryby <[email protected]> (public domain)
55
Jennifer Wu <[email protected]>
66
Caleb Buahin <[email protected]>
77
Laurent Courty <[email protected]>
8+
Constantine Karos <[email protected]>
9+
Abhiram Mullapudi <[email protected]>
10+
Brooke Mason <[email protected]>

swmm-toolkit/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cmake_minimum_required (VERSION 3.17)
1515

1616
project(swmm-toolkit
1717
VERSION
18-
0.8.2
18+
0.9.0
1919
)
2020

2121

swmm-toolkit/build-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
setuptools==41.4.0
55
wheel==0.33.6
66
scikit-build==0.11.1
7-
cmake==3.18.4
7+
cmake==3.21

swmm-toolkit/setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def run(self):
6565

6666
# Set Platform specific cmake args here
6767
if platform_system == "Windows":
68-
cmake_args = ["-GVisual Studio 15 2017 Win64"]
68+
cmake_args = ["-GVisual Studio 17 2022","-Ax64"]
6969

7070
elif platform_system == "Darwin":
7171
cmake_args = ["-GNinja","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9"]
@@ -88,7 +88,7 @@ def exclude_files(cmake_manifest):
8888

8989
setup(
9090
name = "swmm-toolkit",
91-
version = "0.8.2",
91+
version = "0.9.0",
9292

9393
packages = ["swmm_toolkit", "swmm.toolkit"],
9494
package_dir = package_dir,
@@ -116,10 +116,10 @@ def exclude_files(cmake_manifest):
116116
"Operating System :: POSIX :: Linux",
117117
"Operating System :: MacOS",
118118
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
119-
"Programming Language :: Python :: 3.6",
120119
"Programming Language :: Python :: 3.7",
121120
"Programming Language :: Python :: 3.8",
122121
"Programming Language :: Python :: 3.9",
122+
"Programming Language :: Python :: 3.10",
123123
"Programming Language :: C",
124124
"Development Status :: 4 - Beta",
125125
]

swmm-toolkit/src/swmm/toolkit/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ target_link_libraries(solver
139139
set_target_properties(solver
140140
PROPERTIES
141141
SUFFIX ${PYTHON_SUFFIX}
142+
SWIG_COMPILE_DEFINITIONS EXPORT_TOOLKIT
142143
MACOSX_RPATH TRUE
143144
SKIP_BUILD_RPATH FALSE
144145
BUILD_WITH_INSTALL_RPATH FALSE

swmm-toolkit/src/swmm/toolkit/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__credits__ = "Colleen Barr, Sam Hatchett"
2020
__license__ = "CC0 1.0 Universal"
2121

22-
__version__ = "0.8.2"
22+
__version__ = "0.9.0"
2323
__date__ = "June 7, 2021"
2424

2525
__maintainer__ = "Michael Tryby"

swmm-toolkit/src/swmm/toolkit/output_metadata.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ def __init__(self, output_handle):
194194
shared_enum.SystemAttribute.VOLUME_STORED:
195195
("Volume Stored", self._unit_labels[shared_enum.BaseUnits.VOLUME]),
196196
shared_enum.SystemAttribute.EVAP_RATE:
197-
("Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE])
197+
("Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE]),
198+
shared_enum.SystemAttribute.PTNL_EVAP_RATE:
199+
("Potential Evaporation Rate", self._unit_labels[shared_enum.BaseUnits.EVAP_RATE])
198200
}
199201

200202
self._build_pollut_metadata(output_handle)

swmm-toolkit/src/swmm/toolkit/shared_enum.py

+10
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ class SystemAttribute(Enum, start = 0):
304304
:attr:`~OUTFALL_FLOWS` outfall outflow
305305
:attr:`~VOLUME_STORED` storage volume
306306
:attr:`~EVAP_RATE` evaporation
307+
:attr:`~PTNL_EVAP_RATE` potential evapotranspiration
307308
============================= ====================
308309
"""
309310
AIR_TEMP = 0
@@ -320,6 +321,7 @@ class SystemAttribute(Enum, start = 0):
320321
OUTFALL_FLOWS = 11
321322
VOLUME_STORED = 12
322323
EVAP_RATE = 13
324+
PTNL_EVAP_RATE = 14
323325

324326

325327
#
@@ -430,6 +432,7 @@ class NodeResult(Enum):
430432
:attr:`~DEPTH`
431433
:attr:`~HEAD`
432434
:attr:`~LATERAL_INFLOW`
435+
:attr:`~HYD_RES_TIME`
433436
"""
434437
TOTAL_INFLOW = 0
435438
TOTAL_OUTFLOW = 1
@@ -439,14 +442,19 @@ class NodeResult(Enum):
439442
DEPTH = 5
440443
HEAD = 6
441444
LATERAL_INFLOW = 7
445+
HYD_RES_TIME = 8
442446

443447

444448
class NodePollutant(Enum):
445449
"""Node Pollutant enum class.
446450
447451
:attr:`~QUALITY`
452+
:attr:`~INFLOW_CONC`
453+
:attr:`~REACTOR_CONC`
448454
"""
449455
QUALITY = 0
456+
INFLOW_CONC = 1
457+
REACTOR_CONC = 2
450458

451459

452460
class LinkProperty(Enum):
@@ -496,9 +504,11 @@ class LinkPollutant(Enum):
496504
497505
:attr:`~QUALITY`
498506
:attr:`~TOTAL_LOAD`
507+
:attr:`~REACTOR_CONC`
499508
"""
500509
QUALITY = 0
501510
TOTAL_LOAD = 1
511+
REACTOR_CONC = 2
502512

503513

504514
class SubcatchProperty(Enum):

swmm-toolkit/src/swmm/toolkit/solver.i

+22-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
Py_INCREF($result);
4040
}
4141

42+
%typemap(out) int swmm_getVersion {
43+
$result = PyInt_FromLong($1);
44+
}
45+
4246

4347
%apply int *OUTPUT {
4448
int *index,
@@ -178,6 +182,22 @@
178182
}
179183

180184

185+
/* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */
186+
%exception swmm_getSemVersion
187+
{
188+
$function
189+
}
190+
191+
%exception swmm_getBuildId
192+
{
193+
$function
194+
}
195+
196+
%exception swmm_getVersion
197+
{
198+
$function
199+
}
200+
181201
/* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */
182202
%exception
183203
{
@@ -209,7 +229,8 @@
209229
%ignore swmm_getObjectIndex;
210230
%ignore swmm_freeMemory;
211231

232+
212233
%include "toolkit.h"
213234

214235

215-
%exception;
236+
%exception;

swmm-toolkit/src/swmm/toolkit/solver_docs.i

+37
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,26 @@ flowrate: double
664664
) swmm_setNodeInflow;
665665

666666

667+
%feature("autodoc",
668+
"Set node pollutant concentration
669+
670+
Parameters
671+
----------
672+
index: int
673+
The node index.
674+
type: SM_NodePollut
675+
The property type code (see :ref: SM_NodePollut). Currently Only QUALITY (0) is supported.
676+
pollutant_index: int
677+
The index of the pollutant to set.
678+
pollutant_value:
679+
The new pollutant concentration to set.
680+
681+
"
682+
) swmm_setNodePollut;
683+
684+
685+
686+
667687
%feature("autodoc",
668688
"Get a node statistics.
669689
@@ -863,6 +883,23 @@ setting: double
863883
) swmm_setLinkSetting;
864884

865885

886+
%feature("autodoc",
887+
"Set link pollutant concentration
888+
889+
Parameters
890+
----------
891+
index: int
892+
The link index.
893+
type: SM_LinkPollut
894+
The property type code (see :ref: SM_LinkPollut). Currently Only QUALITY (0) is supported.
895+
pollutant_index: int
896+
The index of the pollutant to set.
897+
pollutant_value:
898+
The new pollutant concentration to set.
899+
900+
"
901+
) swmm_setLinkPollut;
902+
866903
%feature("autodoc",
867904
"Get link statistics.
868905

swmm-toolkit/src/swmm/toolkit/solver_rename.i

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
%rename(node_set_parameter) swmm_setNodeParam;
4545
%rename(node_get_result) swmm_getNodeResult;
4646
%rename(node_get_pollutant) swmm_getNodePollut;
47+
%rename(node_set_pollutant) swmm_setNodePollut;
4748
%rename(node_get_total_inflow) swmm_getNodeTotalInflow;
4849
%rename(node_set_total_inflow) swmm_setNodeInflow;
4950
%rename(node_get_stats) swmm_getNodeStats;
@@ -63,6 +64,7 @@
6364
%rename(link_set_parameter) swmm_setLinkParam;
6465
%rename(link_get_result) swmm_getLinkResult;
6566
%rename(link_get_pollutant) swmm_getLinkPollut;
67+
%rename(link_set_pollutant) swmm_setLinkPollut;
6668
%rename(link_set_target_setting) swmm_setLinkSetting;
6769
%rename(link_get_stats) swmm_getLinkStats;
6870

@@ -99,4 +101,5 @@
99101
%rename(raingage_set_precipitation) swmm_setGagePrecip;
100102

101103

102-
%rename(swmm_version_info) swmm_getVersionInfo;
104+
%rename(swmm_version_info) swmm_getSemVersion;
105+
%rename(swmm_build_id) swmm_getBuildId;

swmm-toolkit/swmm-solver

swmm-toolkit/test-requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

33

4-
pytest==6.1.1
5-
numpy==1.17.2
4+
pytest==7.1.1
5+
numpy==1.21.5
66
aenum==2.2.6

0 commit comments

Comments
 (0)