Skip to content

Commit

Permalink
Merge pull request #180 from voto-ocean-knowledge/dev
Browse files Browse the repository at this point in the history
FIX: standarise time encoding to float seconds since 1970
  • Loading branch information
jklymak authored Jul 26, 2024
2 parents 9f92866 + 82f0550 commit 70746b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pyglider/ncprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ def make_gridfiles(inname, outdir, deploymentyaml, *, fnamesuffix='', dz=1, star

outname = outdir + '/' + ds.attrs['deployment_name'] + '_grid' + fnamesuffix + '.nc'
_log.info('Writing %s', outname)
# timeunits = 'nanoseconds since 1970-01-01T00:00:00Z'
dsout.to_netcdf(outname)
dsout.to_netcdf(outname,
encoding={'time': {'units': 'seconds since 1970-01-01T00:00:00Z',
'dtype': 'float64'}})
_log.info('Done gridding')

return outname
Expand Down
3 changes: 2 additions & 1 deletion pyglider/seaexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ def raw_to_timeseries(indir, outdir, deploymentyaml, kind='raw',
if 'units' in ds.ad2cp_time.attrs.keys():
ds.ad2cp_time.attrs.pop('units')
ds.to_netcdf(outname, 'w',
encoding={'time': {'units': 'milliseconds since 1970-01-01T00:00:00Z'}})
encoding={'time': {'units': 'seconds since 1970-01-01T00:00:00Z',
'dtype': 'float64'}})
return outname


Expand Down

0 comments on commit 70746b5

Please sign in to comment.