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


Python Renderer.rewind方法代码示例

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


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

示例1: test_rewind

# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import rewind [as 别名]
def test_rewind(output_dir):
    'test rewind calls base function and clear_output_dir'
    r = Renderer(bna_sample, output_dir)
    bg_name = r.background_map_name
    fg_format = r.foreground_filename_format

    # dump some files into output dir:

    open(os.path.join(output_dir, bg_name), 'w').write('some junk')

    for i in range(5):
        open(os.path.join(output_dir, fg_format.format(i)), 'w'
             ).write('some junk')

    now = datetime.now()
    r.prepare_for_model_run(model_start_time=now)

    assert r._model_start_time == now

    r.rewind()
    assert r._model_start_time is None  # check super is called correctly
    # there should only be a background image now.

    files = os.listdir(output_dir)
    assert files == []
开发者ID:axiom-data-science,项目名称:PyGnome,代码行数:27,代码来源:test_renderer.py

示例2: test_rewind

# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import rewind [as 别名]
def test_rewind(output_dir):
    'test rewind calls base function and clear_output_dir'
    r = Renderer(bna_sample, output_dir)
    bg_name = r.background_map_name
    fg_format = r.foreground_filename_format

    # dump some files into output dir:

    open(os.path.join(output_dir, bg_name), 'w').write('some junk')

    for i in range(5):
        open(os.path.join(output_dir, fg_format.format(i)), 'w'
             ).write('some junk')

    now = datetime.now()
    r.prepare_for_model_run(model_start_time=now)

    assert r._model_start_time == now

    r.rewind()
    # check super is called correctly
    assert r._model_start_time is None
    assert r._dt_since_lastoutput is None
    assert r._write_step is True

    # changed renderer and netcdf ouputter to delete old files in
    # prepare_for_model_run() rather than rewind()
    # -- rewind() was getting called a lot
    # -- before there was time to change the ouput file names, etc.
    # So for this unit test, there should only be a background image now.
    files = os.listdir(output_dir)
    assert files == ['background_map.png']
开发者ID:sandhujasmine,项目名称:PyGnome,代码行数:34,代码来源:test_renderer.py


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