本文整理汇总了Python中iris.analysis.RMS.aggregate方法的典型用法代码示例。如果您正苦于以下问题:Python RMS.aggregate方法的具体用法?Python RMS.aggregate怎么用?Python RMS.aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris.analysis.RMS
的用法示例。
在下文中一共展示了RMS.aggregate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_unit_weighted
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_unit_weighted(self):
# unit weights should be the same as no weights
data = np.array([5, 2, 6, 4], dtype=np.float64)
weights = np.ones_like(data)
rms = RMS.aggregate(data, 0, weights=weights)
expected_rms = 4.5
self.assertAlmostEqual(rms, expected_rms)
示例2: test_2d_weighted
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_2d_weighted(self):
# 2-dimensional input with weights
data = np.array([[4, 7, 10, 8], [14, 16, 20, 8]], dtype=np.float64)
weights = np.array([[1, 4, 3, 2], [2, 1, 1.5, 0.5]], dtype=np.float64)
expected_rms = np.array([8.0, 16.0], dtype=np.float64)
rms = RMS.aggregate(data, 1, weights=weights)
self.assertArrayAlmostEqual(rms, expected_rms)
示例3: test_1d_weighted
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_1d_weighted(self):
# 1-dimensional input with weights
data = np.array([4, 7, 10, 8], dtype=np.float64)
weights = np.array([1, 4, 3, 2], dtype=np.float64)
expected_rms = 8.0
rms = RMS.aggregate(data, 0, weights=weights)
self.assertAlmostEqual(rms, expected_rms)
示例4: test_masked_weighted
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_masked_weighted(self):
# weights should work properly with masked arrays
data = ma.array([4, 7, 18, 10, 11, 8], mask=[False, False, True, False, True, False], dtype=np.float64)
weights = np.array([1, 4, 5, 3, 8, 2], dtype=np.float64)
expected_rms = 8.0
rms = RMS.aggregate(data, 0, weights=weights)
self.assertAlmostEqual(rms, expected_rms)
示例5: test_masked
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_masked(self):
# masked entries should be completely ignored
data = ma.array([5, 10, 2, 11, 6, 4],
mask=[False, True, False, True, False, False],
dtype=np.float64)
expected_rms = 4.5
rms = RMS.aggregate(data, 0)
self.assertAlmostEqual(rms, expected_rms)
示例6: test_2d
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_2d(self):
# 2-dimensional input
data = np.array([[5, 2, 6, 4], [12, 4, 10, 8]], dtype=np.float64)
expected_rms = np.array([4.5, 9.0], dtype=np.float64)
rms = RMS.aggregate(data, 1)
self.assertArrayAlmostEqual(rms, expected_rms)
示例7: test_1d
# 需要导入模块: from iris.analysis import RMS [as 别名]
# 或者: from iris.analysis.RMS import aggregate [as 别名]
def test_1d(self):
# 1-dimensional input
data = np.array([5, 2, 6, 4], dtype=np.float64)
rms = RMS.aggregate(data, 0)
expected_rms = 4.5
self.assertAlmostEqual(rms, expected_rms)