Skip to content

Commit

Permalink
update to SHADOZ 6
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Sep 6, 2024
1 parent 8d59a62 commit 34147db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions pyshadoz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Terms and Conditions of Use
#
# Unless otherwise noted, computer program source code of this
# distribution # is covered under Crown Copyright, Government of
# distribution is covered under Crown Copyright, Government of
# Canada, and is distributed under the MIT License.
#
# The Canada wordmark and related graphics associated with this
Expand All @@ -18,7 +18,7 @@
# those files. Users are asked to read the 3rd Party Licenses
# referenced with those assets.
#
# Copyright (c) 2023 Government of Canada
# Copyright (c) 2024 Government of Canada
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -53,7 +53,7 @@
import click
from io import StringIO

__version__ = '0.1.3'
__version__ = '0.2.0'

LOGGER = logging.getLogger(__name__)

Expand All @@ -80,7 +80,10 @@ def _get_value_type(field, value):
try:
value2 = datetime.strptime(value, '%d, %B, %Y').date()
except ValueError:
value2 = datetime.strptime(value, '%d %B, %Y').date()
try:
value2 = datetime.strptime(value, '%d %B, %Y').date()
except ValueError:
value2 = datetime.strptime(value, '%a %b %d %H:%M:%S %Y').date() # noqa
elif field2 == 'launch date':
value2 = datetime.strptime(value, '%Y%m%d').date()
elif field2 == 'launch time (ut)':
Expand Down Expand Up @@ -229,7 +232,7 @@ def write(self):

for key, value in self.metadata.items():
if key == 'SHADOZ format data created':
value2 = value.strftime('%d %B, %Y')
value2 = value.strftime('%a %b %d %H:%M:%S %Y')
elif isinstance(value, time):
value2 = value.strftime('%H:%M:%S')
elif isinstance(value, datetime) or isinstance(value, date):
Expand Down
2 changes: 1 addition & 1 deletion tests/ascen_20220105T12_SHADOZV06.dat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SHADOZ Archive Curator : Debra E Kollonige (SSAI affiliated with NASA
SHADOZ Version : 06
Reprocessed : Yes
SHADOZ format data created : Fri Sep 30 15:20:03 2022
STATION : Ascension Is., U.K.
STATION : Ascension Island
Station Principal Investigator(s) : Ryan M. Stauffer (NASA/Goddard Space Flight Center, USA)
Latitude (deg) : -7.97
Longitude (deg) : -14.40
Expand Down

0 comments on commit 34147db

Please sign in to comment.