本文整理汇总了Python中gnome.model.Model.merge方法的典型用法代码示例。如果您正苦于以下问题:Python Model.merge方法的具体用法?Python Model.merge怎么用?Python Model.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.model.Model
的用法示例。
在下文中一共展示了Model.merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_location_file
# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import merge [as 别名]
def test_load_location_file(self, saveloc_, model):
'''
create a model
load save file from script_boston which contains a spill. Then merge
the created model into the model loaded from save file
'''
m = Model()
m.environment += [Water(), constant_wind(1., 0.)]
m.weatherers += Evaporation(m.environment[0], m.environment[-1])
m.spills += point_line_release_spill(10, (0, 0, 0),
datetime(2014, 1, 1, 12, 0))
# create save model
sample_save_file = os.path.join(saveloc_, 'SampleSaveModel.zip')
model.save(saveloc_, name='SampleSaveModel.zip')
if os.path.exists(sample_save_file):
model = load(sample_save_file)
model.merge(m)
for oc in m._oc_list:
for item in getattr(m, oc):
model_oc = getattr(model, oc)
assert item is model_oc[item.id]
for spill in m.spills:
assert spill is model.spills[spill.id]
# merge the other way and ensure model != m
m.merge(model)
assert model != m