Refine service area

This commit is contained in:
wqy
2023-07-28 18:38:42 +08:00
parent fb347ba03a
commit 897dd72a07
3 changed files with 27 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ import sys
import json
from queue import Queue
from .database import *
from .s0_base import get_node_links, get_link_nodes, get_nodes
from .s0_base import get_node_links, get_link_nodes
sys.path.append('..')
from epanet.epanet import run_project
@@ -38,7 +38,7 @@ def _calculate_service_area(name: str, inp, time_index: int = 0) -> dict[str, li
elif node2 == cursor and link_flows[link] < 0:
queue.put(node1)
return sources
#return sources
# calculation concentration
concentration_map: dict[str, dict[str, float]] = {}
@@ -111,11 +111,7 @@ def _calculate_service_area(name: str, inp, time_index: int = 0) -> dict[str, li
source_to_main_node[max_source] = []
source_to_main_node[max_source].append(node)
sas: list[dict[str, Any]] = []
for source, nodes in source_to_main_node.items():
sas.append({ 'source': source, 'nodes': nodes })
return { 'service_areas' : sas, 'concentrations': concentration_map }
return source_to_main_node
def calculate_service_area(name: str) -> list[dict[str, list[str]]]: