def usermetrics(ctx): dbname = ctx.obj['dbname'] db = DB(dbname, ctx.obj['config']) db.open() um = UserMetrics(db) um.generate() db.close()
def photodensity(ctx): config = ctx.obj['config'] db = DB(ctx.obj['dbname'], config) db.open() pd = PhotoDensity(db) pd.generate() db.close()
def photodensity(ctx): config = ctx.obj["config"] db = DB(ctx.obj["dbname"], config) db.open() pd = PhotoDensity(db) pd.generate() db.close()
def usermetrics(ctx): dbname = ctx.obj["dbname"] db = DB(dbname, ctx.obj["config"]) db.open() um = UserMetrics(db) um.generate() db.close()
def usersamples(ctx): dbname = ctx.obj["dbname"] infile = ctx.obj["infile"] db = DB(dbname, ctx.obj["config"]) db.open() us = UserSamples(db, dbname, infile) us.generate() db.close()
def fix_locations(ctx): click.echo('Fixing locations') config = ctx.obj['config'] db = DB(ctx.obj['dbname'], config) db.open() fixer = FixLocations(db) fixer.run() db.close()
def retrieve(ctx): click.echo('Retrieving Instagram data') config = ctx.obj['config'] db = DB(ctx.obj['dbname'], config) db.open() retriever = Retriever(config, db) retriever.run() db.close()
def clean_locations(ctx): click.echo("Cleaning location data") db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() locs = Locations(db) locs.clean() db.close() click.echo("done.")
def usersamples(ctx): dbname = ctx.obj['dbname'] infile = ctx.obj['infile'] db = DB(dbname, ctx.obj['config']) db.open() us = UserSamples(db, dbname, infile) us.generate() db.close()
def retrieve(ctx): click.echo("Retrieving Instagram data") config = ctx.obj["config"] db = DB(ctx.obj["dbname"], config) db.open() retriever = Retriever(config, db) retriever.run() db.close()
def clean_locations(ctx): click.echo('Cleaning location data') db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) locs.clean() db.close() click.echo('done.')
def json_export(ctx): dbname = ctx.obj['dbname'] outfile = ctx.obj['outfile'] db = DB(dbname, ctx.obj['config']) db.open() je = JsonExport(db, outfile) je.export() db.close()
def fix_locations(ctx): click.echo("Fixing locations") config = ctx.obj["config"] db = DB(ctx.obj["dbname"], config) db.open() fixer = FixLocations(db) fixer.run() db.close()
def crop_rectangle(ctx): min_lat = float(ctx.obj['min_lat']) min_lng = float(ctx.obj['min_lng']) max_lat = float(ctx.obj['max_lat']) max_lng = float(ctx.obj['max_lng']) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng) db.close()
def dists(ctx): dbname = ctx.obj['dbname'] infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] db = DB(dbname, ctx.obj['config']) db.open() g = ghostb.graph.read_graph(infile) ghostb.graph.write_dists(g, db, outfile) db.close()
def crop_rectangle(ctx): min_lat = float(ctx.obj["min_lat"]) min_lng = float(ctx.obj["min_lng"]) max_lat = float(ctx.obj["max_lat"]) max_lng = float(ctx.obj["max_lng"]) db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng) db.close()
def distances(ctx): dbname = ctx.obj["dbname"] infile = ctx.obj["infile"] outfile = ctx.obj["outfile"] db = DB(dbname, ctx.obj["config"]) db.open() dist = Distances(db) dist.compute(infile, outfile) db.close()
def gen_graph(ctx): dbname = ctx.obj['dbname'] outfile = ctx.obj['outfile'] table = ctx.obj['table'] db = DB(dbname, ctx.obj['config']) db.open() gg = GenGraph(db, outfile, table) gg.generate() db.close()
def add_locations(ctx): country_code = ctx.obj['country_code'] click.echo('Adding locations for %s' % country_code) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) (points, inserted) = locs.add_locations(ctx.obj['locs_file'], country_code) db.close() click.echo('%d points found, %d points added.' % (points, inserted))
def distances(ctx): dbname = ctx.obj['dbname'] infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] db = DB(dbname, ctx.obj['config']) db.open() dist = Distances(db) dist.compute(infile, outfile) db.close()
def gen_graph(ctx): dbname = ctx.obj["dbname"] outfile = ctx.obj["outfile"] table = ctx.obj["table"] db = DB(dbname, ctx.obj["config"]) db.open() gg = GenGraph(db, outfile, table) gg.generate() db.close()
def import_locations(ctx): infile = ctx.obj['infile'] click.echo('Importing locations from %s' % infile) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) (points, inserted) = locs.import_locations(infile) db.close() click.echo('%d points found, %d points added.' % (points, inserted))
def add_locations(ctx): country_code = ctx.obj["country_code"] click.echo("Adding locations for %s" % country_code) db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() locs = Locations(db) (points, inserted) = locs.add_locations(ctx.obj["locs_file"], country_code) db.close() click.echo("%d points found, %d points added." % (points, inserted))
def dists(ctx): dbname = ctx.obj["dbname"] infile = ctx.obj["infile"] outfile = ctx.obj["outfile"] db = DB(dbname, ctx.obj["config"]) db.open() g = ghostb.graph.read_graph(infile) ghostb.graph.write_dists(g, db, outfile) db.close()
def replace_low_degree(ctx): dbname = ctx.obj["dbname"] db = DB(dbname, ctx.obj["config"]) db.open() infile = ctx.obj["infile"] outfile = ctx.obj["outfile"] min_degree = float(ctx.obj["min_degree"]) rld = ReplaceLowDegree(db, infile, min_degree) rld.run(outfile) db.close()
def add_region_grid(ctx): region = ctx.obj["region"] rows = int(ctx.obj["rows"]) cols = int(ctx.obj["cols"]) click.echo("Adding grid of locations for region: %s" % region) db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() locs = Locations(db) locs.add_region_grid(region, rows, cols) db.close()
def filter_dists(ctx): dbname = ctx.obj["dbname"] db = DB(dbname, ctx.obj["config"]) db.open() infile = ctx.obj["infile"] outfile = ctx.obj["outfile"] max_dist = float(ctx.obj["max_dist"]) fd = FilterDists(db) fd.filter(infile, outfile, max_dist) db.close()
def replace_low_degree(ctx): dbname = ctx.obj['dbname'] db = DB(dbname, ctx.obj['config']) db.open() infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] min_degree = float(ctx.obj['min_degree']) rld = ReplaceLowDegree(db, infile, min_degree) rld.run(outfile) db.close()
def filter_dists(ctx): dbname = ctx.obj['dbname'] db = DB(dbname, ctx.obj['config']) db.open() infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] max_dist = float(ctx.obj['max_dist']) fd = FilterDists(db) fd.filter(infile, outfile, max_dist) db.close()
def add_region_grid(ctx): region = ctx.obj['region'] rows = int(ctx.obj['rows']) cols = int(ctx.obj['cols']) click.echo('Adding grid of locations for region: %s' % region) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) locs.add_region_grid(region, rows, cols) db.close()
def userscales(ctx): dbname = ctx.obj['dbname'] infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] scales = ctx.obj['scales'] table = ctx.obj['table'] db = DB(dbname, ctx.obj['config']) db.open() us = UserScales(db, outfile, infile, scales, table) us.generate() db.close()
def userscales(ctx): dbname = ctx.obj["dbname"] infile = ctx.obj["infile"] outfile = ctx.obj["outfile"] scales = ctx.obj["scales"] table = ctx.obj["table"] db = DB(dbname, ctx.obj["config"]) db.open() us = UserScales(db, outfile, infile, scales, table) us.generate() db.close()
def add_area(ctx): min_lat = float(ctx.obj["min_lat"]) min_lng = float(ctx.obj["min_lng"]) max_lat = float(ctx.obj["max_lat"]) max_lng = float(ctx.obj["max_lng"]) click.echo("Adding locations in area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng)) db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() locs = Locations(db) (points, inserted) = locs.add_area(ctx.obj["locs_file"], min_lat, min_lng, max_lat, max_lng) db.close() click.echo("%d points found, %d points added." % (points, inserted))
def cropgraph(ctx): infile = ctx.obj['infile'] outfile = ctx.obj['outfile'] min_lat = float(ctx.obj['min_lat']) min_lng = float(ctx.obj['min_lng']) max_lat = float(ctx.obj['max_lat']) max_lng = float(ctx.obj['max_lng']) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() cg = CropGraph(db) cg.crop(infile, outfile, min_lat, min_lng, max_lat, max_lng) db.close()
def add_area(ctx): min_lat = float(ctx.obj['min_lat']) min_lng = float(ctx.obj['min_lng']) max_lat = float(ctx.obj['max_lat']) max_lng = float(ctx.obj['max_lng']) click.echo('Adding locations in area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng)) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) (points, inserted) = locs.add_area(ctx.obj['locs_file'], min_lat, min_lng, max_lat, max_lng) db.close() click.echo('%d points found, %d points added.' % (points, inserted))
def add_grid(ctx): min_lat = float(ctx.obj['min_lat']) min_lng = float(ctx.obj['min_lng']) max_lat = float(ctx.obj['max_lat']) max_lng = float(ctx.obj['max_lng']) rows = int(ctx.obj['rows']) cols = int(ctx.obj['cols']) click.echo('Adding grid of locations for area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng)) db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() locs = Locations(db) locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols) db.close()
def add_grid(ctx): min_lat = float(ctx.obj["min_lat"]) min_lng = float(ctx.obj["min_lng"]) max_lat = float(ctx.obj["max_lat"]) max_lng = float(ctx.obj["max_lng"]) rows = int(ctx.obj["rows"]) cols = int(ctx.obj["cols"]) click.echo("Adding grid of locations for area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng)) db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() locs = Locations(db) locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols) db.close()
def create_db(ctx): click.echo('Creating database') db = DB(ctx.obj['dbname'], ctx.obj['config']) db.create_db() db.close()
def crop_region(ctx): region = ctx.obj['region'] db = DB(ctx.obj['dbname'], ctx.obj['config']) db.open() ghostb.cropdata.crop_region(db, region) db.close()
def create_db(ctx): click.echo("Creating database") db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.create_db() db.close()
def crop_region(ctx): region = ctx.obj["region"] db = DB(ctx.obj["dbname"], ctx.obj["config"]) db.open() ghostb.cropdata.crop_region(db, region) db.close()