cellid

cellid - Imports OpenCellID data files.

class upoints.cellid.Cell(ident, latitude, longitude, mcc, mnc, lac, cellid, crange, samples, created, updated)[source]

Bases: upoints.point.Point

Class for representing a cellular cite from OpenCellID.org.

New in version 0.11.0.

Initialise a new Cell object.

Parameters:
  • ident (int) – OpenCellID database identifier
  • latitude (float) – Cell’s latitude
  • longitude (float) – Cell’s longitude
  • mcc (int) – Cell’s country code
  • mnc (int) – Cell’s network code
  • lac (int) – Cell’s local area code
  • cellid (int) – Cell’s identifier
  • crange (int) – Cell’s range
  • samples (int) – Number of samples for the cell
  • created (datetime.datetime) – Date the cell was first entered
  • updated (datetime.datetime) – Date of the last update
class upoints.cellid.Cells(cells_file=None)[source]

Bases: upoints.point.KeyedPoints

Class for representing a group of Cell objects.

New in version 0.11.0.

Initialise a new Cells object.

import_locations(cells_file)[source]

Parse OpenCellID.org data files.

import_locations() returns a dictionary with keys containing the OpenCellID.org database identifier, and values consisting of a Cell objects.

It expects cell files in the following format:

22747,52.0438995361328,-0.2246370017529,234,33,2319,647,0,1,
2008-04-05 21:32:40,2008-04-05 21:32:40
22995,52.3305015563965,-0.2255620062351,234,10,20566,4068,0,1,
2008-04-05 21:32:59,2008-04-05 21:32:59
23008,52.3506011962891,-0.2234109938145,234,10,10566,4068,0,1,
2008-04-05 21:32:59,2008-04-05 21:32:59

The above file processed by import_locations() will return the following dict object:

{23008: Cell(23008, 52.3506011963, -0.223410993814, 234, 10, 10566,
             4068, 0, 1, datetime.datetime(2008, 4, 5, 21, 32, 59),
             datetime.datetime(2008, 4, 5, 21, 32, 59)),
 22747: Cell(22747, 52.0438995361, -0.224637001753, 234, 33, 2319,
             647, 0, 1, datetime.datetime(2008, 4, 5, 21, 32, 40),
             datetime.datetime(2008, 4, 5, 21, 32, 40)),
 22995: Cell(22995, 52.3305015564, -0.225562006235, 234, 10, 20566,
             4068, 0, 1, datetime.datetime(2008, 4, 5, 21, 32, 59),
             datetime.datetime(2008, 4, 5, 21, 32, 59))}
Parameters:cells_file (iter) – Cell data to read
Returns:Cell data with their associated database identifier
Return type:dict