forked from asu-trans-ai-lab/grid2demand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tutorial_demand_from_TAZ.py
34 lines (23 loc) · 1.04 KB
/
tutorial_demand_from_TAZ.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding:utf-8 -*-
##############################################################
# Created Date: Monday, September 11th 2023
# Contact Info: luoxiangyong01@gmail.com
# Author/Copyright: Mr. Xiangyong Luo
##############################################################
from __future__ import absolute_import
import grid2demand as gd
if __name__ == "__main__":
# Step 0: Specify input directory
INPUT_DIR = r"datasets\demand_from_TAZ\SF_TAZ_are_centroids"
# Initialize a GRID2DEMAND object
net = gd.GRID2DEMAND(input_dir=INPUT_DIR, verbose=False)
# Step 1: Load node and poi data from input directory
net.load_network()
# Step 2: Generate zone dictionary from zone.csv file
net.taz2zone()
net.map_zone_node_poi()
net.calc_zone_od_distance(pct=1)
# Step 3: Run gravity model to generate agent-based demand
net.run_gravity_model()
# Step 4: Output demand, agent, zone, zone_od_dist_table, zone_od_dist_matrix files
net.save_results_to_csv(node=True, poi=False, zone=False, overwrite_file=False)