diff --git a/pyglider/ncprocess.py b/pyglider/ncprocess.py index 1d57b67..c78e0d0 100644 --- a/pyglider/ncprocess.py +++ b/pyglider/ncprocess.py @@ -115,7 +115,7 @@ def extract_timeseries_profiles(inname, outdir, deploymentyaml): timecalendar = 'gregorian' dss.to_netcdf(outname, encoding={'time': {'units': timeunits, 'calendar': timecalendar}, - 'profile_time': + 'profile_time': {'units': timeunits}}) # add traj_strlen using bare ntcdf to make IOOS happy @@ -123,7 +123,7 @@ def extract_timeseries_profiles(inname, outdir, deploymentyaml): nc.renameDimension('string%d' % trajlen, 'traj_strlen') -def make_gridfiles(inname, outdir, deploymentyaml, dz=1): +def make_gridfiles(inname, outdir, deploymentyaml, *, fnamesuffix='', dz=1): """ Turn a timeseries netCDF file into a vertically gridded netCDF. @@ -241,7 +241,7 @@ def make_gridfiles(inname, outdir, deploymentyaml, dz=1): 'water_velocity_northward']) dsout.attrs = ds.attrs - outname = outdir + '/' + ds.attrs['deployment_name'] + '_grid.nc' + outname = outdir + '/' + ds.attrs['deployment_name'] + '_grid' + fnamesuffix + '.nc' _log.info('Writing %s', outname) timeunits = 'seconds since 1970-01-01T00:00:00Z' dsout.to_netcdf(outname, encoding={'time': {'units': timeunits}}) diff --git a/pyglider/seaexplorer.py b/pyglider/seaexplorer.py index 2c98c41..21b3918 100644 --- a/pyglider/seaexplorer.py +++ b/pyglider/seaexplorer.py @@ -288,7 +288,8 @@ def _interp_pld_to_pld(pld, ds, val, indctd): def raw_to_timeseries(indir, outdir, deploymentyaml, kind='raw', - profile_filt_time=100, profile_min_time=300): + profile_filt_time=100, profile_min_time=300, + fnamesuffix=''): """ A little different than above, for the 4-file version of the data set. """ @@ -455,7 +456,7 @@ def raw_to_timeseries(indir, outdir, deploymentyaml, kind='raw', except: pass id0 = ds.attrs['deployment_name'] - outname = outdir + id0 + '.nc' + outname = outdir + id0 + fnamesuffix + '.nc' _log.info('writing %s', outname) if 'units' in ds.time.attrs.keys(): ds.time.attrs.pop('units') diff --git a/pyglider/slocum.py b/pyglider/slocum.py index d279b43..a1e675a 100644 --- a/pyglider/slocum.py +++ b/pyglider/slocum.py @@ -789,8 +789,9 @@ def raw_to_timeseries(indir, outdir, deploymentyaml, *, def binary_to_timeseries(indir, cachedir, outdir, deploymentyaml, *, - search='*.[D|E]BD', time_base='sci_water_temp', - profile_filt_time=100, profile_min_time=300): + search='*.[D|E]BD', fnamesuffix='', + time_base='sci_water_temp', profile_filt_time=100, + profile_min_time=300): """ Convert directly from binary files to netcdf timeseries file. Requires dbdreader to be installed. @@ -934,7 +935,7 @@ def binary_to_timeseries(indir, cachedir, outdir, deploymentyaml, *, os.mkdir(outdir) except: pass - outname = (outdir + '/' + ds.attrs['deployment_name'] + '.nc') + 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'}})