本文整理汇总了Python中gnome.spill_container.SpillContainer.model_step_is_done方法的典型用法代码示例。如果您正苦于以下问题:Python SpillContainer.model_step_is_done方法的具体用法?Python SpillContainer.model_step_is_done怎么用?Python SpillContainer.model_step_is_done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.spill_container.SpillContainer
的用法示例。
在下文中一共展示了SpillContainer.model_step_is_done方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_model_step_is_done
# 需要导入模块: from gnome.spill_container import SpillContainer [as 别名]
# 或者: from gnome.spill_container.SpillContainer import model_step_is_done [as 别名]
def test_model_step_is_done():
"""
tests that correct elements are released when their status_codes is toggled
to basic_types.oil_status.to_be_removed
"""
release_time = datetime(2012, 1, 1, 12)
start_time2 = datetime(2012, 1, 2, 12)
start_position = (23.0, -78.5, 0.0)
num_elements = 10
sc = SpillContainer()
spill = PointLineSource(num_elements, start_position,
release_time)
sp2 = PointLineSource(num_elements, start_position,
start_time2)
sc.spills += [spill, sp2]
sc.prepare_for_model_run(windage_at)
sc.release_elements(100, release_time)
sc.release_elements(100, start_time2)
(sc['status_codes'])[5:8] = oil_status.to_be_removed
(sc['status_codes'])[14:17] = oil_status.to_be_removed
sc['status_codes'][19] = oil_status.to_be_removed
# also make corresponding positions 0 as a way to test
sc['positions'][5:8, :] = (0, 0, 0)
sc['positions'][14:17, :] = (0, 0, 0)
sc['positions'][19, :] = (0, 0, 0)
sc.model_step_is_done()
assert sc.num_released == 2 * num_elements - 7
assert np.all(sc['status_codes'] != oil_status.to_be_removed)
assert np.all(sc['positions'] == start_position)
assert np.count_nonzero(sc['spill_num'] == 0) == num_elements - 3
assert np.count_nonzero(sc['spill_num'] == 1) == num_elements - 4