Ejemplo n.º 1
0
def test_known_tke_2d_axis_first(uvw_and_known_tke):
    """Test array with shape (5, 3) [pretend time axis is 0]."""
    u, v, w, e_true = uvw_and_known_tke
    u = np.array([u, u, u]).transpose()
    v = np.array([v, v, v]).transpose()
    w = np.array([w, w, w]).transpose()
    e_true = e_true * np.ones(3).transpose()
    assert_array_equal(e_true, tke(u, v, w, axis=0))
    assert_array_equal(e_true, tke(u, v, w, axis=0, perturbation=True))
Ejemplo n.º 2
0
def test_known_tke_2d_axis_first(uvw_and_known_tke):
    """Test array with shape (5, 3) [pretend time axis is 0]."""
    u, v, w, e_true = uvw_and_known_tke
    u = np.array([u, u, u]).transpose()
    v = np.array([v, v, v]).transpose()
    w = np.array([w, w, w]).transpose()
    e_true = e_true * np.ones(3).transpose()
    assert_array_equal(e_true, tke(u, v, w, axis=0))
    assert_array_equal(e_true, tke(u, v, w, axis=0, perturbation=True))
Ejemplo n.º 3
0
def test_known_tke_2d_axis_last(uvw_and_known_tke):
    """Test array with shape (3, 5) [pretend time axis is -1]."""
    u, v, w, e_true = uvw_and_known_tke
    u = np.array([u, u, u])
    v = np.array([v, v, v])
    w = np.array([w, w, w])
    e_true = e_true * np.ones(3)
    assert_array_equal(e_true, tke(u, v, w, axis=-1))
Ejemplo n.º 4
0
def test_known_tke_2d_axis_last(uvw_and_known_tke):
    """Test array with shape (3, 5) [pretend time axis is -1]."""
    u, v, w, e_true = uvw_and_known_tke
    u = np.array([u, u, u])
    v = np.array([v, v, v])
    w = np.array([w, w, w])
    e_true = e_true * np.ones(3)
    assert_array_equal(e_true, tke(u, v, w, axis=-1))
Ejemplo n.º 5
0
def test_no_tke_1d():
    """Test tke calculation where the expected value is 0."""
    observations = 5
    # given all the values are the same, there should not be any tke
    u = np.ones(observations)
    v = np.ones(observations)
    w = np.ones(observations)
    e_zero = 0
    assert_array_equal(e_zero, tke(u, v, w))
Ejemplo n.º 6
0
def test_no_tke_1d():
    """Test tke calculation where the expected value is 0."""
    observations = 5
    # given all the values are the same, there should not be any tke
    u = np.ones(observations)
    v = np.ones(observations)
    w = np.ones(observations)
    e_zero = 0
    assert_array_equal(e_zero, tke(u, v, w))
Ejemplo n.º 7
0
def test_no_tke_2d_axis_first():
    """Test 0 tke calculation with 2D arrays; calculation axis is first."""
    observations = 5
    instruments = 2
    # given all the values are the same, there should not be any tke
    u = np.ones((observations, instruments))
    v = np.ones((observations, instruments))
    w = np.ones((observations, instruments))
    e_zero = np.zeros(instruments)
    assert_array_equal(e_zero, tke(u, v, w, axis=0))
Ejemplo n.º 8
0
def test_no_tke_2d_axis_first():
    """Test 0 tke calculation with 2D arrays; calculation axis is first."""
    observations = 5
    instruments = 2
    # given all the values are the same, there should not be any tke
    u = np.ones((observations, instruments))
    v = np.ones((observations, instruments))
    w = np.ones((observations, instruments))
    e_zero = np.zeros(instruments)
    assert_array_equal(e_zero, tke(u, v, w, axis=0))
Ejemplo n.º 9
0
def test_known_tke(uvw_and_known_tke):
    """Test basic behavior of tke with known values."""
    u, v, w, e_true = uvw_and_known_tke
    assert_array_equal(e_true, tke(u, v, w))
Ejemplo n.º 10
0
def test_known_tke(uvw_and_known_tke):
    """Test basic behavior of tke with known values."""
    u, v, w, e_true = uvw_and_known_tke
    assert_array_equal(e_true, tke(u, v, w))