Skip to content

Commit

Permalink
pre-commit reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
liuly12 committed Jul 26, 2024
1 parent 7ca8ac3 commit 05f83c0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
28 changes: 15 additions & 13 deletions tests/test_wtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,29 @@ def test_wwtw_overrides(self):
self.assertEqual(wwtw.process_parameters["phosphate"]["constant"], 0.01)
self.assertEqual(wwtw.process_parameters["volume"]["constant"], vol)
self.assertEqual(wwtw.stormwater_storage_capacity, 100)

def test_fwtw_overrides(self):
fwtw = FWTW(name='')
vol = fwtw.process_parameters['volume']['constant']
fwtw.apply_overrides({'treatment_throughput_capacity' : 20,
'process_parameters' : {'phosphate' :
{'constant' : 0.02}},
'service_reservoir_storage_capacity': 100,
'service_reservoir_storage_area': 34.7,
'service_reservoir_storage_elevation': 68.2
})
fwtw = FWTW(name="")
vol = fwtw.process_parameters["volume"]["constant"]
fwtw.apply_overrides(
{
"treatment_throughput_capacity": 20,
"process_parameters": {"phosphate": {"constant": 0.02}},
"service_reservoir_storage_capacity": 100,
"service_reservoir_storage_area": 34.7,
"service_reservoir_storage_elevation": 68.2,
}
)
self.assertEqual(fwtw.treatment_throughput_capacity, 20)
self.assertEqual(fwtw.process_parameters['phosphate']['constant'], 0.02)
self.assertEqual(fwtw.process_parameters['volume']['constant'], vol)
self.assertEqual(fwtw.process_parameters["phosphate"]["constant"], 0.02)
self.assertEqual(fwtw.process_parameters["volume"]["constant"], vol)
self.assertEqual(fwtw.service_reservoir_storage_capacity, 100)
self.assertEqual(fwtw.service_reservoir_tank.capacity, 100)
self.assertEqual(fwtw.service_reservoir_storage_area, 34.7)
self.assertEqual(fwtw.service_reservoir_tank.area, 34.7)
self.assertEqual(fwtw.service_reservoir_storage_elevation, 68.2)
self.assertEqual(fwtw.service_reservoir_tank.datum, 68.2)
self.assertEqual(fwtw.process_parameters['nitrate']['constant'], 0.01)
self.assertEqual(fwtw.process_parameters["nitrate"]["constant"], 0.01)


if __name__ == "__main__":
Expand Down
18 changes: 10 additions & 8 deletions wsimod/nodes/wtw.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,26 +547,28 @@ def apply_overrides(self, overrides=Dict[str, Any]):
Enables a user to override any parameter of the service reservoir tank, and
then calls any overrides in WTW.
Args:
overrides (Dict[str, Any]): Dict describing which parameters should
be overridden (keys) and new values (values). Defaults to {}.
"""
self.service_reservoir_storage_capacity = overrides.pop(
"service_reservoir_storage_capacity",
self.service_reservoir_storage_capacity)
"service_reservoir_storage_capacity",
self.service_reservoir_storage_capacity,
)
self.service_reservoir_storage_area = overrides.pop(
"service_reservoir_storage_area",
self.service_reservoir_storage_area)
"service_reservoir_storage_area", self.service_reservoir_storage_area
)
self.service_reservoir_storage_elevation = overrides.pop(
"service_reservoir_storage_elevation",
self.service_reservoir_storage_elevation)
"service_reservoir_storage_elevation",
self.service_reservoir_storage_elevation,
)

self.service_reservoir_tank.capacity = self.service_reservoir_storage_capacity
self.service_reservoir_tank.area = self.service_reservoir_storage_area
self.service_reservoir_tank.datum = self.service_reservoir_storage_elevation
super().apply_overrides(overrides)

def treat_water(self):
"""Pulls water, aiming to fill service reservoirs, calls WTW
treat_current_input, avoids deficit, sends liquor and solids to sewers."""
Expand Down

0 comments on commit 05f83c0

Please sign in to comment.