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


Python Model.save方法代码示例

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


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

示例1: make_model

# 需要导入模块: from gnome.model import Model [as 别名]
# 或者: from gnome.model.Model import save [as 别名]

#.........这里部分代码省略.........
    start_time = datetime(1985, 1, 1, 13, 31)

    # 1 day of data in file
    # 1/2 hr in seconds
    model = Model(start_time=start_time,
                  duration=timedelta(days=4),
                  time_step=3600*2)

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

    print 'adding the map'
    model.map = MapFromBNA(mapfile, refloat_halflife=0.0)  # seconds
#     model.map = GnomeMap()

    print 'adding outputters'

    # draw_ontop can be 'uncertain' or 'forecast'
    # 'forecast' LEs are in black, and 'uncertain' are in red
    # default is 'forecast' LEs draw on top
#     renderer = Renderer(mapfile, images_dir, image_size=(1024, 768))
#     model.outputters += renderer
    netcdf_file = os.path.join(base_dir, 'script_old_TAPa.nc')
    scripting.remove_netcdf(netcdf_file)

    model.outputters += NetCDFOutput(netcdf_file, which_data='all')

    print 'adding a spill'
    # for now subsurface spill stays on initial layer
    # - will need diffusion and rise velocity
    # - wind doesn't act
    # - start_position = (-76.126872, 37.680952, 5.0),
    spill1 = point_line_release_spill(num_elements=10000,
                                      start_position=(196.25,
                                                      69.75,
                                                      0.0),
                                      release_time=start_time)
#
#     spill2 = point_line_release_spill(num_elements=5000,
#                                       start_position=(-163.75,
#                                                       69.5,
#                                                       0.0),
#                                       release_time=start_time)

    model.spills += spill1
#     model.spills += spill2

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

    print 'adding a wind mover:'
     # winds from the ROMS Arctic run, provided by Walter Johnson
    wind_file = os.path.join(base_dir, 'arctic_filelist.txt')
    print wind_file
    topology_file = os.path.join(base_dir, 'arctic_subset_newtopo2.DAT')
    model.movers += IceWindMover(wind_file, topology_file)
    # model.movers += GridWindMover(wind_file, topology_file)
    # model.movers += GridWindMover(wind_file, topology_file)

    print 'adding an ice mover:'
  # ice from the ROMS Arctic run, provided by Walter Johnson
    ice_file = os.path.join(base_dir, 'arctic_filelist.txt')
    topology_file = os.path.join(base_dir, 'arctic_subset_newtopo2.DAT')
    model.movers += IceMover(ice_file, topology_file)
    # model.movers += IceMover(ice_file)
    print ice_file

    print 'adding a current mover:'
#
#     fn = ['N:\\Users\\Dylan.Righi\\OutBox\\ArcticROMS\\arctic_avg2_0001_gnome.nc',
#                  'N:\\Users\\Dylan.Righi\\OutBox\\ArcticROMS\\arctic_avg2_0002_gnome.nc']
#
#     gt = {'node_lon':'lon',
#           'node_lat':'lat'}
# #     fn='arctic_avg2_0001_gnome.nc'
#
#     ice_aware_curr = IceAwareCurrent.from_netCDF(filename=fn,
#                                                  grid_topology=gt)
#     ice_aware_wind = IceAwareWind.from_netCDF(filename=fn,
#                                               grid = ice_aware_curr.grid,)
#     method = 'Trapezoid'
#
# #     i_c_mover = PyGridCurrentMover(current=ice_aware_curr)
# #     i_c_mover = PyGridCurrentMover(current=ice_aware_curr, default_num_method='Euler')
#     i_c_mover = PyGridCurrentMover(current=ice_aware_curr, default_num_method=method)
#     i_w_mover = PyWindMover(wind = ice_aware_wind, default_num_method=method)
#
#     ice_aware_curr.grid.node_lon = ice_aware_curr.grid.node_lon[:]-360
# #     ice_aware_curr.grid.build_celltree()
#     model.movers += i_c_mover
#     model.movers += i_w_mover
#     renderer.add_grid(ice_aware_curr.grid)
#     renderer.add_vec_prop(ice_aware_curr)


#     renderer.set_viewport(((-190.9, 60), (-72, 89)))
    # curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
    # c_mover = GridCurrentMover(curr_file)
    # model.movers += c_mover
    model.save('.')
    return model
开发者ID:,项目名称:,代码行数:104,代码来源:


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