Last active
July 19, 2020 20:31
Revisions
-
markmarkoh revised this gist
Jul 19, 2020 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ [ { "hex": "87416e865ffffff", "count": 862 }, { "hex": "87414880bffffff", "count": 866 }, { ...] -
markmarkoh revised this gist
Jul 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import csv import json with open('./thor_filtered.csv', newline='') as csvfile: line = csv.reader(csvfile, delimiter=',') lines = 0 results = {} -
markmarkoh created this gist
Jul 19, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ import h3 import csv import json with open('./data.csv', newline='') as csvfile: line = csv.reader(csvfile, delimiter=',') lines = 0 results = {} for row in line: lines += 1 if (lines == 1): continue lat, lng = float(row[8]), float(row[9]) hexval = h3.geo_to_h3(lat, lng, 7) if hexval in results: results[hexval] += 1 else: results[hexval] = 1 hexarr = [] for val in results: # skip the 1 off in this dataset, looks to be air combat? count = results[val] if count == 1 or count > 7000: continue obj = {} obj['hex'] = val obj['count'] = count hexarr.append(obj) print(json.dumps(hexarr, indent=2))