Skip to content

Commit

Permalink
Merge pull request #113 from jklymak/fix-time-lineup
Browse files Browse the repository at this point in the history
FIX: line up missing data better - may be slow
  • Loading branch information
jklymak authored Sep 18, 2022
2 parents 476bfb6 + dbc293f commit b123ef9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyglider/slocum.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,10 @@ def binary_to_timeseries(indir, cachedir, outdir, deploymentyaml, *,
if len(time) < ds.sizes['time']:
_log.info(f'{sensorname} does not have as many entries '
'as other variables.')
# sometimes one of the sensors isn't on right away:
# sometimes one of the sensors has more or less data:
valnew = ds.time.values * np.NaN
valnew[ds.time.values >= time[0]] = val
for t, v in time, val:
valnew[ds.time.values==t] = v
val = valnew
# make the attributes:
ncvar[name].pop('coordinates', None)
Expand Down Expand Up @@ -1052,9 +1053,9 @@ def parse_logfiles(files):

for i in range(ntimes):
timestring = times[i][11:-13]
out['time'][i] = np.datetime64(
datetime.strptime(timestring, '%a %b %d %H:%M:%S %Y'))
try:
out['time'][i] = np.datetime64(
datetime.strptime(timestring, '%a %b %d %H:%M:%S %Y'))
st = amph[i].index('=')
en = amph[i][st:].index(' ') + st
out['ampH'][i] = float(amph[i][(st+1):en])
Expand Down

0 comments on commit b123ef9

Please sign in to comment.