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


Python PISM.show_usage_check_req_opts方法代码示例

本文整理汇总了Python中PISM.show_usage_check_req_opts方法的典型用法代码示例。如果您正苦于以下问题:Python PISM.show_usage_check_req_opts方法的具体用法?Python PISM.show_usage_check_req_opts怎么用?Python PISM.show_usage_check_req_opts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PISM的用法示例。


在下文中一共展示了PISM.show_usage_check_req_opts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import show_usage_check_req_opts [as 别名]
context = PISM.Context()
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
开发者ID:crodehacke,项目名称:PISMcr,代码行数:32,代码来源:sia_forward.py

示例2:

# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import show_usage_check_req_opts [as 别名]

context = PISM.Context()
config = context.config

PISM.set_abort_on_sigint(True)

usage = \
    """  %s -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
""" % (sys.argv[0])

PISM.show_usage_check_req_opts(context.com, sys.argv[0], ["-i"], usage)

bootfile = PISM.optionsString("-i", "input file")
output_file = PISM.optionsString("-o", "output file", default="tauc2tillphi_" + os.path.basename(bootfile))

verbosity = PISM.optionsInt("-verbose", "verbosity level", default=2)
PISM.set_config_from_options(context.com, config)

grid = PISM.IceGrid.FromFile(context.ctx, bootfile, ["enthalpy", "temp"], PISM.XY_PERIODIC)

enthalpyconverter = PISM.EnthalpyConverter(config)
if PISM.getVerbosityLevel() > 3:
    enthalpyconverter.viewConstants(PETSc.Viewer.STDOUT())

if PISM.OptionBool("-ssa_glen", "SSA flow law Glen exponent"):
    B_schoof = 3.7e8     # Pa s^{1/3}; hardness
开发者ID:crodehacke,项目名称:PISMcr,代码行数:32,代码来源:tauc2tillphi.py

示例3: len

# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import show_usage_check_req_opts [as 别名]
context = PISM.Context()
ctx = context.ctx
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.show_usage_check_req_opts(ctx.log(), "sia_forward.py", ["-i"], usage)

input_filename = config.get_string("input.file")
if len(input_filename) == 0:
    import sys
    sys.exit(1)

config.set_string("output.file_name", "sia_" + os.path.basename(input_filename), PISM.CONFIG_DEFAULT)

output_file = config.get_string("output.file_name")
is_regional = PISM.OptionBool("-regional", "Compute SIA using regional model semantics")

registration = PISM.CELL_CENTER
if is_regional:
    registration = PISM.CELL_CORNER
开发者ID:pism,项目名称:pism,代码行数:31,代码来源:sia_forward.py

示例4: or

# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import show_usage_check_req_opts [as 别名]
    PISM.set_abort_on_sigint(True)

    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(context.log, "ssa_forward", ["-i"], usage)

    input_file = config.get_string("input.file")
    if len(input_file) == 0:
        import sys
        sys.exit(1)

    config.set_string("output.file_name", "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
开发者ID:pism,项目名称:pism,代码行数:33,代码来源:ssa_forward.py

示例5: or

# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import show_usage_check_req_opts [as 别名]
  PISM.stop_on_version_option()
  usage = \
"""  pross.py -boot_file IN.nc -Mx number -My number [-o file.nc] [-riggs file.nc]
  or (at python prompt)
    run pross -boot_file IN.nc -Mx number -My number [-o file.nc] [-riggs file.nc]
  where:
    -boot_file  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
    -riggs      read RIGGS data from a file
  notes:
    * -boot_file is required
"""

  PISM.show_usage_check_req_opts(com,"pross",["-boot_file"],usage)

  config = context.config()
  config.set_flag("use_ssa_velocity", True)
  config.set_flag("use_ssa_when_grounded", False)
  config.set_flag("use_constant_nuh_for_ssa", False)
  config.set("epsilon_ssafd", 0.0)

  for o in PISM.OptionsGroup(com,"","PROSS"):
    Mx = PISM.optionsInt("-Mx","Number of grid points in the X-direction",default=None)
    My = PISM.optionsInt("-My","Number of grid points in the X-direction",default=None)
    boot_file = PISM.optionsString("-boot_file","file to bootstrap from")
    riggs_file = PISM.optionsString("-riggs","file with riggs measurements")
    output_file = PISM.optionsString("-o","output file",default="ross_computed.nc")

  test_case = pross(Mx,My,boot_file,riggs_file)
开发者ID:matthiasmengel,项目名称:pism,代码行数:33,代码来源:pross.py


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