Skip to content

Commit

Permalink
Merge pull request #103 from hvdosser/updatefix
Browse files Browse the repository at this point in the history
Update header check in Slocup.py to work with the new gliders
  • Loading branch information
hvdosser authored Jun 30, 2022
2 parents f08156b + 7ef2954 commit 0234c37
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pyglider/slocum.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ def binary_to_rawnc(indir, outdir, cacdir,
def _check_diag_header(diag_tuple):
# diagnostic values should be
# ['s', 'a', 4660, 123.45600128173828, 123456789.12345] # 4660 is 0x1234
# for new Slocum G3s (as of 2022), diagnostic values should be
# ['s', 'a', 13330, 1.5184998373247989e+35, -6.257491929421848e-90]
ref_tuple = ['s', 'a', 4660, 123.456, 123456789.12345]
ref_tuple_new = ['s', 'a', 13330, 1.5185e+35, -6.2575e-90]
for i in range(3):
if ref_tuple[i] != diag_tuple[i]:
if (ref_tuple[i] != diag_tuple[i]) and (ref_tuple_new[i] != diag_tuple[i]):
_log.warning('character or int failure: %s', diag_tuple)
return False
if ((abs(ref_tuple[3] - diag_tuple[3]) > .0001) or
(abs(ref_tuple[4] - diag_tuple[4]) > .0001)):
if (((abs(ref_tuple[3] - diag_tuple[3]) > .0001) or
(abs(ref_tuple[4] - diag_tuple[4]) > .0001)) and
((abs(ref_tuple_new[3] - diag_tuple[3]) > 0.0001) or
(abs(ref_tuple_new[4] - diag_tuple[4]) > 0.0001))):
_log.warning('floating point failure')
return False
return True
Expand Down Expand Up @@ -911,4 +916,4 @@ def parse_logfiles(files):


__all__ = ['binary_to_rawnc', 'merge_rawnc', 'raw_to_timeseries',
'parse_glider_state', 'parse_logfiles']
'parse_glider_state', 'parse_logfiles']

0 comments on commit 0234c37

Please sign in to comment.