Skip to content

Commit

Permalink
Use better data for test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcvey3 committed Dec 29, 2023
1 parent 47298bb commit 16b4b37
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 0 additions & 3 deletions dolfyn/tests/data/Sig1000_IMU_bin.nc

This file was deleted.

3 changes: 3 additions & 0 deletions dolfyn/tests/data/Sig1000_tidal_bin.nc
Git LFS file not shown
11 changes: 8 additions & 3 deletions dolfyn/tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,18 @@ def test_adv_turbulence(make_data=False):


def test_adcp_turbulence(make_data=False):
dat = tr.dat_sig_i.copy(deep=True)
dat = tr.dat_sig_tide.copy(deep=True)
dat.velds.rotate2('earth')
dat.attrs['principal_heading'] = apm.calc_principal_heading(dat.vel.mean('range'))
bnr = apm.ADPBinner(n_bin=20.0, fs=dat.fs, diff_style='centered')
tdat = bnr.do_avg(dat)

tdat['dudz'] = bnr.calc_dudz(tdat.vel)
tdat['dvdz'] = bnr.calc_dvdz(tdat.vel)
tdat['dwdz'] = bnr.calc_dwdz(tdat.vel)
tdat['tau2'] = bnr.calc_shear2(tdat.vel)
tdat['I'] = tdat.velds.I
tdat['ti'] = bnr.calc_ti(dat.velds.U_mag, detrend=False)
tdat['psd'] = bnr.calc_psd(dat['vel'].isel(
dir=2, range=len(dat.range)//2), freq_units='Hz')
tdat['noise'] = bnr.calc_doppler_noise(tdat['psd'], pct_fN=0.8)
Expand All @@ -160,8 +165,8 @@ def test_adcp_turbulence(make_data=False):
tdat['psd'].mean('time'), freq_range=[0.4, 4])

if make_data:
save(tdat, 'Sig1000_IMU_bin.nc')
save(tdat, 'Sig1000_tidal_bin.nc')
return

assert np.round(slope_check[0].values, 4), -1.0682
assert_allclose(tdat, load('Sig1000_IMU_bin.nc'), atol=1e-6)
assert_allclose(tdat, load('Sig1000_tidal_bin.nc'), atol=1e-6)
1 change: 0 additions & 1 deletion dolfyn/velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,6 @@ def calc_ti(self, U_mag, noise=0, thresh=0, detrend=False):
attrs={'units': '% [0,1]',
'long_name': 'Turbulence Intensity'})


def calc_tke(self, veldat, noise=None, detrend=True):
"""Calculate the turbulent kinetic energy (TKE) (variances
of u,v,w).
Expand Down

0 comments on commit 16b4b37

Please sign in to comment.