本文整理汇总了Python中ecl.summary.EclSum.restart_writer方法的典型用法代码示例。如果您正苦于以下问题:Python EclSum.restart_writer方法的具体用法?Python EclSum.restart_writer怎么用?Python EclSum.restart_writer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ecl.summary.EclSum
的用法示例。
在下文中一共展示了EclSum.restart_writer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createEclSum
# 需要导入模块: from ecl.summary import EclSum [as 别名]
# 或者: from ecl.summary.EclSum import restart_writer [as 别名]
def createEclSum( case,
keys,
sim_start = datetime.date(2010 , 1, 1),
data_start = None,
sim_length_days = 5 * 365,
num_report_step = 5,
num_mini_step = 10,
dims = (20,10,5) ,
func_table = {},
restart_case = None,
restart_step = -1):
ecl_sum = EclSum.restart_writer(case , restart_case, restart_step, sim_start , dims[0] , dims[1] , dims[2])
var_list = []
for (kw,wgname,num,unit) in keys:
var_list.append( ecl_sum.addVariable( kw , wgname = wgname , num = num, unit =unit) )
# This is a bug! This should not be integer division, but tests are written
# around that assumption.
report_step_length = float(sim_length_days // num_report_step)
mini_step_length = float(report_step_length // num_mini_step)
if data_start is None:
time_offset = 0
else:
dt = data_start - sim_start
time_offset = dt.total_seconds() / 86400.0
for report_step in range(num_report_step):
for mini_step in range(num_mini_step):
days = time_offset + report_step * report_step_length + mini_step * mini_step_length
t_step = ecl_sum.addTStep( report_step + 1 , sim_days = days )
for var in var_list:
key = var.getKey1( )
if key in func_table:
func = func_table[key]
t_step[key] = func( days )
else:
t_step[key] = mock_func( ecl_sum , key , days)
return ecl_sum