Moved creation and propagation of radiation_list and position_list out of the main loop.
This commit is contained in:
parent
d51c28b753
commit
cbb21db442
61
rad_tag.py
61
rad_tag.py
@ -52,6 +52,37 @@ args = parser.parse_args()
|
||||
# Create timezone datetime object
|
||||
local_timezone = pytz.timezone(args.timezone)
|
||||
|
||||
# Initialize two empty lists for comparison
|
||||
radiation_list = []
|
||||
position_list = []
|
||||
|
||||
# Import GeigerCounter log
|
||||
with open(args.csv, "r") as f:
|
||||
csv_reader = csv.reader(filter(lambda row: row[0] != '#', f),
|
||||
delimiter=',', skipinitialspace=True)
|
||||
|
||||
for _, csv_raw_time, csv_raw_cpm, _ in csv_reader:
|
||||
radiation = Radiation(csv_raw_time, csv_raw_cpm, local_timezone, args.sifactor)
|
||||
radiation_list.append(radiation)
|
||||
#print(radiation_list)
|
||||
|
||||
# close CSV file
|
||||
f.close()
|
||||
|
||||
# Import GPX track(s)
|
||||
if args.gpx is not None:
|
||||
gpx_file = open(args.gpx, 'r')
|
||||
gpx_reader = gpxpy.parse(gpx_file)
|
||||
|
||||
for waypoint in gpx_reader.waypoints:
|
||||
for track in gpx_reader.tracks:
|
||||
for segment in track.segments:
|
||||
for point in segment.points:
|
||||
position = [point.time, point.latitude, point.longitude]
|
||||
position_list.append(position)
|
||||
#print(position_list)
|
||||
|
||||
|
||||
# Inform the user about what is going to happen
|
||||
if args.dry is True:
|
||||
print('Not modifying anything. Just print what would happen without --dry')
|
||||
@ -88,35 +119,5 @@ for src_photo in args.photos:
|
||||
# Set timezone
|
||||
pic_time = pic_naive_time.astimezone(local_timezone)
|
||||
|
||||
# Initialize two empty lists for comparison
|
||||
radiation_list = []
|
||||
position_list = []
|
||||
|
||||
# Import GeigerCounter log
|
||||
with open(args.csv, "r") as f:
|
||||
csv_reader = csv.reader(filter(lambda row: row[0] != '#', f),
|
||||
delimiter=',', skipinitialspace=True)
|
||||
|
||||
for _, csv_raw_time, csv_raw_cpm, _ in csv_reader:
|
||||
radiation = Radiation(csv_raw_time, csv_raw_cpm, local_timezone, args.sifactor)
|
||||
radiation_list.append(radiation)
|
||||
#print(radiation_list)
|
||||
|
||||
# close CSV file
|
||||
f.close()
|
||||
|
||||
# Import GPX track(s)
|
||||
if args.gpx is not None:
|
||||
gpx_file = open(args.gpx, 'r')
|
||||
gpx_reader = gpxpy.parse(gpx_file)
|
||||
|
||||
for waypoint in gpx_reader.waypoints:
|
||||
for track in gpx_reader.tracks:
|
||||
for segment in track.segments:
|
||||
for point in segment.points:
|
||||
position = [point.time, point.latitude, point.longitude]
|
||||
position_list.append(position)
|
||||
#print(position_list)
|
||||
|
||||
# Print table header
|
||||
print('{:<15} {:<25} {:<22}'.format('filename', 'date / time', 'Exif UserComment'))
|
||||
|
Loading…
Reference in New Issue
Block a user