def process_particle_file(file_names, lat=None, lng=None): gf, pf = None, None for file_name in file_names: print 'Processing %s...' % file_name if file_name.upper().find('.LOG') != -1: gf = GPSFile(file_name) gf.load_file() gf.print_records() print('gps file loaded') raw_input('waiting...') else: pf = ParticleFile(file_name) pf.load_file() pf.print_records() print('particle file loaded') raw_input('waiting...') if gf is not None: print('Zipping coordinates...') pf.zip_coordinates(gf.records) elif lat is not None and lng is not None: for rec in pf.records: rec.lat = lat rec.lng = lng pf.to_csv() pf.populate_database()
def process_carbon_file(file_names): for file_name in file_names: print 'Processing %s...' % file_name if file_name.upper().find('.LOG') != -1: gf = GPSFile(file_name) gf.load_file() #gf.print_records() print('gps file loaded') else: cf = CarbonFile(file_name) cf.load_file() print('carbon file loaded') print('Zipping coordinates...') cf.zip_coordinates(gf.records) cf.to_csv() cf.print_records()