Skip to content

Commit 236cd23

Browse files
authored
Merge pull request #185 from fdarvas/master
install correct pyexif tool version
2 parents 7fdef86 + 3fd1474 commit 236cd23

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

micasense/metadata.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,21 @@ def position(self):
123123
def utc_time(self):
124124
''' Get the timezone-aware datetime of the image capture '''
125125
str_time = self.get_item('EXIF:DateTimeOriginal')
126-
utc_time = datetime.strptime(str_time, "%Y:%m:%d %H:%M:%S")
127-
subsec = int(self.get_item('EXIF:SubSecTime'))
128-
negative = 1.0
129-
if subsec < 0:
130-
negative = -1.0
131-
subsec *= -1.0
132-
subsec = float('0.{}'.format(int(subsec)))
133-
subsec *= negative
134-
ms = subsec * 1e3
135-
utc_time += timedelta(milliseconds = ms)
136-
timezone = pytz.timezone('UTC')
137-
utc_time = timezone.localize(utc_time)
126+
if str_time is not None:
127+
utc_time = datetime.strptime(str_time, "%Y:%m:%d %H:%M:%S")
128+
subsec = int(self.get_item('EXIF:SubSecTime'))
129+
negative = 1.0
130+
if subsec < 0:
131+
negative = -1.0
132+
subsec *= -1.0
133+
subsec = float('0.{}'.format(int(subsec)))
134+
subsec *= negative
135+
ms = subsec * 1e3
136+
utc_time += timedelta(milliseconds = ms)
137+
timezone = pytz.timezone('UTC')
138+
utc_time = timezone.localize(utc_time)
139+
else:
140+
utc_time = None
138141
return utc_time
139142

140143
def dls_pose(self):

micasense_conda_env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ dependencies:
2323
- pysolar
2424
- pyzbar
2525
- mapboxgl
26-
- git+https://github.com/sylikc/pyexiftool#egg=pyexiftool
26+
- pyexiftool<=0.4.13
2727
- jenkspy
2828
- rawpy

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
'matplotlib',
3030
'scikit-image',
3131
'packaging',
32-
'pyexiftool',
32+
'pyexiftool<=0.4.13',
3333
'pytz',
3434
'pyzbar',
3535
'tqdm'

0 commit comments

Comments
 (0)