|
@@ -8,14 +8,15 @@ import plan_gen.plan_gen as pg
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
# command line arguments
|
|
|
- if len(sys.argv) != 5:
|
|
|
- print('usage:', sys.argv[0], '<nb_persons> <input_network> <input_home_clusters> <input_work_clusters>')
|
|
|
- print('type "" if you don\'t want to use specific clusters')
|
|
|
+ if len(sys.argv) != 2:
|
|
|
+ print('usage:', sys.argv[0], '<params>')
|
|
|
sys.exit(-1)
|
|
|
- NB_PERSONS = int(sys.argv[1])
|
|
|
- INPUT_NETWORK = sys.argv[2]
|
|
|
- INPUT_HOME_CLUSTERS = sys.argv[3].split(',')
|
|
|
- INPUT_WORK_CLUSTERS = sys.argv[4].split(',')
|
|
|
+ DICT_PARAMS = pg.parse_params(sys.argv[1])
|
|
|
+
|
|
|
+ NB_PERSONS = DICT_PARAMS['np']
|
|
|
+ INPUT_NETWORK = DICT_PARAMS['nw']
|
|
|
+ INPUT_HOME_CLUSTERS = DICT_PARAMS['hc'] if 'hc' in DICT_PARAMS else ''
|
|
|
+ INPUT_WORK_CLUSTERS = DICT_PARAMS['wc'] if 'wc' in DICT_PARAMS else ''
|
|
|
|
|
|
# get data
|
|
|
NODES = pg.read_nodes(INPUT_NETWORK)
|
|
@@ -29,4 +30,4 @@ if __name__ == '__main__':
|
|
|
# print XML
|
|
|
print('<?xml version="1.0" ?>')
|
|
|
print('<!DOCTYPE plans SYSTEM "http://www.matsim.org/files/dtd/plans_v4.dtd">')
|
|
|
- print(etree.tostring(PLANS, pretty_print=True).decode('utf-8'))
|
|
|
+ print(etree.tostring(PLANS, pretty_print=True).decode('utf-8'))
|