本文整理汇总了Python中gnome.outputters.Renderer.set_timestamp_attrib方法的典型用法代码示例。如果您正苦于以下问题:Python Renderer.set_timestamp_attrib方法的具体用法?Python Renderer.set_timestamp_attrib怎么用?Python Renderer.set_timestamp_attrib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnome.outputters.Renderer
的用法示例。
在下文中一共展示了Renderer.set_timestamp_attrib方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_model
# 需要导入模块: from gnome.outputters import Renderer [as 别名]
# 或者: from gnome.outputters.Renderer import set_timestamp_attrib [as 别名]
def make_model(images_dir=os.path.join(base_dir, 'images')):
print 'initializing the model'
start_time = datetime(2015, 9, 24, 3, 0)
# 1 day of data in file
# 1/2 hr in seconds
model = Model(start_time=start_time,
duration=timedelta(hours = 48),
time_step=3600)
mapfile = get_datafile(os.path.join(base_dir, 'Perfland.bna'))
print 'adding the map'
model.map = MapFromBNA(mapfile, refloat_halflife=1, raster_size=1024*1024) # seconds
# 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=(800, 600),
output_timestep=timedelta(hours=1),
timestamp_attrib={'size': 'medium', 'color':'uncert_LE'})
renderer.set_timestamp_attrib(format='%a %c')
renderer.graticule.set_DMS(True)
# renderer.viewport = ((-124.25, 47.5), (-122.0, 48.70))
print 'adding outputters'
model.outputters += renderer
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=5000,
start_position=(0.0,
0.0,
0.0),
release_time=start_time)
model.spills += spill1
print 'adding a RandomMover:'
model.movers += RandomMover(diffusion_coef=50000)
print 'adding a wind mover:'
model.movers += constant_wind_mover(13, 270, units='m/s')
print 'adding a current mover:'
# curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
#
# # uncertain_time_delay in hours
# c_mover = GridCurrentMover(curr_file)
# c_mover.uncertain_cross = 0 # default is .25
#
# model.movers += c_mover
return model