本文整理汇总了Python中metpy.testing.assert_array_equal函数的典型用法代码示例。如果您正苦于以下问题:Python assert_array_equal函数的具体用法?Python assert_array_equal怎么用?Python assert_array_equal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_array_equal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_convergence
def test_convergence():
"""Test convergence for simple case."""
a = np.arange(3)
u = np.c_[a, a, a] * units('m/s')
c = h_convergence(u, u, 1 * units.meter, 1 * units.meter)
true_c = np.ones_like(u) / units.sec
assert_array_equal(c, true_c)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例2: test_basic2
def test_basic2(self):
'Basic test of advection'
u = np.ones((3,)) * units('m/s')
s = np.array([1, 2, 3]) * units('kg')
a = advection(s, u, (1 * units.meter,))
truth = -np.ones_like(u) * units('kg/sec')
assert_array_equal(a, truth)
开发者ID:DBaryudin,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例3: test_resample_nn
def test_resample_nn():
"""Test 1d nearest neighbor functionality."""
a = np.arange(5.)
b = np.array([2, 3.8])
truth = np.array([2, 4])
assert_array_equal(truth, resample_nn_1d(a, b))
开发者ID:dopplershift,项目名称:MetPy,代码行数:7,代码来源:test_calc_tools.py
示例4: test_advection_uniform
def test_advection_uniform():
"""Test advection calculation for a uniform 1D field."""
u = np.ones((3,)) * units('m/s')
s = np.ones_like(u) * units.kelvin
a = advection(s, u, (1 * units.meter,))
truth = np.zeros_like(u) * units('K/sec')
assert_array_equal(a, truth)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例5: test_advection_1d_uniform_wind
def test_advection_1d_uniform_wind():
"""Test advection for simple 1D case with uniform wind."""
u = np.ones((3,)) * units('m/s')
s = np.array([1, 2, 3]) * units('kg')
a = advection(s, u, (1 * units.meter,))
truth = -np.ones_like(u) * units('kg/sec')
assert_array_equal(a, truth)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例6: test_advection_2d_uniform
def test_advection_2d_uniform():
"""Test advection for uniform 2D field."""
u = np.ones((3, 3)) * units('m/s')
s = np.ones_like(u) * units.kelvin
a = advection(s, [u, u], (1 * units.meter, 1 * units.meter))
truth = np.zeros_like(u) * units('K/sec')
assert_array_equal(a, truth)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例7: test_basic3
def test_basic3(self):
'Basic test of vorticity and divergence calculation'
a = np.arange(3)
u = np.c_[a, a, a] * units('m/s')
c = h_convergence(u, u, 1 * units.meter, 1 * units.meter)
true_c = np.ones_like(u) / units.sec
assert_array_equal(c, true_c)
开发者ID:DBaryudin,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例8: test_advection_1d
def test_advection_1d():
"""Test advection calculation with varying wind and field."""
u = np.array([1, 2, 3]) * units('m/s')
s = np.array([1, 2, 3]) * units('Pa')
a = advection(s, u, (1 * units.meter,))
truth = np.array([-1, -2, -3]) * units('Pa/sec')
assert_array_equal(a, truth)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例9: test_basic
def test_basic(self):
'Basic braindead test of advection'
u = np.ones((3,)) * units('m/s')
s = np.ones_like(u) * units.kelvin
a = advection(s, u, (1 * units.meter,))
truth = np.zeros_like(u) * units('K/sec')
assert_array_equal(a, truth)
开发者ID:DBaryudin,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例10: test_precipitable_water
def test_precipitable_water():
"""Test precipitable water with observed sounding."""
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC')
pw = precipitable_water(data['dewpoint'], data['pressure'],
top=400 * units.hPa)
truth = (0.8899441949243486 * units('inches')).to('millimeters')
assert_array_equal(pw, truth)
开发者ID:dodolooking,项目名称:MetPy,代码行数:7,代码来源:test_indices.py
示例11: test_zero_gradient
def test_zero_gradient():
"""Test convergence_vorticity when there is no gradient in the field."""
u = np.ones((3, 3)) * units('m/s')
c, v = convergence_vorticity(u, u, 1 * units.meter, 1 * units.meter)
truth = np.zeros_like(u) / units.sec
assert_array_equal(c, truth)
assert_array_equal(v, truth)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例12: test_zero_convergence
def test_zero_convergence():
"""Test convergence calculation when zeros should be returned."""
a = np.arange(3)
u = np.c_[a, a, a] * units('m/s')
c = h_convergence(u, u.T, 1 * units.meter, 1 * units.meter)
true_c = 2. * np.ones_like(u) / units.sec
assert_array_equal(c, true_c)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例13: test_vorticity
def test_vorticity():
"""Test vorticity for simple case."""
a = np.arange(3)
u = np.c_[a, a, a] * units('m/s')
v = v_vorticity(u, u, 1 * units.meter, 1 * units.meter)
true_v = np.ones_like(u) / units.sec
assert_array_equal(v, true_v)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例14: test_zero_vorticity
def test_zero_vorticity():
"""Test vorticity calculation when zeros should be returned."""
a = np.arange(3)
u = np.c_[a, a, a] * units('m/s')
v = v_vorticity(u, u.T, 1 * units.meter, 1 * units.meter)
true_v = np.zeros_like(u) / units.sec
assert_array_equal(v, true_v)
开发者ID:ahill818,项目名称:MetPy,代码行数:7,代码来源:test_kinematics.py
示例15: test_less_or_close
def test_less_or_close():
"""Test floating point less or close to."""
x = np.array([0.0, 1.0, 1.49999, 1.5, 1.5000, 1.7])
comparison_value = 1.5
truth = np.array([True, True, True, True, True, False])
res = _less_or_close(x, comparison_value)
assert_array_equal(res, truth)
开发者ID:dopplershift,项目名称:MetPy,代码行数:7,代码来源:test_calc_tools.py
示例16: test_geopotential
def test_geopotential(self):
'Test of geostrophic wind calculation with geopotential'
z = np.array([[48, 49, 48], [49, 50, 49], [48, 49, 48]]) * 100. * units('m^2/s^2')
ug, vg = geostrophic_wind(z, 1 / units.sec, 100. * units.meter, 100. * units.meter)
true_u = np.array([[-1, 0, 1]] * 3) * units('m/s')
true_v = -true_u.T
assert_array_equal(ug, true_u)
assert_array_equal(vg, true_v)
开发者ID:DBaryudin,项目名称:MetPy,代码行数:8,代码来源:test_kinematics.py
示例17: test_2dbasic2
def test_2dbasic2(self):
'Basic 2D test of advection'
u = np.ones((3, 3)) * units('m/s')
v = 2 * np.ones((3, 3)) * units('m/s')
s = np.array([[1, 2, 1], [2, 4, 2], [1, 2, 1]]) * units.kelvin
a = advection(s, [u, v], (1 * units.meter, 1 * units.meter))
truth = np.array([[-3, -2, 1], [-4, 0, 4], [-1, 2, 3]]) * units('K/sec')
assert_array_equal(a, truth)
开发者ID:DBaryudin,项目名称:MetPy,代码行数:8,代码来源:test_kinematics.py
示例18: test_supercell_composite
def test_supercell_composite():
"""Test supercell composite function."""
mucape = [2000., 1000., 500., 2000.] * units('J/kg')
esrh = [400., 150., 45., 45.] * units('m^2/s^2')
ebwd = [30., 15., 5., 5.] * units('m/s')
truth = [16., 2.25, 0., 0.]
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_array_equal(supercell_comp, truth)
开发者ID:dodolooking,项目名称:MetPy,代码行数:8,代码来源:test_indices.py
示例19: test_delete_masked_points
def test_delete_masked_points():
"""Test deleting masked points."""
a = ma.masked_array(np.arange(5), mask=[False, True, False, False, False])
b = ma.masked_array(np.arange(5), mask=[False, False, False, True, False])
expected = np.array([0, 2, 4])
a, b = _delete_masked_points(a, b)
assert_array_equal(a, expected)
assert_array_equal(b, expected)
开发者ID:dopplershift,项目名称:MetPy,代码行数:8,代码来源:test_calc_tools.py
示例20: test_heat_index_invalid
def test_heat_index_invalid():
"""Test heat index for values that should be masked."""
temp = np.array([80, 88, 92, 79, 30, 81]) * units.degF
rh = np.array([40, 39, 2, 70, 50, 39]) * units.percent
hi = heat_index(temp, rh)
mask = np.array([False, True, True, True, True, True])
assert_array_equal(hi.mask, mask)
开发者ID:akrherz,项目名称:MetPy,代码行数:8,代码来源:test_basic.py
注:本文中的metpy.testing.assert_array_equal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论