forked from hcc226/UrbanMotionAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreeMapCal.py
More file actions
143 lines (123 loc) · 3.42 KB
/
treeMapCal.py
File metadata and controls
143 lines (123 loc) · 3.42 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# treeMap ����
#
# python treeMapCal.py -d /home/joe/Documents/git/fake -p /home/joe/Documents/git/fake -e 0.01 -m 40 [grid]
# [circle]
#
# line
# python treeMapCal.py -d /datahouse/tao.jiang -p /datahouse/tao.jiang -e 2 -m 10
import sys
import time
import logging
from util.tripFlow.constructTreeMap import ConstructTreeMap
def processTask(x, stdindir, stdoutdir, tree_num, search_angle, seed_strength, tree_width, jump_length, seed_unit, grid_dirnum, delta, max_distance, grid_size, city):
dataType = 'angle'
LngSPLIT = 0.0064
LatSPLIT = 0.005
cityLatLngDict = {
'BJ':{
'north': 41.0500, # 41.050,
'south': 39.4570, # 39.457,
'west': 115.4220, # 115.422,
'east': 117.5000, # 117.500
},
'TJ': {
'north': 40.2500, # 40.1500,
'south': 38.5667, # 38.340,
'west': 116.7167, # 116.430,
'east': 118.3233, # 118.1940
},
'TS':{
'north': 40.3333, # 41.050,
'south': 35.9167, # 39.457,
'west': 117.50, # 115.422,
'east': 119.3167, # 117.500
}
}
locs = cityLatLngDict[city]
if grid_size == 100:
LatSPLIT = 0.001
LngSPLIT = 0.00128
if grid_size == 250:
LatSPLIT = 0.0025
LngSPLIT = 0.0032
if grid_size == 1000:
LatSPLIT = 0.01
LngSPLIT = 0.0128
if grid_size == 2000:
LatSPLIT = 0.02
LngSPLIT = 0.0256
if grid_size == 4000:
LatSPLIT = 0.04
LngSPLIT = 0.0512
if grid_size == 5000:
LatSPLIT = 0.05
LngSPLIT = 0.064
custom_params = {
'tree_num': tree_num,
'search_angle': search_angle,
'seed_strength': seed_strength,
'max_curvation': 90,
'tree_width': tree_width,
'jump_length': jump_length,
"seed_unit": seed_unit,
"grid_dirnum": grid_dirnum,
'max_distance': max_distance,
'LngSPLIT': LngSPLIT,
'LatSPLIT': LatSPLIT,
'delta': delta,
'city': city,
'locs': locs
}
hotspot_dir = "from"
if seed_unit == 'thub':
hotspot_dir = 'to'
PROP = {
'index': x,
'IDIRECTORY': stdindir,
'ODIRECTORY': stdoutdir,
'dataType': dataType,
'hotspot_dir': hotspot_dir,
'custom_params': custom_params
}
task = ConstructTreeMap(PROP)
task.run()
def usage():
# print "python treeMapCal.py -d /dir -p /dir -x 9 -n 0.03 -a 60 -s 0.3 -w 3 -l 3"
# 'stdindir='
# 'stdoutdir'
# "index="
# "tree_num"
# "search_angle"
# "seed_strength"
# "tree_width"
# "jump_length"
# "seed_unit"
# "grid_dirnum"
# "delta"
print "python treeMapCal.py /datahouse/tripflow/200 /datahouse/tripflow/200 9 0.03 60 0.1 1 3 basic -1 1 9999"
def main(argv):
[indir, outdir, x, tree_num, search_angle, seed_strength, tree_width, jump_length, seed_unit, grid_dirnum, delta, max_distance, grid_size, city] = argv
x = int(x)
tree_num = float(tree_num)
search_angle = int(search_angle)
seed_strength = float(seed_strength)
tree_width = int(tree_width)
jump_length = int(jump_length)
grid_dirnum = int(grid_dirnum)
delta = float(delta)
max_distance = float(max_distance)
grid_size = int(grid_size)
city = str(city)
STARTTIME = time.time()
print "Start approach at %s" % STARTTIME
processTask(x, indir, outdir, tree_num, search_angle, seed_strength, tree_width, jump_length, seed_unit, grid_dirnum, delta, max_distance, grid_size, city)
# @���������� END
ENDTIME = time.time()
print "END TIME: %s" % ENDTIME
print "Total minutes: %f" % ((ENDTIME-STARTTIME)/60.0)
if __name__ == '__main__':
logging.basicConfig(filename='logger-treemapflowcal.log', level=logging.DEBUG)
main(sys.argv[1:])