Exemplo n.º 1
0
# Files that describe oceanic and atmospheric state
atpa = nc.Dataset(datapath + 'atpa.nc')
ocpo = nc.Dataset(datapath + 'ocpo.nc')

savepath = './'
variable = 1

steps = [0, 36, 73, 109, 146, 182, 219, 255, 292, 328, 365]

for i in range(2):
    for j in range(3):
        if i == 0:
            dx = dxo
            # Dimensionalise alpha
            alpha = bccooc / dx
            p_oc = utils.Pressure(ocpo.variables['p'][steps, j, :, :])
            if variable == 0:
                name = 'u_oc' + '_' + str(j + 1) + '_a'
                u = utils.ContourData(p_oc.zonal(0, alpha, dx, fnot).data,
                                      name=name)
                [fig, ax] = u.init_frame('Zonal Velocity ($ms^{-1}$)', True)
                u.take_snapshots(1, 365, savepath, True)
            elif variable == 1:
                name = 'v_oc' + '_' + str(j + 1) + '_b'
                v = utils.ContourData(p_oc.meridional(0, alpha, dx, fnot).data,
                                      name=name)
                [fig, ax] = v.init_frame('Meridional Velocity ($ms^{-1}$)',
                                         True)
                v.take_snapshots(1, 365, savepath, True)
            else:
                name = 's_oc' + '_' + str(j + 1) + '_a'
Exemplo n.º 2
0
avges = nc.Dataset(datapath + 'avges.nc')

savepath = './'

#variable = 'zonal'
#variable = 'meridional'
variable = 'speed'

for i in range(1, 2):
    for j in range(3):
        if i == 0:
            dx = dxo
            # Dimensionalise alpha
            alpha = bccooc / dx
            p_oc = np.array(avges.variables['po'][j, :, :])
            p_oc = utils.Pressure(p_oc[np.newaxis, :, :])
            if variable == 'zonal':
                name = 'u_oc_avge' + '_' + str(j + 1) + '_a'
                u = utils.ContourData(p_oc.zonal(0, alpha, dx, fnot).data,
                                      name=name)
                [fig, ax] = u.init_frame('Zonal Velocity ($ms^{-1}$)', True)
                u.take_snapshots(1, 1, savepath, True)
            elif variable == 'meridional':
                name = 'v_oc_avge' + '_' + str(j + 1) + '_a'
                v = utils.ContourData(p_oc.meridional(0, alpha, dx, fnot).data,
                                      name=name)
                [fig, ax] = v.init_frame('Meridional Velocity ($ms^{-1}$)',
                                         True)
                v.take_snapshots(1, 1, savepath, True)
            elif variable == 'speed':
                name = 's_oc_avge' + '_' + str(j + 1) + '_a'
Exemplo n.º 3
0
time = p_.shape[0]  # total time

writer = ani.ImageMagickWriter()

for i in range(2):
    if i == 0:
        p_ = ocpo.variables['p'][:, :, :, :]
        dx = dxo
        alpha = bccooc * dx
    else:
        p_ = atpa.variables['p'][:, :, :, :]
        dx = dxa
        alpha = bccoat * dx

    for j in range(3):
        p = utils.Pressure(p_[:, j, :, :])
        # u = p.zonal(i, alpha, dx, fnot)
        # v = p.meridional(i, alpha, dx, fnot)
        s = p.speed(i, alpha, dx, fnot)

        # [fig1, ax1] = u.init_frame()
        # [fig2, ax2] = v.init_frame()
        [fig3, ax3] = s.init_frame()
        # anim1 = ani.FuncAnimation(fig1, u.frame_i, frames=time)
        # anim2 = ani.FuncAnimation(fig2, v.frame_i, frames=time)
        anim3 = ani.FuncAnimation(fig3, s.frame_i, frames=time)
        if i == 0:
            # anim1.save('/rds/general/user/rk2014/home/WORK/q-gcm/post_process/vel_videos/u'+str(j+1)+'_oc.gif', writer=writer)
            # anim2.save('/rds/general/user/rk2014/home/WORK/q-gcm/post_process/vel_videos/v'+str(j+1)+'_oc.gif',writer=writer)
            anim3.save(
                '/rds/general/user/rk2014/home/WORK/q-gcm/post_process/vel_videos/s'