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


Python Renderer.delay方法代码示例

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


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

示例1: make_models

# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import delay [as 别名]
def make_models():
    print 'initializing the model'

    # start_time = datetime(2015, 12, 18, 06, 01)

    # 1 day of data in file
    # 1/2 hr in seconds
    models = []
    start_time = datetime(2012, 10, 27, 0, 30)
    duration_hrs=23
    time_step=450
    num_steps = duration_hrs * 3600 / time_step
    names = [
             'Euler',
             'Trapezoid',
             'RK4',
             ]

    mapfile = get_datafile(os.path.join(base_dir, 'long_beach.bna'))
    print 'gen map'
    map = MapFromBNA(mapfile, refloat_halflife=0.0)  # seconds
    fn = ('00_dir_roms_display.ncml.nc4')
    curr = GridCurrent.from_netCDF(filename=fn)
    models = []
    for method in names:

        mod = Model(start_time=start_time,
                    duration=timedelta(hours=duration_hrs),
                    time_step=time_step)

        mod.map = map
        spill = point_line_release_spill(num_elements=1000,
                                         start_position=(-74.1,
                                                      39.7525,
                                                      0.0),
                                         release_time=start_time)
        mod.spills += spill
        mod.movers += RandomMover(diffusion_coef=100)
        mod.movers += PyGridCurrentMover(current=curr, default_num_method=method)

        images_dir = method + '-' + str(time_step / 60) + 'min-' + str(num_steps) + 'steps'
        renderer = Renderer(mapfile, images_dir, image_size=(1024, 768))
        renderer.delay = 25
#         renderer.add_grid(curr.grid)
        mod.outputters += renderer


        netCDF_fn = os.path.join(base_dir, images_dir + '.nc')
        mod.outputters += NetCDFOutput(netCDF_fn, which_data='all')
        models.append(mod)

    print 'returning models'
    return models
开发者ID:,项目名称:,代码行数:55,代码来源:

示例2: make_model

# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import delay [as 别名]
def make_model():
    duration_hrs=48
    time_step=900
    num_steps = duration_hrs * 3600 / time_step
    mod = Model(start_time=t,
                duration=timedelta(hours=duration_hrs),
                time_step=time_step)

    spill = point_line_release_spill(num_elements=1000,
                                     amount=1600,
                                     units='kg',
                                     start_position=(0.5,
                                                  0.5,
                                                  0.0),
                                     release_time=t,
                                     end_release_time=t+timedelta(hours=4)
                                     )
    mod.spills += spill

    method='Trapezoid'
    images_dir = method + '-' + str(time_step / 60) + 'min-' + str(num_steps) + 'steps'
    renderer = Renderer(output_dir=images_dir, image_size=(800,800))
    renderer.delay = 5
    renderer.add_grid(g)
    renderer.add_vec_prop(vg)

    renderer.graticule.set_max_lines(max_lines=0)
    mod.outputters += renderer

    mod.movers += PyGridCurrentMover(current=vg, default_num_method=method, extrapolate=True)
    mod.movers += RandomMover(diffusion_coef=10)

    netCDF_fn = os.path.join(base_dir, images_dir + '.nc')
    mod.outputters += NetCDFOutput(netCDF_fn, which_data='all')

    return mod
开发者ID:,项目名称:,代码行数:38,代码来源:


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