Skip to content

Commit 777701d

Browse files
authored
Merge pull request #108 from OpenWaterAnalytics/dev
2 parents 443c834 + 37ce646 commit 777701d

File tree

11 files changed

+82
-66
lines changed

11 files changed

+82
-66
lines changed

.github/workflows/conda-test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Conda Tests
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build Wheels"]
6+
types:
7+
- completed
8+
9+
10+
jobs:
11+
test_conda_build:
12+
name: Conda wheel test mac
13+
runs-on: macos-latest
14+
defaults:
15+
run:
16+
shell: bash -l {0}
17+
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@v2
21+
with:
22+
submodules: true
23+
24+
- uses: conda-incubator/setup-miniconda@v2
25+
with:
26+
auto-update-conda: true
27+
channels: conda-forge
28+
# Python 3.9 does not support all libs we need in swmm-python
29+
python-version: 3.8
30+
31+
- name: Install required system packages
32+
run: brew install swig ninja
33+
34+
- name: Install requirements
35+
run: |
36+
cd swmm-toolkit
37+
conda create -n test-env pip
38+
conda activate test-env
39+
pip install -r build-requirements.txt
40+
python setup.py bdist_wheel
41+
conda deactivate
42+
43+
- name: Test wheel
44+
run: |
45+
cd swmm-toolkit
46+
conda activate test-env
47+
pip install -r test-requirements.txt
48+
python -m pip install --no-index --find-links=./dist swmm_toolkit
49+
pytest
50+
conda deactivate

.github/workflows/python-package.yml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build Wheels
33
on: [push, pull_request]
44

55
env:
6-
DOCKER_IMAGE: dockcross/manylinux2014-x64
6+
DOCKER_IMAGE: dockcross/manylinux2014-x64:latest
77

88

99
jobs:
@@ -33,43 +33,6 @@ jobs:
3333
with:
3434
path: nrtest-swmm/dist/*.whl
3535

36-
test_conda_build:
37-
name: Conda wheel test mac
38-
runs-on: macos-latest
39-
defaults:
40-
run:
41-
shell: bash -l {0}
42-
43-
steps:
44-
- name: Checkout repo
45-
uses: actions/checkout@v2
46-
with:
47-
submodules: true
48-
49-
- uses: conda-incubator/setup-miniconda@v2
50-
with:
51-
auto-update-conda: true
52-
channels: conda-forge
53-
# Python 3.9 does not support all libs we need in swmm-python
54-
python-version: 3.8
55-
56-
- name: Install required system packages
57-
run: brew install swig ninja
58-
59-
- name: Install requirements
60-
run: |
61-
cd swmm-toolkit
62-
conda activate test
63-
conda install --yes --file build-requirements.txt
64-
python setup.py bdist_wheel
65-
66-
- name: Test wheel
67-
run: |
68-
cd swmm-toolkit
69-
conda activate test
70-
conda install --yes --file test-requirements.txt
71-
python -m pip install --no-index --find-links=./dist swmm_toolkit --user
72-
pytest
7336

7437

7538
build_linux_wheels:
@@ -109,7 +72,7 @@ jobs:
10972
fail-fast: false
11073
matrix:
11174
os: [windows-2022, macos-10.15]
112-
py: ["3.7", "3.8", "3.9", "3.10"]
75+
py: ["3.7", "3.8", "3.9", "3.10", "3.11"]
11376
include:
11477
- os: windows-2022
11578
sys_pkgs: choco install swig
@@ -150,4 +113,4 @@ jobs:
150113
- name: Upload artifacts
151114
uses: actions/upload-artifact@v2
152115
with:
153-
path: swmm-toolkit/dist/*.whl
116+
path: swmm-toolkit/dist/*.whl

nrtest-swmm/nrtest_swmm/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
__credits__ = "Colleen Barr, Maurizio Cingi, Mark Gray, David Hall, Bryant McDonnell"
2626
__license__ = "CC0 1.0 Universal"
2727

28-
__version__ = "0.6.0"
29-
__date__ = "May 8, 2020"
28+
__version__ = "0.7.0"
29+
__date__ = "Jul 28, 2021"
3030

3131
__maintainer__ = "Michael E. Tryby"
3232
__email__ = "[email protected]"
@@ -65,15 +65,15 @@ def swmm_allclose_compare(path_test, path_ref, rtol, atol):
6565
for (test, ref) in zip(ordr.output_generator(path_test),
6666
ordr.output_generator(path_ref)):
6767

68-
if len(test[0]) != len(ref[0]):
69-
raise ValueError('Inconsistent lengths')
68+
# Compare arrays when lengths are unequal by truncating extra elements
69+
length = min(len(test[0]), len(ref[0]))
7070

71-
# Skip over results if they are equal
72-
if (np.array_equal(test[0], ref[0])):
71+
# Skip over results if they are equal to optimize performance
72+
if (np.array_equal(test[0][:length], ref[0][:length])):
7373
continue
7474

7575
else:
76-
np.testing.assert_allclose(test[0], ref[0], rtol, atol)
76+
np.testing.assert_allclose(test[0][:length], ref[0][:length], rtol, atol)
7777

7878
return True
7979

nrtest-swmm/scripts/report-diff

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def _binary_diff(path_test, path_ref, min_cdd):
2525
for (test, ref) in zip(ordr.output_generator(path_test),
2626
ordr.output_generator(path_ref)):
2727

28-
if len(test[0]) != len(ref[0]):
29-
raise ValueError('Inconsistent lengths')
28+
# Compare arrays when lengths are unequal by truncating extra elements
29+
length = min(len(test[0]), len(ref[0]))
3030

3131
# Skip over arrays that are equal
32-
if np.array_equal(test[0], ref[0]):
32+
if np.array_equal(test[0][:length], ref[0][:length]):
3333
continue
3434
else:
35-
lre = _log_relative_error(test[0], ref[0])
35+
lre = _log_relative_error(test[0][:length], ref[0][:length])
3636
idx = np.unravel_index(np.argmin(lre), lre.shape)
3737

3838
if lre[idx] < min_cdd:

nrtest-swmm/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#
44
# setup.py
55
#
6-
# Modified on October 17, 2019
7-
#
86
# Author: Michael E. Tryby
97
# US EPA - ORD/NRMRL
108
#
9+
# Modified: Jul 28, 2021
10+
#
1111
# Usage:
1212
# \>python setup.py bdist_wheel
1313
#
@@ -27,7 +27,7 @@
2727

2828
setup(
2929
name='nrtest-swmm',
30-
version='0.6.0',
30+
version='0.7.0',
3131
description="SWMM extension for nrtest",
3232

3333
author="Michael E. Tryby",

swmm-toolkit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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.9.0
18+
0.9.1
1919
)
2020

2121

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22

33

4-
setuptools==41.4.0
5-
wheel==0.33.6
6-
scikit-build==0.11.1
7-
cmake==3.21
4+
setuptools == 65.5.1
5+
wheel == 0.38.1
6+
scikit-build == 0.11.1
7+
cmake == 3.21
8+
swig == 4.0.2

swmm-toolkit/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def exclude_files(cmake_manifest):
8888

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

9393
packages = ["swmm_toolkit", "swmm.toolkit"],
9494
package_dir = package_dir,
@@ -120,6 +120,7 @@ def exclude_files(cmake_manifest):
120120
"Programming Language :: Python :: 3.8",
121121
"Programming Language :: Python :: 3.9",
122122
"Programming Language :: Python :: 3.10",
123+
"Programming Language :: Python :: 3.11",
123124
"Programming Language :: C",
124125
"Development Status :: 5 - Production/Stable",
125126
]

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

Lines changed: 1 addition & 1 deletion
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.9.0"
22+
__version__ = "0.9.1"
2323
__date__ = "June 7, 2021"
2424

2525
__maintainer__ = "Michael Tryby"

swmm-toolkit/test-requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

33

4-
pytest==7.1.1
5-
numpy==1.21.5
6-
aenum==3.1.11
4+
pytest == 7.1.1
5+
numpy == 1.21.6; python_version == "3.7"
6+
numpy == 1.23.4; python_version >= "3.8"
7+
aenum == 3.1.11

0 commit comments

Comments
 (0)