-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
43 lines (32 loc) · 1.02 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from epyt import epanet
import os
import argparse
import os
def main(*args):
# Initialize the argument parser
parser = argparse.ArgumentParser(description="Process input parameters.")
# Define the expected parameter with a default value
parser.add_argument('--inpname', type=str, default='Net1',
help="Inpname (default: Net1.inp).")
print(11)
processed_args = []
print(args)
for arg in args:
if arg.startswith('--inpname='):
key, value = arg.split('=', 1)
processed_args.extend([key, value])
else:
print(arg)
break
G = epanet(arg + '.inp')
h = G.plot()
h.savefig('../results/test.png')
# Add all subdirectories of the current working directory to sys.path
for root, dirs, files in os.walk(os.getcwd()):
if root not in os.sys.path:
os.sys.path.append(root)
print("Paths Loaded.")
# Example usage
if __name__ == "__main__":
import sys
main(*sys.argv[1:])