本文整理汇总了Python中PISM.process_input_options方法的典型用法代码示例。如果您正苦于以下问题:Python PISM.process_input_options方法的具体用法?Python PISM.process_input_options怎么用?Python PISM.process_input_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PISM
的用法示例。
在下文中一共展示了PISM.process_input_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import process_input_options [as 别名]
def run(dt, restart=False):
"Run the model for 1 time step, stop, save model state, restart, do 1 more step."
grid = PISM.IceGrid.Shallow(ctx.ctx, Lx, Ly, 0, 0, N, N,
PISM.CELL_CORNER, PISM.NOT_PERIODIC)
model = PISM.LingleClark(grid)
ice_thickness, bed, bed_uplift, sea_level = allocate_storage(grid)
grid.variables().add(ice_thickness)
# start with a flat bed, no ice, and no uplift
bed.set(0.0)
bed_uplift.set(0.0)
ice_thickness.set(0.0)
sea_level.set(0.0)
# initialize the model
model.bootstrap(bed, bed_uplift, ice_thickness, sea_level)
# add the disc load
add_disc_load(ice_thickness, disc_radius, disc_thickness)
# do 1 step
model.step(ice_thickness, sea_level, dt)
if restart:
# save the model state
filename = "lingle_clark_model_state.nc"
try:
PISM.util.prepare_output(filename)
f = PISM.PIO(grid.com, "netcdf3", filename, PISM.PISM_READWRITE)
model.write_model_state(f)
f.close()
# create a new model
del model
model = PISM.LingleClark(grid)
# initialize
PISM.PETSc.Options().setValue("-i", filename)
options = PISM.process_input_options(grid.com, ctx.config)
model.init(options, ice_thickness, sea_level)
finally:
os.remove(filename)
# do 1 more step
model.step(ice_thickness, sea_level, dt)
return model
示例2: create_dummy_grid
# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import process_input_options [as 别名]
grid = create_dummy_grid()
ice_thickness = PISM.model.createIceThicknessVec(grid)
u = PISM.IceModelVec3()
u.create(grid, "u", PISM.WITHOUT_GHOSTS)
v = PISM.IceModelVec3()
v.create(grid, "v", PISM.WITHOUT_GHOSTS)
w = PISM.IceModelVec3()
w.create(grid, "w", PISM.WITHOUT_GHOSTS)
ice_thickness.set(4000.0)
u.set(0.0)
v.set(0.0)
w.set(0.0)
model = PISM.AgeModel(grid, None)
input_options = PISM.process_input_options(ctx.com, ctx.config)
model.init(input_options)
inputs = PISM.AgeModelInputs(ice_thickness, u, v, w)
dt = PISM.util.convert(1, "years", "seconds")
model.update(0, dt, inputs)
model.age().dump("age.nc")