Skip to content

Commit

Permalink
Merge pull request #115 from jklymak/use-xarray-re-index
Browse files Browse the repository at this point in the history
ENH: use reindex_like to line up times
  • Loading branch information
jklymak authored Sep 20, 2022
2 parents 824c0cb + 019e425 commit 48ae4d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyglider/slocum.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,10 +881,10 @@ def binary_to_timeseries(indir, cachedir, outdir, deploymentyaml, *,
_log.info(f'{sensorname} does not have as many entries '
'as other variables.')
# sometimes one of the sensors has more or less data:
valnew = ds.time.values * np.NaN
for t, v in zip(time, val):
valnew[ds.time.values==t] = v
val = valnew
dsfix = xr.DataArray(val, dims='time',
coords={'time': time})
val = dsfix.reindex_like(ds).values

# make the attributes:
ncvar[name].pop('coordinates', None)
attrs = ncvar[name]
Expand Down

0 comments on commit 48ae4d5

Please sign in to comment.