本文整理汇总了Python中gnome.model.Model.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Model.reset方法的具体用法?Python Model.reset怎么用?Python Model.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.model.Model
的用法示例。
在下文中一共展示了Model.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple_run_with_map
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import reset [as 别名]
def test_simple_run_with_map():
'''
pretty much all this tests is that the model will run
'''
start_time = datetime(2012, 9, 15, 12, 0)
model = Model()
model.map = gnome.map.MapFromBNA(testmap, refloat_halflife=6) # hours
a_mover = SimpleMover(velocity=(1., 2., 0.))
model.movers += a_mover
assert len(model.movers) == 1
spill = point_line_release_spill(num_elements=10,
start_position=(0., 0., 0.),
release_time=start_time)
model.spills += spill
assert len(model.spills) == 1
model.start_time = spill.release.release_time
# test iterator
for step in model:
print 'just ran time step: %s' % step
assert step['step_num'] == model.current_time_step
# reset and run again
model.reset()
# test iterator is repeatable
for step in model:
print 'just ran time step: %s' % step
assert step['step_num'] == model.current_time_step
示例2: test_simple_run_with_map
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import reset [as 别名]
def test_simple_run_with_map():
"""
pretty much all this tests is that the model will run
"""
start_time = datetime(2012, 9, 15, 12, 0)
model = Model()
model.map = gnome.map.MapFromBNA(testmap, refloat_halflife=6) # hours
a_mover = SimpleMover(velocity=(1., 2., 0.))
model.movers += a_mover
assert len(model.movers) == 1
spill = PointLineSource(num_elements=10,
start_position=(0., 0., 0.), release_time=start_time)
model.spills += spill
# model.add_spill(spill)
assert len(model.spills) == 1
model.start_time = spill.release_time
# test iterator:
for step in model:
print 'just ran time step: %s' % step
# reset and run again:
model.reset()
# test iterator:
for step in model:
print 'just ran time step: %s' % step
assert True