-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgeo_filter.py
29 lines (22 loc) · 1.12 KB
/
geo_filter.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
with open("./data/disasters/newyork_storm/newyork_storm_unaffected_unfiltered_non_spam.txt", "wb") as f2:
with open("./data/disasters/newyork_storm/newyork_storm_unaffected_unfiltered_non_spam_1.txt") as f:
count = 0
for line in f:
a = [x.strip() for x in line.split(',')]
if (41.00477 <= float(a[-2]) <= 43.23497) and (-77.5042 <= float(a[-1]) <= -73.23486):
continue
else:
count += 1
f2.write(','.join(a) + '\n')
print count
with open("./data/disasters/napa_earthquake/napa_earthquake_unaffected_unfiltered_non_spam.txt", "wb") as f2:
with open("./data/disasters/napa_earthquake/napa_earthquake_unaffected_unfiltered_non_spam_1.txt") as f:
count = 0
for line in f:
a = [x.strip() for x in line.split(',')]
if (36.22491 <= float(a[-2]) <= 39.97461) and (-123.81645 <= float(a[-1]) <= -118.7825):
count += 1
f2.write(','.join(a) + '\n')
print count
#39.97461, -123.81645 36.22491, -118.7825
# ny - 43.23497, -77.5042 41.00477, -73.23486