parallel_file.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Fluid2d 作者: pvthinker 项目源码 文件源码
def anim(filename,varname,cax):
    template = filename+'_%03i.nc'
    nc0     = Dataset(template%(0),'r') # open proc 0 nc file   
    nt = len(nc0.dimensions['t'])
    nc0.close()

    def animate(i):
        global kt
        time,z2d=read(filename,varname,kt)
        im.set_data(z2d)
        ti.set_text('%.0f     '%time)
        kt +=5
        return im,ti
    fig=plt.figure()
    ax = fig.add_subplot(111)
    time,z2d=read(filename,varname,0)
    im=ax.imshow(z2d,vmin=cax[0],vmax=cax[1])
    ti=ax.text(100,-50,'%.0f        '%time)
    print('launch the animation')
    global kt
    kt = 0
    ani = animation.FuncAnimation(fig, animate,arange(nt),interval=5, blit=True)
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号