本文整理汇总了Python中PISM.optionsStringWasSet方法的典型用法代码示例。如果您正苦于以下问题:Python PISM.optionsStringWasSet方法的具体用法?Python PISM.optionsStringWasSet怎么用?Python PISM.optionsStringWasSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PISM
的用法示例。
在下文中一共展示了PISM.optionsStringWasSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import optionsStringWasSet [as 别名]
config = context.config
PISM.set_abort_on_sigint(True)
usage = """\
sia_forward.py -i IN.nc [-o file.nc]
where:
-i IN.nc is input file in NetCDF format: contains PISM-written model state
notes:
* -i is required
"""
PISM.verbosityLevelFromOptions()
PISM.show_usage_check_req_opts(context.com, "sia_forward.py", ["-i"], usage)
input_file, input_set = PISM.optionsStringWasSet("-i", "input file")
if not input_set:
import sys
sys.exit(1)
output_file = PISM.optionsString("-o", "output file",
default="sia_" + os.path.basename(input_file))
is_regional = PISM.optionsFlag("-regional",
"Compute SIA using regional model semantics", default=False)
verbosity = PISM.optionsInt("-verbose", "verbosity level", default=2)
periodicity = PISM.XY_PERIODIC
if is_regional:
periodicity = PISM.NOT_PERIODIC
grid = PISM.IceGrid.FromFile(context.ctx, input_file, "enthalpy", periodicity)
示例2: or
# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import optionsStringWasSet [as 别名]
PISM.verbPrintf(2, PISM.Context().com, "SSA forward model.\n")
usage = \
""" ssa_forward.py -i IN.nc -Mx number -My number [-o file.nc]
or (at python prompt)
run ssa_forward -i IN.nc -Mx number -My number [-o file.nc]
where:
-i IN.nc is input file in NetCDF format: contains PISM-written model state
-Mx number of grid points in the x direction
-My number of grid points in the y direction
notes:
* -i is required
"""
PISM.show_usage_check_req_opts(com, "ssa_forward", ["-i"], usage)
input_file, input_file_set = PISM.optionsStringWasSet("-i", "input file with PISM model data")
if not input_file_set:
import sys
sys.exit(1)
output_file = PISM.optionsString("-o", "output file", default="ssa_forward.nc")
ssa_run = PISM.ssa.SSAFromInputFile(input_file)
ssa_run.setup()
solve_t0 = time.clock()
vel_ssa = ssa_run.solve()
solve_t = time.clock() - solve_t0
PISM.verbPrintf(2, context.com, "Solve time %g seconds.\n", solve_t)