Exemple #1
0
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/Users/rk2014/Documents/q-gcm/src/outdata/'

# Files that describe oceanic and atmospheric state
atpa = nc.Dataset(datapath + 'atpa.nc')
ocpo = nc.Dataset(datapath + 'ocpo.nc')

q_oc = ocpo.variables['q'][:, :, :, :]
q_at = atpa.variables['q'][:, :, :, :]

time = q_oc.shape[0]  # total time

for i in range(2):
    for j in range(3):
        if i == 0:
            q = utils.ContourData(q_oc[:, j, :, :])
        else:
            q = utils.ContourData(q_at[:, j, :, :])
        if i == 0:
            [fig, ax] = q.init_frame('Potential Vorticity ($s^{-1}$)', True)
            anim = ani.FuncAnimation(fig, q.frame_i, frames=time)
            anim.save('/Users/rk2014/Documents/q-gcm/post-process/pv' +
                      str(j + 1) + '_oc.mp4')
        else:
            [fig, ax] = q.init_frame('Potential Vorticity ($s^{-1}$)', False)
            anim = ani.FuncAnimation(fig, q.frame_i, frames=time)
            anim.save('/Users/rk2014/Documents/q-gcm/post-process/pv' +
                      str(j + 1) + '_at.mp4')
Exemple #2
0
import matplotlib.pyplot as plt
import matplotlib.animation as ani
from matplotlib import cm
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_toptest/1/'

# Files that describe oceanic and atmospheric state
atpa = nc.Dataset(datapath + 'atpa.nc')
ocpo = nc.Dataset(datapath + 'ocpo.nc')

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

q_oc = ocpo.variables['q'][steps, :, :, :]
q_at = atpa.variables['q'][steps, :, :, :]

savepath = './'
for i in range(2):
    for j in range(3):
        if i == 0:
            name = 'PV_oc' + '_' + str(j + 1) + 'b_'
            q = utils.ContourData(q_oc[:, j, :, :], name=name)
            [fig, ax] = q.init_frame('Potential Vorticity ($s^{-1}$)', True)
            q.take_snapshots(1, 365, savepath, True)
        else:
            name = 'PV_at' + '_' + str(j + 1) + 'b_'
            q = utils.ContourData(q_at[:, j, :, :], name=name)
            [fig, ax] = q.init_frame('Potential Vorticity ($s^{-1}$)', False)
            q.take_snapshots(1, 365, savepath, False)
Exemple #3
0
import matplotlib.animation as ani
from matplotlib import cm
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_210_a/'

# Files that describe oceanic and atmospheric state
atast = nc.Dataset(datapath + 'atast.nc')
ocsst = nc.Dataset(datapath + 'ocsst.nc')

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

ast = atast.variables['ast'][steps, :, :]
sst = ocsst.variables['sst'][steps, :, :]

time = ast.shape[0]  # total time
savepath = './'
for i in range(2):

    if i == 0:
        name = 'sst_a_'
        sst = utils.ContourData(sst[:, :, :], name=name)
        [fig, ax] = sst.init_frame('SST ($K$)', True)
        sst.take_snapshots(1, 365, savepath, True)
    else:
        name = 'ast_a_'
        ast = utils.ContourData(ast[:, :, :], name=name)
        [fig, ax] = ast.init_frame('AST ($K$)', False)
        ast.take_snapshots(1, 365, savepath, False)
Exemple #4
0
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.animation as ani
from matplotlib import cm
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_toptest/2/'
writer = ani.ImageMagickWriter()

# Files that describe oceanic and atmospheric state
atast = nc.Dataset(datapath + 'atast.nc')
ocsst = nc.Dataset(datapath + 'ocsst.nc')

ast = atast.variables['ast']
sst = ocsst.variables['sst']

time = ast.shape[0]  # total time

for i in range(2):
    if i == 0:
        ast = utils.ContourData(ast[:, :, :])
        [fig, ax] = ast.init_frame('AST ($K$)', False)
        anim = ani.FuncAnimation(fig, ast.frame_i, frames=time)
        anim.save('./ast_b.gif', writer=writer)
    else:
        sst = utils.ContourData(sst[:, :, :])
        [fig, ax] = sst.init_frame('SST ($K$)', True)
        anim = ani.FuncAnimation(fig, sst.frame_i, frames=time)
        anim.save('./sst_b.gif', writer=writer)
Exemple #5
0
# Files that describe oceanic and atmospheric state
atpa = nc.Dataset(datapath + 'atpa.nc')
ocpo = nc.Dataset(datapath + 'ocpo.nc')

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

p_oc = ocpo.variables['p'][steps, :, :, :]
p_at = atpa.variables['p'][steps, :, :, :]

H_at = [2000, 3000, 4000]
H_oc = [350, 750, 2900]

f0 = fnot

savepath = './'

for i in range(2):
    for j in range(3):
        if i == 0:
            name = 'Sv_oc' + '_a_' + str(j + 1)
            psi = utils.ContourData(p_oc[:, j, :, :] * H_oc[j] / (f0 * 10**6),
                                    name=name)
            [fig, ax] = psi.init_frame('Layer Transport (Sv)', True)
            psi.take_snapshots(1, 365, savepath, True)
        else:
            name = 'Sv_at' + '_a_' + str(j + 1)
            psi = utils.ContourData(p_at[:, j, :, :] * H_at[j] / (f0 * 10**6),
                                    name=name)
            [fig, ax] = psi.init_frame('Layer Transport (Sv)', False)
            psi.take_snapshots(1, 365, savepath, False)
Exemple #6
0
#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'
                s = utils.ContourData(p_oc.speed(0, alpha, dx, fnot).data,
                                      name=name)
                [fig, ax] = s.init_frame('Speed ($ms^{-1}$)', True)
                s.take_snapshots(1, 1, savepath, True)
Exemple #7
0
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.animation as ani
from matplotlib import cm
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_toptest/test/apalachee_coupled/'

savepath = './'

ocsst = nc.Dataset(datapath + 'ocsst.nc')

steps = [0, 36, 73, 109, 146, 182, 219, 255, 292, 328, 365]
ek_vel = ocsst['wekt'][steps, :, :]
time = ek_vel.shape[0]

ek_av = np.einsum('ijk->jk', np.array(ocsst['wekt'])) / time

name = 'ek_av_oc'
ek_av = utils.ContourData(ek_av[np.newaxis, :, :], name=name)
[fig, ax] = ek_av.init_frame('Ekman Velocity ($ms^{-1}$)', True)
ek_av.take_snapshots(1, 1, savepath, True)

name = 'ek_oc'
ek = utils.ContourData(ek_vel[:, :, :], name=name)
[fig, ax] = ek.init_frame('Ekman Velocity ($ms^{-1}$)', True)
ek.take_snapshots(1, 365, savepath, True)
Exemple #8
0
from matplotlib import cm
from input_parameters import fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_210_b/'

# Files that describe oceanic and atmospheric state
atpa = nc.Dataset(datapath + 'atpa.nc')
ocpo = nc.Dataset(datapath + 'ocpo.nc')

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

p_oc = ocpo.variables['p'][steps, :, :, :]
p_at = atpa.variables['p'][steps, :, :, :]

f0 = fnot

savepath = './'
for i in range(2):
    for j in range(3):
        if i == 0:
            name = 'P_oc' + '_b_' + str(j + 1)
            p = utils.ContourData(p_oc[:, j, :, :], name=name)
            [fig, ax] = p.init_frame('Pressure ($m^2s^{-2}$)', True)
            p.take_snapshots(1, 365, savepath, True)
        else:
            name = 'P_at' + '_b_' + str(j + 1)
            p = utils.ContourData(p_at[:, j, :, :], name=name)
            [fig, ax] = p.init_frame('Pressure ($m^2s^{-2}$)', False)
            p.take_snapshots(1, 365, savepath, False)
Exemple #9
0
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.animation as ani
from matplotlib import cm
# from input_parameters import rhoat, rhooc, fnot
import utils as utils

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_210_b/'

ocsst = nc.Dataset(datapath + 'ocsst.nc')

steps = [0, 36, 73, 109, 146, 182, 219, 255, 292, 328, 365]
ek_vel = ocsst['wekt'][steps, :, :]
time = ek_vel.shape[0]

ek_av = np.einsum('ijk->jk',np.array(ocsst['wekt'])/time

name = 'ek_av_oc'
ek_av = utils.ContourData(ek_av[np.newaxis, :, :], name=name)
[fig, ax] = ek_av.init_frame('Ekman Velocity ($ms^{-1}$)', True)
ek_av.take_snapshots(1, 1, savepath, True)

name = 'ek_oc'
ek = utils.ContourData(ek_vel[:, :, :], name=name)
[fig, ax] = ek.init_frame('Ekman Velocity ($ms^{-1}$)', True)
ek.take_snapshots(1, 365, savepath, True)
Exemple #10
0
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib import cm
import utils as utils

# plt.rcParams.update({'font.size': 14})
# rc('text', usetex=True)

datapath = '/rds/general/user/rk2014/home/WORK/q-gcm/outdata_toptest/test/NA_atmos_only/'
savepath = './'
topog = nc.Dataset(datapath + 'topog.nc')['dtopat']

# plt.figure()
# plt.contourf(topog[:],100, cmap=cm.jet)
# plt.colorbar()
# plt.show()


top = np.array(topog)
print(top.shape)
name = 'atmos_topog'
top = utils.ContourData(top[np.newaxis, :, :], name=name)


[fig, ax] = top.init_frame('Height ($m$)', False)
top.take_snapshots(1, 1, savepath, False)