예제 #1
0
    arg_parser.add_argument(
        '-pp',
        '--processes',
        help='Number of parallel processes to split process across',
        default=1,
        type=int)

    arg_parser.add_argument('-od',
                            '--output_dir',
                            help='Output directory for the network',
                            required=True)

    args = vars(arg_parser.parse_args())
    osm = args['osm']
    config = args['config']
    connected_components = args['connected_components']
    projection = args['projection']
    processes = args['processes']
    output_dir = args['output_dir']

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

    n = gn.Network(projection)
    logging.info('Reading in network at {}'.format(osm))
    n.read_osm(osm, config, num_processes=processes)
    # TODO uncomment when this functionality makes it to master
    # for mode in ['walk', 'car', 'bike']:
    #     n.retain_n_connected_subgraphs(n=connected_components, mode=mode)
    n.write_to_matsim(output_dir)
예제 #2
0
        help='Output directory for the reprojected network',
        required=True)

    args = vars(arg_parser.parse_args())
    network = args['network']
    schedule = args['schedule']
    vehicles = args['vehicles']
    current_projection = args['current_projection']
    new_projection = args['new_projection']
    processes = args['processes']
    output_dir = args['output_dir']

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

    n = gn.Network(current_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)
    else:
        logging.info(
            'You have not passed the schedule.xml file. If your network is road only, that is fine, otherwise'
            'if you mix and match them, you will have a bad time.')