当前位置: 首页>>代码示例>>Python>>正文


Python analysis.RMS类代码示例

本文整理汇总了Python中iris.analysis.RMS的典型用法代码示例。如果您正苦于以下问题:Python RMS类的具体用法?Python RMS怎么用?Python RMS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RMS类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_2d_weighted

 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)
开发者ID:niallrobinson,项目名称:iris,代码行数:7,代码来源:test_RMS.py

示例2: test_unit_weighted

 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)
开发者ID:niallrobinson,项目名称:iris,代码行数:7,代码来源:test_RMS.py

示例3: test_masked_weighted

 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)
开发者ID:scollis,项目名称:iris,代码行数:7,代码来源:test_RMS.py

示例4: test_1d_weighted

 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)
开发者ID:niallrobinson,项目名称:iris,代码行数:7,代码来源:test_RMS.py

示例5: test_1d

 def test_1d(self):
     # 1-dimensional input.
     data = as_lazy_data(np.array([5, 2, 6, 4], dtype=np.float64),
                         chunks=-1)
     rms = RMS.lazy_aggregate(data, 0)
     expected_rms = 4.5
     self.assertAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:7,代码来源:test_RMS.py

示例6: test_masked

 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)
开发者ID:niallrobinson,项目名称:iris,代码行数:8,代码来源:test_RMS.py

示例7: test_2d

 def test_2d(self):
     # 2-dimensional input.
     data = as_lazy_data(np.array([[5, 2, 6, 4], [12, 4, 10, 8]],
                                  dtype=np.float64),
                         chunks=-1)
     expected_rms = np.array([4.5, 9.0], dtype=np.float64)
     rms = RMS.lazy_aggregate(data, 1)
     self.assertArrayAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:8,代码来源:test_RMS.py

示例8: test_masked

 def test_masked(self):
     # Masked entries should be completely ignored.
     data = as_lazy_data(ma.array([5, 10, 2, 11, 6, 4],
                         mask=[False, True, False, True, False, False],
                         dtype=np.float64),
                         chunks=-1)
     expected_rms = 4.5
     rms = RMS.lazy_aggregate(data, 0)
     self.assertAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:9,代码来源:test_RMS.py

示例9: test_unit_weighted

 def test_unit_weighted(self):
     # Unit weights should be the same as no weights.
     data = as_lazy_data(np.array([5, 2, 6, 4], dtype=np.float64),
                         chunks=-1)
     weights = np.ones_like(data)
     expected_rms = 4.5
     # https://github.com/dask/dask/issues/3846.
     with self.assertRaisesRegexp(TypeError, 'unexpected keyword argument'):
         rms = RMS.lazy_aggregate(data, 0, weights=weights)
         self.assertAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:10,代码来源:test_RMS.py

示例10: test_1d_weighted

 def test_1d_weighted(self):
     # 1-dimensional input with weights.
     data = as_lazy_data(np.array([4, 7, 10, 8], dtype=np.float64),
                         chunks=-1)
     weights = np.array([1, 4, 3, 2], dtype=np.float64)
     expected_rms = 8.0
     # https://github.com/dask/dask/issues/3846.
     with self.assertRaisesRegexp(TypeError, 'unexpected keyword argument'):
         rms = RMS.lazy_aggregate(data, 0, weights=weights)
         self.assertAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:10,代码来源:test_RMS.py

示例11: test_masked_weighted

 def test_masked_weighted(self):
     # Weights should work properly with masked arrays, but currently don't
     # (see https://github.com/dask/dask/issues/3846).
     # For now, masked weights are simply not supported.
     data = as_lazy_data(ma.array([4, 7, 18, 10, 11, 8],
                         mask=[False, False, True, False, True, False],
                         dtype=np.float64),
                         chunks=-1)
     weights = np.array([1, 4, 5, 3, 8, 2])
     expected_rms = 8.0
     with self.assertRaisesRegexp(TypeError, 'unexpected keyword argument'):
         rms = RMS.lazy_aggregate(data, 0, weights=weights)
         self.assertAlmostEqual(rms, expected_rms)
开发者ID:SciTools,项目名称:iris,代码行数:13,代码来源:test_RMS.py

示例12: test_1d

 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)
开发者ID:niallrobinson,项目名称:iris,代码行数:6,代码来源:test_RMS.py

示例13: test

 def test(self):
     shape = ()
     kwargs = dict()
     self.assertTupleEqual(RMS.aggregate_shape(**kwargs), shape)
     kwargs = dict(tom='jerry', calvin='hobbes')
     self.assertTupleEqual(RMS.aggregate_shape(**kwargs), shape)
开发者ID:MahatmaCane,项目名称:iris,代码行数:6,代码来源:test_RMS.py


注:本文中的iris.analysis.RMS类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。