Skip to content

Commit

Permalink
Merge pull request #79 from arup-group/mf_fix_simplify_network
Browse files Browse the repository at this point in the history
Fix network simplification script
  • Loading branch information
mfitz authored Apr 28, 2021
2 parents bafa617 + e75ea2b commit ed78846
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,4 @@ scripts/secrets-mgr-exploration.py
*.nbconvert.*
example_data/pt2matsim_network/genet_output/*
genet_output/*
example_data/output_*/*
24 changes: 11 additions & 13 deletions scripts/simplify_network.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import argparse
import genet as gn
import json
import logging
import time
import os
import json
from genet.utils.persistence import ensure_dir
import time

from genet import read_matsim
from genet.utils.persistence import ensure_dir

if __name__ == '__main__':
arg_parser = argparse.ArgumentParser(description='Simplify a MATSim network by removing '
Expand Down Expand Up @@ -56,16 +56,14 @@

logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.WARNING)

n = gn.Network(projection)
logging.info('Reading in network at {}'.format(network))
n.read_matsim_network(network)
if schedule:
logging.info(f'Reading in schedule at {schedule}')
if vehicles:
logging.info(f'Reading in vehicles at {vehicles}')
else:
logging.info('No vehicles file given with the Schedule, vehicle types will be based on the default.')
n.read_matsim_schedule(schedule, vehicles)
n = read_matsim(
path_to_network=network,
epsg=projection,
path_to_schedule=schedule,
path_to_vehicles=vehicles
)

logging.info('Simplifying the Network.')

start = time.time()
Expand Down

0 comments on commit ed78846

Please sign in to comment.