-
Notifications
You must be signed in to change notification settings - Fork 4
/
runMAZSkimsInitial.py
85 lines (75 loc) · 3.31 KB
/
runMAZSkimsInitial.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#############################################################################
# Run MAZ Skimming Initial Setup
# Ben Stabler, [email protected], 10/29/12
# Roshan Kumar, [email protected]
# "C:\Python26\P64\python.exe" runMAZSkimsInitial
#############################################################################
#inputs
isBaseYear = True
navteqShpFile = "inputs/Chicago_streets.shp"
#SPThreshold = 15*5280 #max dist in feet
SPThreshold = 5*5280 #max dist in feet
maxMAZID = 70000
minTAPID = 60000
maxCenID = 16819
rsThreshold = 9
landUseTypes = 12
centroidsMAZFile = "inputs/CMAP_MAZ_cents.txt"
rsToSZInput = "inputs/cmapRStoSubZone.txt"
tapFile = "inputs/tap_attributes.csv"
spMAZ2TAP = "outputs/SP_MAZ_to_MAZ_and_TAP.txt"
nodesinMAZFile = "inputs/nodes_in_MAZ_CMAP.txt"
#additional parameters for future year maz skims
nodeDistFromHwy = "inputs/cmapDistFromHwy.txt" #for future build MAZs
mazLUFile = "inputs/cmapMAZLandUseShare.txt" #for future build MAZs
spInsideRS8 = "outputs/SP_with_TAP_clean_RS8_LU_Share_Dist.txt" #for future build MAZs
spOutsideRS8 = "outputs/SP_with_TAP_clean_outside_RS8_LU_Share_Dist.txt" #for future build MAZs
############################################################################
#intermediate settings
import os, csv, math, shutil
root = os.getcwd()
int_output = "outputs"
connectorEDist = 2 * SPThreshold
minTAPid = 2 * minTAPID
SPThresholdConn = 3 * SPThreshold
SPThresholdAct = SPThreshold
number_of_cores = int(os.environ["NUMBER_OF_PROCESSORS"])
linkFile_int = "outputs/cmap_NavTechLinks_no_freeway.txt" #without connectors
nodeFile_int = "outputs/cmap_NavTechNodes_no_freeway.txt" #without centroids
outputSPFile = "outputs/centToCentDist.txt"
tapConnectorFile = "outputs/tapConnectors.txt"
connectorFile = "outputs/CMAP_connectors.txt"
linkFile = "outputs/linkFile_Final.txt" #with connectors
nodeFile = "outputs/nodeFile_Final.txt" #with centroids
############################################################################
def main():
#copy itself to the scripts folder for other scripts to reference
shutil.copyfile("runMAZSkimsInitial.py", "scripts/parameters.py")
print("run initial network build procedures")
from scripts import cmapTransportationNetwork
from scripts import cmapTapConnector
from scripts import cmapCentroidsConnectors
from scripts import cmapInputFileGen
if isBaseYear:
from scripts import cmapShortestPath_NX
else:
from scripts import cmapShortestPath_NX_future
print("read shapefile and generate csv file of navteq links")
cmapTransportationNetwork.getLinkDirectionality()
print("read shapefile and generate csv file of navteq nodes")
cmapTransportationNetwork.createAllPoints()
print("create MAZ centroid connectors")
cmapCentroidsConnectors.createNetworkWithCentroidConnectors()
print("create TAP connectors")
cmapTapConnector.createNetworkWithCentroidConnectors()
print("merge node and link files to one node and one link file containing all elements")
cmapInputFileGen.createNetworkInput()
if isBaseYear:
print("pickle network for later use")
cmapShortestPath_NX.pickleNetwork()
else:
print("pickle network for later use")
cmapShortestPath_NX_future.pickleNetwork()
print("initial shortest path network build complete")
if __name__ == '__main__':
main()