def test_find_append_zero_crossings(): """Tests finding and appending zero crossings of an x, y series.""" x = np.arange(11) * units.hPa y = np.array([3, 2, 1, -1, 2, 2, 0, 1, 0, -1, 2]) * units.degC x2, y2 = _find_append_zero_crossings(x, y) x_truth = np.array([0., 1., 2., 2.5, 3., 3.33333333, 4., 5., 6., 7., 8., 9., 9.33333333, 10.]) * units.hPa y_truth = np.array([3, 2, 1, 0, -1, 0, 2, 2, 0, 1, 0, -1, 0, 2]) * units.degC assert_array_almost_equal(x2, x_truth, 6) assert_almost_equal(y2, y_truth, 6)
def test_find_append_zero_crossings(): """Test finding and appending zero crossings of an x, y series.""" x = np.arange(11) * units.hPa y = np.array([3, 2, 1, -1, 2, 2, 0, 1, 0, -1, 2]) * units.degC x2, y2 = _find_append_zero_crossings(x, y) x_truth = np.array([0., 1., 2., 2.5, 3., 3.33333333, 4., 5., 6., 7., 8., 9., 9.33333333, 10.]) * units.hPa y_truth = np.array([3, 2, 1, 0, -1, 0, 2, 2, 0, 1, 0, -1, 0, 2]) * units.degC assert_array_almost_equal(x2, x_truth, 6) assert_almost_equal(y2, y_truth, 6)