From 6d90a970c2db6ef863581a966661c1a45ceb548f Mon Sep 17 00:00:00 2001 From: liuly12 Date: Sat, 14 Sep 2024 09:57:03 +0100 Subject: [PATCH] reformatted --- wsimod/orchestration/model.py | 45 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/wsimod/orchestration/model.py b/wsimod/orchestration/model.py index f9ddb4fd..c9b10cb0 100644 --- a/wsimod/orchestration/model.py +++ b/wsimod/orchestration/model.py @@ -139,22 +139,23 @@ def __init__(self): # self.arcs_type = {} #not sure that this would be necessary self.nodes = {} self.nodes_type = {} - + # Default orchestration - self.orchestration = [{'FWTW' : 'treat_water'}, - {'Demand' : 'create_demand'}, - {'Land' : 'run'}, - {'Groundwater' : 'infiltrate'}, - {'Sewer' : 'make_discharge'}, - {'Foul' : 'make_discharge'}, - {'WWTW' : 'calculate_discharge'}, - {'Groundwater' : 'distribute'}, - {'River' : 'calculate_discharge'}, - {'Reservoir' : 'make_abstractions'}, - {'Land' : 'apply_irrigation'}, - {'WWTW' : 'make_discharge'}, - {'Catchment' : 'route'}] - + self.orchestration = [ + {"FWTW": "treat_water"}, + {"Demand": "create_demand"}, + {"Land": "run"}, + {"Groundwater": "infiltrate"}, + {"Sewer": "make_discharge"}, + {"Foul": "make_discharge"}, + {"WWTW": "calculate_discharge"}, + {"Groundwater": "distribute"}, + {"River": "calculate_discharge"}, + {"Reservoir": "make_abstractions"}, + {"Land": "apply_irrigation"}, + {"WWTW": "make_discharge"}, + {"Catchment": "route"}, + ] def get_init_args(self, cls): """Get the arguments of the __init__ method for a class and its superclasses.""" @@ -186,16 +187,16 @@ def load(self, address, config_name="config.yml", overrides={}): constants.NON_ADDITIVE_POLLUTANTS = data["non_additive_pollutants"] constants.FLOAT_ACCURACY = float(data["float_accuracy"]) self.__dict__.update(Model().__dict__) - + """ FLAG: E.G. ADDITION FOR NEW ORCHESTRATION """ - - if 'orchestration' in data.keys(): + + if "orchestration" in data.keys(): # Update orchestration - self.orchestration = data['orchestration'] - + self.orchestration = data["orchestration"] + nodes = data["nodes"] for name, node in nodes.items(): @@ -313,7 +314,7 @@ def save(self, address, config_name="config.yml", compress=False): data = { "nodes": nodes, "arcs": arcs, - "orchestration" : self.orchestration, + "orchestration": self.orchestration, "pollutants": constants.POLLUTANTS, "additive_pollutants": constants.ADDITIVE_POLLUTANTS, "non_additive_pollutants": constants.NON_ADDITIVE_POLLUTANTS, @@ -750,7 +751,7 @@ def enablePrint(stdout): if node_type in self.nodes_type.keys(): for node in self.nodes_type[node_type].values(): getattr(node, function)() - + # river for node_name in self.river_discharge_order: self.nodes[node_name].distribute()