toto.core.toolbox¶
- toto.core.toolbox.dyadlength(x)[source]¶
% dyadlength – Find length and dyadic length of array % Usage % [n,J] = dyadlength(x) % Inputs % x array of length n = 2^J (hopefully) % Outputs % n length(x) % J least power of two greater than n % % Side Effects % A warning is issued if n is not a power of 2. % % See Also % quadlength, dyad, dyad2ix %
- toto.core.toolbox.lanc(numwt, haf)[source]¶
Generates a numwt + 1 + numwt lanczos cosine low pass filter with -6dB (1/4 power, 1/2 amplitude) point at haf
Function from Oceans Toolbox Parameters ———- numwt : int
number of points
- haffloat
frequency (in ‘cpi’ of -6dB point, ‘cpi’ is cycles per interval. For hourly data cpi is cph,
Examples¶
>>> from oceans.filters import lanc >>> import matplotlib.pyplot as plt >>> t = np.arange(500) # Time in hours. >>> h = 2.5 * np.sin(2 * np.pi * t / 12.42) >>> h += 1.5 * np.sin(2 * np.pi * t / 12.0) >>> h += 0.3 * np.random.randn(len(t)) >>> wt = lanc(96+1+96, 1./40) >>> low = np.convolve(wt, h, mode='same') >>> high = h - low >>> fig, (ax0, ax1) = plt.subplots(nrows=2) >>> _ = ax0.plot(high, label='high') >>> _ = ax1.plot(low, label='low') >>> _ = ax0.legend(numpoints=1) >>> _ = ax1.legend(numpoints=1)
- toto.core.toolbox.peaks(y)[source]¶
- return peaks and trough indx
from Nagi Hatoum peaks.m
copyright 2005
- toto.core.toolbox.qkhfs(w, h)[source]¶
Quick iterative calculation of kh in gravity-wave dispersion relationship kh = qkhfs(w, h )
- Input
w - angular wave frequency = 2*pi/T where T = wave period [1/s] h - water depth [m]
- Returns
kh - wavenumber * depth [ ]
Orbital velocities from kh are accurate to 3e-12 ! RL Soulsby (2006) “Simplified calculation of wave orbital velocities” HR Wallingford Report TR 155, February 2006 Eqns. 12a - 14 from https://github.com/csherwood-usgs/crspy/blob/master/crspy.py