Skip to content

Commit

Permalink
Merge pull request micasense#185 from fdarvas/master
Browse files Browse the repository at this point in the history
install correct pyexif tool version
  • Loading branch information
fdarvas authored Apr 26, 2022
2 parents 7fdef86 + 3fd1474 commit 236cd23
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions micasense/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,21 @@ def position(self):
def utc_time(self):
''' Get the timezone-aware datetime of the image capture '''
str_time = self.get_item('EXIF:DateTimeOriginal')
utc_time = datetime.strptime(str_time, "%Y:%m:%d %H:%M:%S")
subsec = int(self.get_item('EXIF:SubSecTime'))
negative = 1.0
if subsec < 0:
negative = -1.0
subsec *= -1.0
subsec = float('0.{}'.format(int(subsec)))
subsec *= negative
ms = subsec * 1e3
utc_time += timedelta(milliseconds = ms)
timezone = pytz.timezone('UTC')
utc_time = timezone.localize(utc_time)
if str_time is not None:
utc_time = datetime.strptime(str_time, "%Y:%m:%d %H:%M:%S")
subsec = int(self.get_item('EXIF:SubSecTime'))
negative = 1.0
if subsec < 0:
negative = -1.0
subsec *= -1.0
subsec = float('0.{}'.format(int(subsec)))
subsec *= negative
ms = subsec * 1e3
utc_time += timedelta(milliseconds = ms)
timezone = pytz.timezone('UTC')
utc_time = timezone.localize(utc_time)
else:
utc_time = None
return utc_time

def dls_pose(self):
Expand Down
2 changes: 1 addition & 1 deletion micasense_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies:
- pysolar
- pyzbar
- mapboxgl
- git+https://github.com/sylikc/pyexiftool#egg=pyexiftool
- pyexiftool<=0.4.13
- jenkspy
- rawpy
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'matplotlib',
'scikit-image',
'packaging',
'pyexiftool',
'pyexiftool<=0.4.13',
'pytz',
'pyzbar',
'tqdm'
Expand Down

0 comments on commit 236cd23

Please sign in to comment.