-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from aerispaha/profile_plotter
Add profile plotter and pyswmm integration
- Loading branch information
Showing
24 changed files
with
1,305 additions
and
203 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ m2r | |
mistune==0.8.4 | ||
# Run dependencies | ||
pyproj>=3.0.0 | ||
geopandas | ||
matplotlib | ||
pyswmm>=1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,61 @@ | ||
import argparse | ||
import os | ||
from itertools import chain | ||
|
||
from swmmio.run_models.run import run_simple, run_hot_start_sequence | ||
from swmmio.run_models import start_pool | ||
|
||
from swmmio import Model | ||
from itertools import chain | ||
import os | ||
import argparse | ||
from multiprocessing import Pool, cpu_count | ||
from datetime import datetime | ||
|
||
#parse the arguments | ||
parser = argparse.ArgumentParser(description='Process some stuff') | ||
parser.add_argument('-r', '--run', dest='model_to_run', nargs="+") | ||
parser.add_argument('-rhs', '--run_hotstart', dest='hotstart_model_to_run', nargs="+") | ||
parser.add_argument('-sp', '--start_pool', dest='start_pool', nargs="+") | ||
parser.add_argument('-cores_left', '--cores_left', dest='cores_left', default=4, type=int) | ||
parser.add_argument('-pp', '--post_process', dest='post_process', nargs="+") | ||
def main(): | ||
# parse the arguments | ||
parser = argparse.ArgumentParser(description='Process some stuff') | ||
parser.add_argument('-r', '--run', dest='model_to_run', nargs="+") | ||
parser.add_argument('-rhs', '--run_hotstart', dest='hotstart_model_to_run', nargs="+") | ||
parser.add_argument('-sp', '--start_pool', dest='start_pool', nargs="+") | ||
parser.add_argument('-cores_left', '--cores_left', dest='cores_left', default=4, type=int) | ||
parser.add_argument('-pp', '--post_process', dest='post_process', nargs="+") | ||
|
||
args = parser.parse_args() | ||
wd = os.getcwd() # current directory script is being called from | ||
|
||
args = parser.parse_args() | ||
wd = os.getcwd() #current directory script is being called from | ||
if args.model_to_run is not None: | ||
|
||
if args.model_to_run is not None: | ||
models_paths = [os.path.join(wd, f) for f in args.model_to_run] | ||
print('Adding models to queue:\n\t{}'.format('\n\t'.join(models_paths))) | ||
|
||
models_paths = [os.path.join(wd, f) for f in args.model_to_run] | ||
print('Adding models to queue:\n\t{}'.format('\n\t'.join(models_paths))) | ||
# run the models in series (one after the other) | ||
list(map(run_simple, models_paths)) | ||
# run_simple(args.model_to_run) | ||
|
||
#run the models in series (one after the other) | ||
list(map(run_simple, models_paths)) | ||
# run_simple(args.model_to_run) | ||
elif args.hotstart_model_to_run is not None: | ||
models_paths = [os.path.join(wd, f) for f in args.hotstart_model_to_run] | ||
print('hotstart_model_to_run the model: {}'.format(args.hotstart_model_to_run)) | ||
# m = Model(args.hotstart_model_to_run) | ||
# run_hot_start_sequence(m)#args.hotstart_model_to_run) | ||
list(map(run_hot_start_sequence, models_paths)) | ||
|
||
elif args.hotstart_model_to_run is not None: | ||
models_paths = [os.path.join(wd, f) for f in args.hotstart_model_to_run] | ||
print('hotstart_model_to_run the model: {}'.format(args.hotstart_model_to_run)) | ||
# m = Model(args.hotstart_model_to_run) | ||
# run_hot_start_sequence(m)#args.hotstart_model_to_run) | ||
list(map(run_hot_start_sequence, models_paths)) | ||
elif args.start_pool is not None: | ||
|
||
elif args.start_pool is not None: | ||
models_dirs = [os.path.join(wd, f) for f in args.start_pool] | ||
print('Searching for models in:\n\t{}'.format('\n\t'.join(models_dirs))) | ||
# combine the segments and options (combinations) into one iterable | ||
inp_paths = [] | ||
for root, dirs, files in chain.from_iterable(os.walk(path) for path in models_dirs): | ||
for f in files: | ||
if f.endswith('.inp') and 'bk' not in root: | ||
# we've found a directory containing an inp | ||
inp_paths.append(os.path.join(root, f)) | ||
|
||
models_dirs = [os.path.join(wd, f) for f in args.start_pool] | ||
print('Searching for models in:\n\t{}'.format('\n\t'.join(models_dirs))) | ||
#combine the segments and options (combinations) into one iterable | ||
inp_paths = [] | ||
for root, dirs, files in chain.from_iterable(os.walk(path) for path in models_dirs): | ||
for f in files: | ||
if f.endswith('.inp') and 'bk' not in root: | ||
#we've found a directory containing an inp | ||
inp_paths.append(os.path.join(root, f)) | ||
# call the main() function in start_pool.py | ||
start_pool.main(inp_paths, args.cores_left) | ||
|
||
print("swmmio has completed running {} models".format(len(inp_paths))) | ||
|
||
#call the main() function in start_pool.py | ||
start_pool.main(inp_paths, args.cores_left) | ||
else: | ||
print('you need to pass in some args') | ||
|
||
print("swmmio has completed running {} models".format(len(inp_paths))) | ||
return 0 | ||
|
||
|
||
else: | ||
print('you need to pass in some args') | ||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.