def test_findoutliers(): xx = sea() dt = diff(xx[:2, 0]) dcrit = 5 * dt ddcrit = 9.81 / 2 * dt * dt zcrit = 0 [inds, indg] = findoutliers(xx[:, 1], zcrit, dcrit, ddcrit, verbose=False) assert_allclose(inds[np.r_[0, 1, 2, -3, -2, -1]], [6, 7, 8, 9509, 9510, 9511]) assert_allclose(indg[np.r_[0, 1, 2, -3, -2, -1]], [0, 1, 2, 9521, 9522, 9523])
def test_findoutliers(): xx = sea() dt = diff(xx[:2, 0]) dcrit = 5 * dt ddcrit = 9.81 / 2 * dt * dt zcrit = 0 [inds, indg] = findoutliers(xx[:, 1], zcrit, dcrit, ddcrit, verbose=False) assert_array_almost_equal(inds[np.r_[0, 1, 2, -3, -2, -1]], np.array([6, 7, 8, 9509, 9510, 9511])) assert_array_almost_equal(indg[np.r_[0, 1, 2, -3, -2, -1]], np.array([0, 1, 2, 9521, 9522, 9523]))
show() #! Finding possible spurious points #!------------------------------------ #! However, if the amount of data is too large for visual examinations one #! could use the following criteria to find possible spurious points. One #! must be careful using the criteria for extremevalue analysis, because #! it might remove extreme waves that are OK and not spurious. import wafo.misc as wm dt = ts.sampling_period() # dt = np.diff(xx[:2,0]) dcrit = 5 * dt ddcrit = 9.81 / 2 * dt * dt zcrit = 0 inds, indg = wm.findoutliers(ts.data, zcrit, dcrit, ddcrit, verbose=True) #! Section 2.2 Frequency Modeling of Load Histories #!---------------------------------------------------- #! Periodogram: Raw spectrum #! clf() Lmax = 9500 S = ts.tospecdata(L=Lmax) S.plot() axis([0, 5, 0, 0.7]) show() #! Calculate moments #!------------------- mom, text = S.moment(nr=4)