mirror of
https://github.com/Ahp06/SUMO_Emissions.git
synced 2024-11-21 19:16:30 +00:00
Rename static to template
This commit is contained in:
parent
39428c2f93
commit
c977aacbc5
@ -9,11 +9,11 @@ import randomTrips
|
||||
|
||||
# Absolute path of the directory the script is in
|
||||
SCRIPTDIR = os.path.dirname(__file__)
|
||||
STATICDIR = os.path.join(SCRIPTDIR, 'static')
|
||||
TEMPLATEDIR = os.path.join(SCRIPTDIR, 'templates')
|
||||
|
||||
|
||||
def load_netconvert_template(osm_input, out_name):
|
||||
tree = ElementTree.parse(os.path.join(STATICDIR, 'simul.netcfg'))
|
||||
tree = ElementTree.parse(os.path.join(TEMPLATEDIR, 'simul.netcfg'))
|
||||
root = tree.getroot()
|
||||
root.find('input/osm-files').set('value', osm_input)
|
||||
root.find('output/output-file').set('value', f'{out_name}.net.xml')
|
||||
@ -22,7 +22,7 @@ def load_netconvert_template(osm_input, out_name):
|
||||
|
||||
|
||||
def load_polyconvert_template(osm_file, type_file, scenario_name):
|
||||
tree = ElementTree.parse(os.path.join(STATICDIR, 'simul.polycfg'))
|
||||
tree = ElementTree.parse(os.path.join(TEMPLATEDIR, 'simul.polycfg'))
|
||||
root = tree.getroot()
|
||||
root.find('input/osm-files').set('value', osm_file)
|
||||
root.find('input/net-file').set('value', f'{scenario_name}.net.xml')
|
||||
@ -33,7 +33,7 @@ def load_polyconvert_template(osm_file, type_file, scenario_name):
|
||||
|
||||
|
||||
def load_sumoconfig_template(simulation_name):
|
||||
tree = ElementTree.parse(os.path.join(STATICDIR, 'simul.sumocfg'))
|
||||
tree = ElementTree.parse(os.path.join(TEMPLATEDIR, 'simul.sumocfg'))
|
||||
root = tree.getroot()
|
||||
root.find('input/net-file').set('value', f'{simulation_name}.net.xml')
|
||||
root.find('input/route-files').set('value', f'{simulation_name}.rou.xml')
|
||||
@ -52,7 +52,7 @@ def generate_scenario(osm_file, out_path, scenario_name):
|
||||
net_template.write(netconfig)
|
||||
poly_template.write(polyconfig)
|
||||
# Copy typemaps to tempdir
|
||||
shutil.copytree(os.path.join(STATICDIR, 'typemap'), os.path.join(tmpdirname, 'typemap'))
|
||||
shutil.copytree(os.path.join(TEMPLATEDIR, 'typemap'), os.path.join(tmpdirname, 'typemap'))
|
||||
polyconvert_cmd = ['polyconvert', '-c', polyconfig]
|
||||
netconvertcmd = ['netconvert', '-c', netconfig]
|
||||
subprocess.run(netconvertcmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user