本文整理汇总了Python中gnome.model.Model.cache_enabled方法的典型用法代码示例。如果您正苦于以下问题:Python Model.cache_enabled方法的具体用法?Python Model.cache_enabled怎么用?Python Model.cache_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.model.Model
的用法示例。
在下文中一共展示了Model.cache_enabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ice_image_mid_run
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import cache_enabled [as 别名]
def test_ice_image_mid_run():
"""
Test image outputter with a model
NOTE: could it be tested with just a mover, and not a full model?
-- that gets tricky with the cache and timesteps...
"""
start_time = datetime(2015, 5, 14, 0)
model = Model(time_step=3600 * 24, start_time=start_time, duration=timedelta(days=3)) # one day
model.cache_enabled = False
model.uncertain = False
c_ice_mover = IceMover(curr_file, topology_file)
model.movers += c_ice_mover
# run the model a couple steps
step = model.step()
step = model.step()
# now add the outputter
model.outputters += IceImageOutput(c_ice_mover, viewport=((-175.0, 65.0), (-145.0, 75.05)))
# and run some more:
step = model.step()
step = model.step()
# and check the output
ice_output = step["IceImageOutput"]
for key in ("time_stamp", "thickness_image", "concentration_image", "bounding_box", "projection"):
assert key in ice_output
print "thickness img size:", len(ice_output["thickness_image"])
print "concentration img size:", len(ice_output["concentration_image"])
示例2: make_model
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import cache_enabled [as 别名]
def make_model():
start_time = datetime(2015, 5, 14, 0)
model = Model(time_step=3600*24, # one day
start_time=start_time,
duration=timedelta(days=3),)
model.cache_enabled = False
model.uncertain = False
# N = 10 # a line of ten points
# line_pos = np.zeros((N, 3), dtype=np.float64)
# line_pos[:, 0] = np.linspace(rel_start_pos[0], rel_end_pos[0], N)
# line_pos[:, 1] = np.linspace(rel_start_pos[1], rel_end_pos[1], N)
# start_pos = (-164.01696, 72.921024, 0)
# model.spills += point_line_release_spill(1,
# start_position=start_pos,
# release_time=model.start_time,
# end_position=start_pos)
# release = SpatialRelease(start_position=line_pos,
# release_time=model.start_time)
# model.spills += Spill(release)
c_ice_mover = IceMover(curr_file, topology_file)
model.movers += c_ice_mover
model.outputters += IceImageOutput(c_ice_mover,
viewport=((-175.0, 65.0),
(-145.0, 75.05))
)
return model
示例3: test_ice_image_mid_run
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import cache_enabled [as 别名]
def test_ice_image_mid_run():
'''
Test image outputter with a model
NOTE: could it be tested with just a mover, and not a full model?
-- that gets tricky with the cache and timesteps...
'''
start_time = datetime(2015, 5, 14, 0)
model = Model(time_step=3600*24, # one day
start_time=start_time,
duration=timedelta(days=3),)
model.cache_enabled = False
model.uncertain = False
c_ice_mover = IceMover(curr_file, topology_file)
model.movers += c_ice_mover
## run the model a couple steps
step = model.step()
step = model.step()
## now add the outputter
iio = IceImageOutput(c_ice_mover)
model.outputters += iio
## and run some more:
step = model.step()
step = model.step()
## and check the output
ice_output = step['IceImageOutput']
# print ice_output['time_stamp']
# print ice_output['concentration_image'][:50] # could be really big!
# print ice_output['bounding_box']
# print ice_output['projection']
for key in ('time_stamp',
'thickness_image',
'concentration_image',
'bounding_box',
'projection'):
assert key in ice_output