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


Python Renderer.draw_raster_map方法代码示例

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


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

示例1: make_model

# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import draw_raster_map [as 别名]
def make_model(images_dir=os.path.join(base_dir, 'images')):
    print 'initializing the model'

    start_time = datetime(2013, 5, 18, 0)

    model = Model(start_time=start_time, duration=timedelta(days=8),
                  time_step=4 * 3600, uncertain=False)

    mapfile = get_datafile(os.path.join(base_dir, 'mariana_island.bna'))

    print 'adding the map'
    model.map = MapFromBNA(mapfile, refloat_halflife=6)  # hours

    #
    # Add the outputters -- render to images, and save out as netCDF
    #

    print 'adding renderer'
    rend =  Renderer(mapfile,
                                 images_dir,
                                 size=(800, 600),
                                 draw_map_bounds=True
                                 )
    rend.draw_raster_map()
    model.outputters += rend
#                                 draw_back_to_fore=True)

    # print "adding netcdf output"
    # netcdf_output_file = os.path.join(base_dir,'mariana_output.nc')
    # scripting.remove_netcdf(netcdf_output_file)
    # model.outputters += NetCDFOutput(netcdf_output_file, which_data='all')

    #
    # Set up the movers:
    #
    rend.zoom(0.5)
    rend.zoom(2)

    print 'adding a RandomMover:'
    model.movers += RandomMover(diffusion_coef=10000)

    print 'adding a simple wind mover:'
    model.movers += constant_wind_mover(7, 90, units='m/s')

    print 'adding a current mover:'

#     # # this is HYCOM currents
#     curr_file = get_datafile(os.path.join(base_dir, 'HYCOM.nc'))
#     model.movers += GridCurrentMover(curr_file,
#                                      num_method=numerical_methods.euler);

    # #
    # # Add some spills (sources of elements)
    # #

    print 'adding four spill'
    model.spills += point_line_release_spill(num_elements=NUM_ELEMENTS // 4,
                                             start_position=(146, 15.25,
                                                             0.0),
                                             release_time=start_time)
    model.spills += point_line_release_spill(num_elements=NUM_ELEMENTS // 4,
                                             start_position=(146, 15.125,
                                                             0.0),
                                             release_time=start_time)
    model.spills += point_line_release_spill(num_elements=NUM_ELEMENTS // 4,
                                             start_position=(146, 15.0,
                                                             0.0),
                                             release_time=start_time)
    model.spills += point_line_release_spill(num_elements=NUM_ELEMENTS // 4,
                                             start_position=(146, 14.875,
                                                             0.0),
                                             release_time=start_time)

    return model
开发者ID:liuy0813,项目名称:PyGnome,代码行数:76,代码来源:script_server_render.py


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