本文整理汇总了Python中openquake.hazardlib.site.SiteCollection.expand方法的典型用法代码示例。如果您正苦于以下问题:Python SiteCollection.expand方法的具体用法?Python SiteCollection.expand怎么用?Python SiteCollection.expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openquake.hazardlib.site.SiteCollection
的用法示例。
在下文中一共展示了SiteCollection.expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_expand_1d
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import expand [as 别名]
def test_expand_1d(self):
col = SiteCollection(self.SITES)
col = col.filter(numpy.array([1, 0, 1, 1]))
data_condensed = numpy.array([5, 6, 7])
data_expanded = col.expand(data_condensed, placeholder=100)
data_expanded_expected = numpy.array([5, 100, 6, 7])
numpy.testing.assert_array_equal(data_expanded, data_expanded_expected)
示例2: test_expand_no_filtering
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import expand [as 别名]
def test_expand_no_filtering(self):
col = SiteCollection(self.SITES)
data_condensed = numpy.array([3, 2, 1, 0])
data_expanded = col.expand(data_condensed, total_sites=4,
placeholder=100)
data_expanded_expected = data_condensed
numpy.testing.assert_array_equal(data_expanded, data_expanded_expected)
示例3: test_expand_2d
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import expand [as 别名]
def test_expand_2d(self):
col = SiteCollection(self.SITES).filter(numpy.array([False, True, False, True]))
data_condensed = numpy.array([
[1, 2, 3],
[5, 6, 7],
])
data_expanded = col.expand(data_condensed, placeholder=-1)
data_expanded_expected = numpy.array([
[-1, -1, -1],
[1, 2, 3],
[-1, -1, -1],
[5, 6, 7],
])
numpy.testing.assert_array_equal(data_expanded, data_expanded_expected)
示例4: test_expand_2d
# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import expand [as 别名]
def test_expand_2d(self):
col = SiteCollection(self.SITES)
col.indices = numpy.array([1, 3, 5, 6])
data_condensed = numpy.array([
[1, 2, 3],
[5, 6, 7],
[10, 11, 12],
[15, 16, 17]
])
data_expanded = col.expand(data_condensed, total_sites=8,
placeholder=-1)
data_expanded_expected = numpy.array([
[-1, -1, -1],
[1, 2, 3],
[-1, -1, -1],
[5, 6, 7],
[-1, -1, -1],
[10, 11, 12],
[15, 16, 17],
[-1, -1, -1]
])
numpy.testing.assert_array_equal(data_expanded, data_expanded_expected)