Beispiel #1
0
'''
import matplotlib.pyplot as plt
import matplotlib as ml
import CESM_utils_plt as utils_plt

plt.ion()  # enable interactive mode
path_fig = '../figures/160711/'

# =======================================================================================
#  Calculated on model grid
# =======================================================================================
# -----------------------------------------------------------------------------------------
# MOC_mgrd_W
fig, ax = utils_plt.plot_MOC(lat_mgrd,
                             ncdat.z_w_top,
                             MOC_mgrd_W,
                             nlevels=10,
                             plttype='pcolor+contour')
plt.plot(lat_mgrd, HT_mgrd_xmax)  # plot seafloor #! it's the T-grid!!!
plt.title('MOC mgrd W')
plt.xlim([-36, 90])
utils_plt.print2pdf(fig, path_fig + 'MOC_mgrd_W')

# -----------------------------------------------------------------------------------------
# dMOC_mgrid_W(in Sv)
fig, ax = utils_plt.plot_MOC(lat_mgrd,
                             db,
                             dMOC_mgrd_W,
                             nlevels=10,
                             plttype='pcolor+contour')
plt.title('dMOC mgrd W (sigma2)')
import CESM_utils_plt as utils_plt

plt.ion() # enable interactive mode
path_fig = '../figures/160711/'




# -----------------------------------------------------------------------------------------
# COMBINATION of MWxint_auxgrd and MOC_auxgrd
fig = plt.figure()
plt.suptitle('density binning from {} to {} in {} steps'.format(dbc.min(), dbc.max(), len(dbc)))

plt.subplot(3,1,1)
plt.title('MOC on depth axis on auxgrd')
ax = utils_plt.plot_MOC(lat_auxgrd, z_w_auxgrd, MOC_auxgrd_W, nlevels=10, plttype='pcolor+contour', to_newfigure=False)
plt.plot(lat_auxgrd,HT_auxgrd_xmax)  				# plot seafloor
plt.xlim([-36,90])

plt.subplot(3,1,2)
plt.title('MW on depth axis longitudinally integrated on auxgrd (in Sv)')
plt.ylabel('depth')
ax = utils_plt.plot_MOC(lat_auxgrd, z_w_auxgrd, MWxint_auxgrd, nlevels=10, plttype='pcolor+contour', to_newfigure=False)
plt.plot(lat_auxgrd,HT_auxgrd_xmax)  				# plot seafloor
plt.xlim([-36,90])

plt.subplot(3,1,3)
plt.plot(lat_auxgrd, np.nansum(MWxint_auxgrd,axis=0), '.-k')
plt.colorbar()
plt.xlim([-36,90])
plt.ylabel('sum over whole density-axis (in Sv)')
import CESM_utils_plt as utils_plt

plt.ion()  # enable interactive mode
path_fig = '../figures/160711/'

# -----------------------------------------------------------------------------------------
# COMBINATION of MWxint_auxgrd and MOC_auxgrd
fig = plt.figure()
plt.suptitle('density binning from {} to {} in {} steps'.format(
    dbc.min(), dbc.max(), len(dbc)))

plt.subplot(3, 1, 1)
plt.title('MOC on depth axis on auxgrd')
ax = utils_plt.plot_MOC(lat_auxgrd,
                        z_w_auxgrd,
                        MOC_auxgrd_W,
                        nlevels=10,
                        plttype='pcolor+contour',
                        to_newfigure=False)
plt.plot(lat_auxgrd, HT_auxgrd_xmax)  # plot seafloor
plt.xlim([-36, 90])

plt.subplot(3, 1, 2)
plt.title('MW on depth axis longitudinally integrated on auxgrd (in Sv)')
plt.ylabel('depth')
ax = utils_plt.plot_MOC(lat_auxgrd,
                        z_w_auxgrd,
                        MWxint_auxgrd,
                        nlevels=10,
                        plttype='pcolor+contour',
                        to_newfigure=False)
plt.plot(lat_auxgrd, HT_auxgrd_xmax)  # plot seafloor
# =============================================================================

lat_mgrd = ncdat.TLAT.isel(
    nlon=0)  # mean of LAT for each j #! very inappropriate

# -----------------------------------------------------------------------------
# BSF on geographical grid calculated by model
fig, map = utils_plt.plot_BSF(BSF.isel(time=0), 'T', nlevels=10)
plt.title('BSF model on T grid')
#utils_plt.print2pdf(fig, 'testfigures/BSF_model_T')
# -----------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOCsel = MOC.isel(time=0)
fig, ax = utils_plt.plot_MOC(MOCsel.lat_aux_grid,
                             MOCsel.moc_z,
                             MOCsel,
                             nlevels=40,
                             plttype='pcolor+contour')
plt.plot(lat_mgrd, HT_auxgrd_xmax)  # plot seafloor
plt.title('MOC model')
plt.xlim([-36, 90])
#utils_plt.print2pdf(fig, path_figs+'MOC_model')

# =============================================================================
#  Streamfunction Indices
# =============================================================================

# -----------------------------------------------------------------------------
# BSF on geographical grid calculated by model
fig, map = utils_plt.plot_BSF(corrBSFidx, 'T', nlevels=10)
plt.title('BSF model on T grid')
# x-axes
lat_mgrd = ncdat.TLAT.isel(
    nlon=0)  # mean of LAT for each j #! very inappropriate
ax_long = np.arange(len(lat_mgrd))  # lat_mgrd

# y-axes
ax_vol = ax_vol_glob
ticks_vol = ticks_vol_glob

# dMOC_mgrd_V (in Sv)
# --stretch---------------------------------------
fig, ax = utils_plt.plot_MOC(ax_long,
                             ax_vol,
                             dMOCm,
                             min,
                             max,
                             nlevels_col,
                             levels_cont,
                             plttype='pcolor+contour',
                             to_subplot=[2, 2, 1])
#plt.xlim([-36,73])
plt.title('dMOC mgrd (stretch)')
plt.xlim([81, 383])
plt.yticks(ticks_vol)
plt.gca().set_yticklabels(ticks_dens_rd)
# --linear----------------------------------------
fig, ax = utils_plt.plot_MOC(ax_long,
                             DBc,
                             dMOCm,
                             min,
                             max,
# =======================================================================================
#  CCSM4 representations
# =======================================================================================
# -----------------------------------------------------------------------------------------
# BSF on geographical grid calculated by model
BSF_model = utils_mask.mask_ATLANTIC(ncdat.BSF.isel(time=0), ncdat.REGION_MASK)
fig, map = utils_plt.plot_BSF(BSF_model, 'T', nlevels=10)
plt.title('BSF model on T grid')
utils_plt.print2pdf(fig, path_fig + 'BSF_model_T')
# -----------------------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOC_model = ncdat.MOC.isel(time=0, transport_reg=1, moc_comp=0)
#MOC_model = MOC_model - MOC_model[:,-1] # normalisation
fig, ax = utils_plt.plot_MOC(MOC_model.lat_aux_grid,
                             MOC_model.moc_z,
                             MOC_model,
                             nlevels=10,
                             plttype='pcolor+contour')
plt.plot(lat_auxgrd, HT_auxgrd_xmax)  # plot seafloor
plt.title('MOC model')
plt.xlim([-36, 90])
utils_plt.print2pdf(fig, path_fig + 'MOC_model')

# =======================================================================================
#  Calculated on model grid
# =======================================================================================
# -----------------------------------------------------------------------------------------
# BSF on model grid
fig, map = utils_plt.plot_BSF(BSF_mgrd, 'U', nlevels=100)
plt.title('BSF mgrd on U grid')
utils_plt.print2pdf(fig, 'testfigures/BSF_mgrd_U')

# =======================================================================================
#  CCSM4 representations
# =======================================================================================
# -----------------------------------------------------------------------------------------
# BSF on geographical grid calculated by model
BSF_model = utils_mask.mask_ATLANTIC(ncdat.BSF.isel(time=0), ncdat.REGION_MASK)
fig, map = utils_plt.plot_BSF(BSF_model, 'T', nlevels = 10)
plt.title('BSF model on T grid')
utils_plt.print2pdf(fig, path_fig+'BSF_model_T')
# -----------------------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOC_model = ncdat.MOC.isel(time=0, transport_reg=1, moc_comp=0)
#MOC_model = MOC_model - MOC_model[:,-1] # normalisation
fig, ax = utils_plt.plot_MOC(MOC_model.lat_aux_grid, MOC_model.moc_z, MOC_model, nlevels=10, plttype='pcolor+contour')
plt.plot(lat_auxgrd,HT_auxgrd_xmax) 				# plot seafloor
plt.title('MOC model')
plt.xlim([-36,90])
utils_plt.print2pdf(fig, path_fig+'MOC_model')

# =======================================================================================
#  Calculated on model grid
# =======================================================================================
# -----------------------------------------------------------------------------------------
# BSF on model grid
fig, map = utils_plt.plot_BSF(BSF_mgrd, 'U', nlevels=100)
plt.title('BSF mgrd on U grid')
utils_plt.print2pdf(fig, 'testfigures/BSF_mgrd_U')
# -----------------------------------------------------------------------------------------
# MOC_mgrd_W
method = '0'
dMOCm = dMOC_mgrd_V_0
dMOCaux = dMOC_auxgrd_V_0

# x-axes
lat_mgrd = ncdat.TLAT.isel(nlon=0)          # mean of LAT for each j #! very inappropriate
ax_long = np.arange(len(lat_mgrd)) # lat_mgrd

# y-axes
ax_vol = ax_vol_glob
ticks_vol = ticks_vol_glob


# dMOC_mgrd_V (in Sv)
# --stretch---------------------------------------
fig, ax = utils_plt.plot_MOC(ax_long, ax_vol, dMOCm, min, max, nlevels_col, levels_cont, plttype='pcolor+contour', to_subplot=[2,2,1])
#plt.xlim([-36,73])
plt.title('dMOC mgrd (stretch)')
plt.xlim([81,383])
plt.yticks(ticks_vol)
plt.gca().set_yticklabels(ticks_dens_rd)
# --linear----------------------------------------
fig, ax = utils_plt.plot_MOC(ax_long, DBc, dMOCm, min, max, nlevels_col, levels_cont, plttype='pcolor+contour', to_newfig=False, to_subplot=[2,2,2])
plt.title('dMOC mgrd (linear)')
plt.xlim([81,383])
plt.ylim([38,30])

# dMOCaux (in Sv)
# --stretch---------------------------------------
fig, ax = utils_plt.plot_MOC(lat_auxgrd, ax_vol, dMOCaux, min, max, nlevels_col, levels_cont, plttype='pcolor+contour', to_newfig=False, to_subplot=[2,2,3])
plt.title('dMOC auxgrd (stretch)')
Beispiel #9
0
TODO: 	 add '.values' where possible to speed up code.

'''
import matplotlib.pyplot as plt
import matplotlib as ml
import CESM_utils_plt as utils_plt

plt.ion() # enable interactive mode
path_fig = '../figures/160711/'

# =======================================================================================
#  Calculated on model grid
# =======================================================================================
# -----------------------------------------------------------------------------------------
# MOC_mgrd_W
fig, ax = utils_plt.plot_MOC(lat_mgrd, ncdat.z_w_top, MOC_mgrd_W, nlevels=10, plttype='pcolor+contour')
plt.plot(lat_mgrd,HT_mgrd_xmax) 				# plot seafloor #! it's the T-grid!!!
plt.title('MOC mgrd W')
plt.xlim([-36,90])
utils_plt.print2pdf(fig, path_fig+'MOC_mgrd_W')

# -----------------------------------------------------------------------------------------
# dMOC_mgrid_W(in Sv)
fig, ax = utils_plt.plot_MOC(lat_mgrd, db, dMOC_mgrd_W, nlevels=10, plttype='pcolor+contour')
plt.title('dMOC mgrd W (sigma2)')
plt.suptitle('density binning from {} to {} in {} steps'.format(dbc.min(), dbc.max(), len(dbc)))
plt.xlim([-36,73])
plt.yticks(ticks_vol)
plt.gca().set_yticklabels(ticks_dens)
#utils_plt.print2pdf(fig, path_fig+'dMOC_mgrd_W_sig2')
Beispiel #10
0
'''
import matplotlib.pyplot as plt
import matplotlib as ml
import CESM_utils_plt as utils_plt

plt.ion() # enable interactive mode
path_fig = '../figures/160711/'


# =======================================================================================
#  Calculated on model grid
# =======================================================================================
# -----------------------------------------------------------------------------------------
# MOC_mgrd_V
fig, ax = utils_plt.plot_MOC(lat_mgrd, ncdat.z_t, MOC_mgrd_V, nlevels=100, plttype='pcolor+contour')
plt.plot(lat_mgrd,HT_mgrd_xmax)				# plot seafloor
plt.title('MOC mgrd V')
plt.xlim([-36,90])
 #utils_plt.print2pdf(fig, path_fig+'MOC_mgrd_V')
# -----------------------------------------------------------------------------------------
# dMOC_mgrid_V (in Sv)
fig, ax = utils_plt.plot_MOC(lat_mgrd, dbc, dMOC_mgrd_V, nlevels=10, plttype='pcolor+contour')
plt.title('dMOC mgrd W (sigma2)')
plt.suptitle('density binning from {} to {} in {} steps'.format(dbc.min(), dbc.max(), len(dbc)))
plt.xlim([-36,73])
plt.yticks(ticks_vol_glob)
plt.gca().set_yticklabels(ticks_dens)
#utils_plt.print2pdf(fig, path_fig+'dMOC_mgrd_V_sig2')

# =======================================================================================
Beispiel #11
0
# -----------------------------------------------------------------------------------------
# BSF on geographical grid calculated by model
BSF_model = utils_mask.mask_ATLANTIC(ncdat.BSF.isel(time=0), ncdat.REGION_MASK)
fig, map = utils_plt.plot_BSF(BSF_model, 'T', nlevels = 10)
plt.title('BSF model on T grid')
utils_plt.print2pdf(fig, path_fig+'BSF_model_T')
# -----------------------------------------------------------------------------------------
# BSF on model grid
fig, map = utils_plt.plot_BSF(BSF_mmgrd, 'U', nlevels=100)
plt.title('BSF mgrd on U grid')
utils_plt.print2pdf(fig, 'testfigures/BSF_mgrd_U')
# -----------------------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOC_model = ncdat.MOC.isel(time=0, transport_reg=1, moc_comp=0)
#MOC_model = MOC_model - MOC_model[:,-1] # normalisation
fig, ax = utils_plt.plot_MOC(MOC_model.lat_aux_grid, MOC_model.moc_z, MOC_model, nlevels=10, plttype='pcolor+contour')
plt.plot(lat_auxgrd,HT_auxgrd_xmax) 				# plot seafloor
plt.title('MOC model')
plt.xlim([-36,90])
utils_plt.print2pdf(fig, path_fig+'MOC_model')


# =======================================================================================
#  Other variables
# =======================================================================================
# -----------------------------------------------------------------------------------------
# Seafloor
fig, ax = plt.contourf(ncdat.HT.roll(nlon=54), levels=np.linspace(0,560000,100))
plt.title('Depth of Seafloor')
fig, map = utils_plt.pcolor_basemap(MW_mgrd.roll(nlon=54).mean(dim='z_w_top'), 'T', nlevels=100,)
fig, map = utils_plt.pcolor_basemap(MW_mgrd.roll(nlon=54).mean(dim='z_w_top'), 'T', nlevels=100,)
Beispiel #12
0
BSF_model = utils_mask.mask_ATLANTIC(ncdat.BSF.isel(time=0), ncdat.REGION_MASK)
fig, map = utils_plt.plot_BSF(BSF_model, 'T', nlevels=10)
plt.title('BSF model on T grid')
utils_plt.print2pdf(fig, path_fig + 'BSF_model_T')
# -----------------------------------------------------------------------------------------
# BSF on model grid
fig, map = utils_plt.plot_BSF(BSF_mmgrd, 'U', nlevels=100)
plt.title('BSF mgrd on U grid')
utils_plt.print2pdf(fig, 'testfigures/BSF_mgrd_U')
# -----------------------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOC_model = ncdat.MOC.isel(time=0, transport_reg=1, moc_comp=0)
#MOC_model = MOC_model - MOC_model[:,-1] # normalisation
fig, ax = utils_plt.plot_MOC(MOC_model.lat_aux_grid,
                             MOC_model.moc_z,
                             MOC_model,
                             nlevels=10,
                             plttype='pcolor+contour')
plt.plot(lat_auxgrd, HT_auxgrd_xmax)  # plot seafloor
plt.title('MOC model')
plt.xlim([-36, 90])
utils_plt.print2pdf(fig, path_fig + 'MOC_model')

# =======================================================================================
#  Other variables
# =======================================================================================
# -----------------------------------------------------------------------------------------
# Seafloor
fig, ax = plt.contourf(ncdat.HT.roll(nlon=54),
                       levels=np.linspace(0, 560000, 100))
plt.title('Depth of Seafloor')
# =============================================================================
#  Streamfunctions
# =============================================================================

lat_mgrd = ncdat.TLAT.isel(nlon=0)          # mean of LAT for each j #! very inappropriate

# -----------------------------------------------------------------------------
# BSF on geographical grid calculated by model
fig, map = utils_plt.plot_BSF(BSF.isel(time=0), 'T', nlevels = 10)
plt.title('BSF model on T grid')
 #utils_plt.print2pdf(fig, 'testfigures/BSF_model_T')
# -----------------------------------------------------------------------------
# MOC on geographical grid calculated by model
MOCsel = MOC.isel(time=0)
fig, ax = utils_plt.plot_MOC(MOCsel.lat_aux_grid, MOCsel.moc_z, MOCsel, nlevels=40, plttype='pcolor+contour')
plt.plot(lat_mgrd, HT_auxgrd_xmax) 				# plot seafloor
plt.title('MOC model')
plt.xlim([-36,90])
 #utils_plt.print2pdf(fig, path_figs+'MOC_model')

# =============================================================================
#  Streamfunction Indices
# =============================================================================


# -----------------------------------------------------------------------------
# BSF on geographical grid calculated by model
fig, map = utils_plt.plot_BSF(corrBSFidx, 'T', nlevels = 10)
plt.title('BSF model on T grid')
 #utils_plt.print2pdf(fig, 'testfigures/BSF_model_T')