本文整理汇总了Python中gnome.spill_container.SpillContainer.get_spill_mask方法的典型用法代码示例。如果您正苦于以下问题:Python SpillContainer.get_spill_mask方法的具体用法?Python SpillContainer.get_spill_mask怎么用?Python SpillContainer.get_spill_mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.spill_container.SpillContainer
的用法示例。
在下文中一共展示了SpillContainer.get_spill_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_spill_mask
# 需要导入模块: from gnome.spill_container import SpillContainer [as 别名]
# 或者: from gnome.spill_container.SpillContainer import get_spill_mask [as 别名]
def test_get_spill_mask():
"""
Simple tests for get_spill_mask
"""
start_time0 = datetime(2012, 1, 1, 12)
start_time1 = datetime(2012, 1, 2, 12)
start_time2 = start_time1 + timedelta(hours=1)
start_position = (23.0, -78.5, 0.0)
num_elements = 5
sc = SpillContainer()
sp0 = PointLineSource(num_elements, start_position,
start_time0)
sp1 = PointLineSource(num_elements, start_position,
start_time1,
end_position=(start_position[0]
+ 0.2, start_position[1] + 0.2,
0.0), end_release_time=start_time1
+ timedelta(hours=3))
sp2 = PointLineSource(num_elements, start_position,
start_time2)
sc.spills += [sp0, sp1, sp2]
# as we move forward in time, the spills will release LEs in an
# expected way
sc.prepare_for_model_run(windage_at)
sc.release_elements(100, start_time0)
sc.release_elements(100, start_time0 + timedelta(hours=24))
sc.release_elements(100, start_time1 + timedelta(hours=1))
sc.release_elements(100, start_time1 + timedelta(hours=3))
assert all(sc['spill_num'][sc.get_spill_mask(sp2)] == 2)
assert all(sc['spill_num'][sc.get_spill_mask(sp0)] == 0)
assert all(sc['spill_num'][sc.get_spill_mask(sp1)] == 1)