本文整理汇总了Python中gnome.movers.WindMover.active_start方法的典型用法代码示例。如果您正苦于以下问题:Python WindMover.active_start方法的具体用法?Python WindMover.active_start怎么用?Python WindMover.active_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.movers.WindMover
的用法示例。
在下文中一共展示了WindMover.active_start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_timespan
# 需要导入模块: from gnome.movers import WindMover [as 别名]
# 或者: from gnome.movers.WindMover import active_start [as 别名]
def test_timespan():
"""
Ensure the active flag is being set correctly and checked,
such that if active=False, the delta produced by get_move = 0
"""
time_step = 15 * 60 # seconds
start_pos = (3., 6., 0.)
rel_time = datetime(2012, 8, 20, 13) # yyyy/month/day/hr/min/sec
sc = sample_sc_release(5, start_pos, rel_time)
# value is given as (r,theta)
model_time = rel_time
time_val = np.zeros((1, ), dtype=datetime_value_2d)
time_val['time'] = rel_time
time_val['value'] = (2., 25.)
wm = WindMover(Wind(timeseries=time_val, units='meter per second'),
active_start=model_time + timedelta(seconds=time_step))
wm.prepare_for_model_run()
wm.prepare_for_model_step(sc, time_step, model_time)
delta = wm.get_move(sc, time_step, model_time)
wm.model_step_is_done()
assert wm.active == False
assert np.all(delta == 0) # model_time + time_step = active_start
wm.active_start = model_time - timedelta(seconds=time_step / 2)
wm.prepare_for_model_step(sc, time_step, model_time)
delta = wm.get_move(sc, time_step, model_time)
wm.model_step_is_done()
assert wm.active == True
print '''\ntest_timespan delta \n{0}'''.format(delta)
assert np.all(delta[:, :2] != 0) # model_time + time_step > active_start