Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/USEPA/WNTR
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklise committed Jun 18, 2024
2 parents ebf593b + e74e9df commit 8cbcbbe
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down Expand Up @@ -47,7 +48,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -57,13 +59,10 @@ jobs:
uses: actions/download-artifact@v3
with:
name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl
# - name: Discover
# run: |
# ls .
- name: Install wntr
run: |
python -m pip install --upgrade pip
pip install wheel numpy scipy networkx pandas matplotlib setuptools
pip install wheel "numpy>=1.2.1,<2.0" scipy networkx pandas matplotlib setuptools
pip install --no-index --pre --find-links=. wntr
- name: Usage of wntr
run: |
Expand All @@ -74,7 +73,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [windows-latest, macOS-latest, ubuntu-latest]
os: [windows-latest, macOS-13, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, macOS-11, ubuntu-20.04]
os: [windows-2019, macOS-13, ubuntu-20.04]
steps:
- uses: actions/checkout@v3
- name: Build wheels
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "numpy>=1.21"]
requires = ["setuptools", "numpy>=1.21,<2.0"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Required
numpy>=1.21
numpy>=1.21,<2.0
scipy<1.13.0
networkx
pandas
Expand All @@ -26,4 +26,4 @@ pytest
nbformat
nbconvert
ipykernel
coverage
coverage
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
MAINTAINER_EMAIL = '[email protected]'
LICENSE = 'Revised BSD'
URL = 'https://github.com/USEPA/WNTR'
DEPENDENCIES = ['numpy>=1.21', 'scipy', 'networkx', 'pandas', 'matplotlib', 'setuptools']
DEPENDENCIES = ['numpy>=1.21,<2.0', 'scipy', 'networkx', 'pandas', 'matplotlib', 'setuptools']

# use README file as the long description
file_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 2 additions & 2 deletions wntr/tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_add_pipe(self):
self.assertEqual(l.name, "p1")
self.assertEqual(l.start_node_name, "j1")
self.assertEqual(l.end_node_name, "j2")
self.assertEqual(l.initial_status, self.wntr.network.LinkStatus.opened)
self.assertEqual(l.initial_status, self.wntr.network.LinkStatus.Opened)
self.assertEqual(l.length, 1000.0)
self.assertEqual(l.diameter, 1.0)
self.assertEqual(l.roughness, 100.0)
Expand Down Expand Up @@ -255,7 +255,7 @@ def test_remove_controls_for_removing_link(self):
wn = self.wntr.network.WaterNetworkModel(inp_file)

control_action = self.wntr.network.ControlAction(
wn.get_link("21"), "status", self.wntr.network.LinkStatus.opened
wn.get_link("21"), "status", self.wntr.network.LinkStatus.Opened
)
control = self.wntr.network.controls.Control._conditional_control(
wn.get_node("2"), "head", np.greater_equal, 10.0, control_action
Expand Down
26 changes: 13 additions & 13 deletions wntr/tests/test_network_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def test_time_control_open_vs_closed(self):
link_res["flowrate"].at[t, "pipe2"], 150 / 3600.0
)
self.assertEqual(
link_res["status"].at[t, "pipe2"], self.wntr.network.LinkStatus.open
link_res["status"].at[t, "pipe2"], self.wntr.network.LinkStatus.Open
)
else:
self.assertAlmostEqual(link_res["flowrate"].at[t, "pipe2"], 0.0)
self.assertEqual(
link_res["status"].at[t, "pipe2"],
self.wntr.network.LinkStatus.closed,
self.wntr.network.LinkStatus.Closed,
)


Expand Down Expand Up @@ -147,14 +147,14 @@ def test_close_link_by_tank_level(self):
self.assertAlmostEqual(link_res["flowrate"].at[t, "pump1"], 0.0)
self.assertEqual(
link_res["status"].at[t, "pump1"],
self.wntr.network.LinkStatus.closed,
self.wntr.network.LinkStatus.Closed,
)
count += 1
else:
self.assertGreaterEqual(link_res["flowrate"].at[t, "pump1"], 0.0001)
self.assertEqual(
link_res["status"].loc[t, "pump1"],
self.wntr.network.LinkStatus.open,
self.wntr.network.LinkStatus.Open,
)
self.assertEqual(activated_flag, True)
self.assertGreaterEqual(count, 2)
Expand Down Expand Up @@ -229,20 +229,20 @@ def test_open_link_by_tank_level(self):
self.assertGreaterEqual(results.link["flowrate"].at[t, "pipe1"], 0.002)
self.assertEqual(
results.link["status"].at[t, "pipe1"],
self.wntr.network.LinkStatus.open,
self.wntr.network.LinkStatus.Open,
)
count += 1
else:
self.assertAlmostEqual(results.link["flowrate"].at[t, "pipe1"], 0.0)
self.assertEqual(
results.link["status"].at[t, "pipe1"],
self.wntr.network.LinkStatus.closed,
self.wntr.network.LinkStatus.Closed,
)
self.assertEqual(activated_flag, True)
self.assertGreaterEqual(count, 2)
self.assertEqual(
results.link["status"].at[results.link["status"].index[0], "pipe1"],
self.wntr.network.LinkStatus.closed,
self.wntr.network.LinkStatus.Closed,
) # make sure the pipe starts closed
self.assertLessEqual(
results.node["pressure"].at[results.node["pressure"].index[0], "tank1"],
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_pipe_closed_for_low_level(self):
self.assertLessEqual(results.link["flowrate"].at[t, "pipe1"], 0.0)
self.assertEqual(
results.link["status"].at[t, "pipe1"],
self.wntr.network.LinkStatus.closed,
self.wntr.network.LinkStatus.Closed,
)
tank_level_dropped_flag = True
self.assertEqual(tank_level_dropped_flag, True)
Expand Down Expand Up @@ -384,7 +384,7 @@ def test_open_by_time_close_by_condition(self):
inp_file = join(test_datadir, "control_comb.inp")
wn = self.wntr.network.WaterNetworkModel(inp_file)
control_action = self.wntr.network.ControlAction(
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.opened
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.Opened
)
control = self.wntr.network.controls.Control._time_control(
wn, 6 * 3600, "SIM_TIME", False, control_action
Expand Down Expand Up @@ -432,9 +432,9 @@ def test_close_by_condition_open_by_time_stay(self):
tank1.init_level = 40.0
tank1._head = tank1.elevation + 40.0
pipe1 = wn.get_link("pipe1")
pipe1._user_status = self.wntr.network.LinkStatus.opened
pipe1._user_status = self.wntr.network.LinkStatus.Opened
control_action = self.wntr.network.ControlAction(
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.opened
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.Opened
)
control = self.wntr.network.controls.Control._time_control(
wn, 19 * 3600, "SIM_TIME", False, control_action
Expand Down Expand Up @@ -482,9 +482,9 @@ def test_close_by_condition_open_by_time_reclose(self):
tank1.init_level = 40.0
tank1._head = tank1.elevation + 40.0
pipe1 = wn.get_link("pipe1")
pipe1._user_status = self.wntr.network.LinkStatus.opened
pipe1._user_status = self.wntr.network.LinkStatus.Opened
control_action = self.wntr.network.ControlAction(
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.opened
wn.get_link("pipe1"), "status", self.wntr.network.LinkStatus.Opened
)
control = self.wntr.network.controls.Control._time_control(
wn, 5 * 3600, "SIM_TIME", False, control_action
Expand Down

0 comments on commit 8cbcbbe

Please sign in to comment.