Created
May 12, 2011 09:15
-
-
Save mgmarino/968225 to your computer and use it in GitHub Desktop.
Sort Juan events
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
import csv | |
cleaned_file = 'before_fire_LG_cleaned.txt' | |
all_events_file = 'LE4.txt' | |
output_file = 'LE5MGM.txt' | |
cleaned = csv.reader(open(cleaned_file), delimiter='\t') | |
clean_events = dict( [ (row[0], {'ts' : row[0], | |
'energy' : row[1], | |
'line' : ' '.join(row[:2]) } ) | |
for row in cleaned] ) | |
all_list = [row for row in csv.reader(open(all_events_file), delimiter='\t')] | |
all_events = [ "\t".join(row[:3] + [str(int(clean_events.has_key(row[0])))]) | |
for row in all_list] | |
open(output_file, 'w').write('\n'.join(all_events) + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment