Skip to content

Commit

Permalink
ENH: make time Fill Value show up in NetCDF via encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
jklymak committed Apr 26, 2024
1 parent 812e746 commit 88e673c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pyglider/ncprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ def extract_timeseries_profiles(inname, outdir, deploymentyaml):
dss.to_netcdf(outname, encoding={'time': {'units': timeunits,
'calendar': timecalendar},
'profile_time':
{'units': timeunits}})
{'units': timeunits,
'_FillValue': -99999}}
)

# add traj_strlen using bare ntcdf to make IOOS happy
with netCDF4.Dataset(outname, 'r+') as nc:
Expand Down
2 changes: 1 addition & 1 deletion pyglider/slocum.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ def binary_to_timeseries(indir, cachedir, outdir, deploymentyaml, *,
outname = (outdir + '/' + ds.attrs['deployment_name'] + fnamesuffix + '.nc')
_log.info('writing %s', outname)
ds.to_netcdf(outname, 'w',
encoding={'time': {'units': 'seconds since 1970-01-01T00:00:00Z'}})
encoding={'time': {'units': 'seconds since 1970-01-01T00:00:00Z', '_FillValue': -999999}})

return outname

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
rawdir, l1tsdir, deploymentyaml,
profile_filt_time=100, profile_min_time=300)

if False:
if True:
# make profile netcdf files for ioos gdac...
ncprocess.extract_timeseries_profiles(outname, profiledir, deploymentyaml)

Expand Down

0 comments on commit 88e673c

Please sign in to comment.