Support EPANET3 [PATTERNS] out
This commit is contained in:
@@ -144,7 +144,6 @@ def inp_out_pattern(name: str) -> list[str]:
|
||||
# id time1 factor1 time2 factor2 ...
|
||||
#--------------------------------------------------------------
|
||||
def inp_in_pattern_v3(section: list[str]) -> ChangeSet:
|
||||
descs = {}
|
||||
patterns: dict[str, list[float]] = {}
|
||||
|
||||
variable_patterns: list[str] = []
|
||||
@@ -152,11 +151,6 @@ def inp_in_pattern_v3(section: list[str]) -> ChangeSet:
|
||||
count = len(section)
|
||||
for i in range(0, count):
|
||||
if section[i].startswith(';'):
|
||||
# this is description
|
||||
next = i + 1
|
||||
if next < count and section[next].startswith(';') == False:
|
||||
next_tokens = section[next].split()
|
||||
descs[next_tokens[0]] = section[i].removeprefix(';')
|
||||
continue
|
||||
|
||||
tokens = section[i].split()
|
||||
@@ -186,4 +180,15 @@ def inp_in_pattern_v3(section: list[str]) -> ChangeSet:
|
||||
|
||||
|
||||
def inp_out_pattern_v3(name: str) -> list[str]:
|
||||
return []
|
||||
lines = []
|
||||
objs = read_all(name, f"select * from patterns order by _order")
|
||||
ids = []
|
||||
for obj in objs:
|
||||
id = obj['id']
|
||||
if id not in ids:
|
||||
# for EPA3, ignore time of variable pattern...
|
||||
lines.append(f'{id} FIXED')
|
||||
ids.append(id)
|
||||
factor = obj['factor']
|
||||
lines.append(f'{id} {factor}')
|
||||
return lines
|
||||
|
||||
Reference in New Issue
Block a user