Created
March 30, 2015 13:53
-
-
Save kreed/6a951a3cf3b01d8d11fb to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env python | |
# Extracts T-Mobile cells from from Mozilla Location Service data | |
# | |
# Usage: Download an MLS export from https://location.services.mozilla.com/downloads | |
# and run with mls.py MLS-full-cell-export-XXXXXXXXX.csv.gz [low sector] [high sector] | |
from __future__ import print_function | |
import gzip | |
import sys | |
import time | |
low_sector = int(sys.argv[2]) | |
high_sector = int(sys.argv[3]) | |
file = gzip.GzipFile(sys.argv[1], 'r') | |
print('lon,lat,gci,sector,range,samples,created,updated') | |
for line in file: | |
if line[0:12] == 'LTE,310,260,': | |
radio, mcc, net, area, cell, unit, lon, lat, range, samples, changeable, created, updated, averageSignal = line.split(',') | |
sector = int(cell) & 0xff | |
if sector >= low_sector and sector <= high_sector: | |
created = time.strftime('%Y-%m-%d', time.gmtime(int(created))) | |
updated = time.strftime('%Y-%m-%d', time.gmtime(int(updated))) | |
print(lon,lat,cell,sector,range,samples,created,updated,sep=',') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment