当前位置: 首页>>代码示例>>Python>>正文


Python PISM.optionsStringWasSet方法代码示例

本文整理汇总了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)
开发者ID:crodehacke,项目名称:PISMcr,代码行数:32,代码来源:sia_forward.py

示例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)
开发者ID:crodehacke,项目名称:PISMcr,代码行数:33,代码来源:ssa_forward.py


注:本文中的PISM.optionsStringWasSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。