예제 #1
0
def plot_BSF(var, TorUgrid, nlevels=100, mappingtoolbox='basemap', proj='ortho', min = [], max = []):
    ''' uses utils_plt.emptyBasemapFig()'''
    # colormap
    if min == []:   min = np.floor(np.nanmin(var)) # minimum value of varin
    if max == []:   max = np.ceil(np.nanmax(var))  # maximum value of varin
    #cmap, norm = utils_plt.get_cmap(min, max, nlevels, scheme=utils_plt.get_viridis()) # viridis
    cmap = utils_plt.shiftCMap(ml.cm.seismic, midpoint=1-max/(max-min), name='shifted') # shifted blue white red

    # add cyclic border (to prevent gap in pcolor plot)
    var = utils_conv.add_cyclic(var)
    # choose U or T grid
    if TorUgrid == 'U':
        xvar = var.ULONG.values
        yvar = var.ULAT.values
    elif TorUgrid == 'T':
        xvar = var.TLONG.values
        yvar = var.TLAT.values
    # draw plot in new figure
    if mappingtoolbox == 'basemap':
        fig, map = utils_plt.emptyBasemapFig(proj)
        c1 = map.pcolor(xvar,yvar,var.values,latlon=True, cmap=cmap, rasterized=True)
        map.colorbar()
    elif mappingtoolbox == 'cartopy':
        fig, map = True, True#TODO
    return(fig, map)
예제 #2
0
def plot_BSF(var,
             TorUgrid,
             nlevels=100,
             mappingtoolbox='basemap',
             proj='ortho',
             min=[],
             max=[]):
    ''' uses utils_plt.emptyBasemapFig()'''
    # colormap
    if min == []: min = np.floor(np.nanmin(var))  # minimum value of varin
    if max == []: max = np.ceil(np.nanmax(var))  # maximum value of varin
    #cmap, norm = utils_plt.get_cmap(min, max, nlevels, scheme=utils_plt.get_viridis()) # viridis
    cmap = utils_plt.shiftCMap(ml.cm.seismic,
                               midpoint=1 - max / (max - min),
                               name='shifted')  # shifted blue white red

    # add cyclic border (to prevent gap in pcolor plot)
    var = utils_conv.add_cyclic(var)
    # choose U or T grid
    if TorUgrid == 'U':
        xvar = var.ULONG.values
        yvar = var.ULAT.values
    elif TorUgrid == 'T':
        xvar = var.TLONG.values
        yvar = var.TLAT.values
    # draw plot in new figure
    if mappingtoolbox == 'basemap':
        fig, map = utils_plt.emptyBasemapFig(proj)
        c1 = map.pcolor(xvar,
                        yvar,
                        var.values,
                        latlon=True,
                        cmap=cmap,
                        rasterized=True)
        map.colorbar()
    elif mappingtoolbox == 'cartopy':
        fig, map = True, True  #TODO
    return (fig, map)
예제 #3
0


# -----------------------------------------------------------------------------
# horizontal plot of Temperatures columnwise integrated over depth/density axis
# -----------------------------------------------------------------------------

# - TEMPERATURE
plt.figure()

T_int = utils_ana.integrate_along_dens(T, ncdat.dz)
#T_dens_int = utils_ana.integrate_along_dens(T_dens[1:-1], ddb)
T_dens_int = utils_ana.integrate_along_dens(T_dens, vol_dbs_col)
min_T = np.nanmin([T_int])
max_T = np.nanmax([T_int])
cmap_T = utils_plt.shiftCMap(ml.cm.seismic, midpoint = 1-max_T/(max_T-min_T), name='shifted')
min_T_dens = np.nanmin([T_dens_int])
max_T_dens = np.nanmax([T_dens_int])
cmap_T_dens = utils_plt.shiftCMap(ml.cm.seismic, midpoint = 1-max_T_dens/(max_T_dens-min_T_dens), name='shifted')

# - plotting
plt.suptitle('Values integrated over columns')
plt.subplot(1,2,1)
plt.imshow(utils_conv.rollATL(T_int), cmap=cmap_T)
plt.colorbar()
#plt.contour(utils_conv.rollATL(T_int), cmap='Reds', levels=np.linspace(-5, 30, 5))
plt.contour(utils_conv.rollATL(ncdat.HT), levels=np.linspace(0,560000,2), cmap='hot') # draw continents
plt.title('Temperature on depth axis')
ax = plt.gca(); ax.invert_yaxis()
print(np.nanmin(T_int), np.nanmax(T_int))
예제 #4
0
plt.legend(loc='best')

# -----------------------------------------------------------------------------
# horizontal plot of Temperatures columnwise integrated over depth/density axis
# -----------------------------------------------------------------------------

# - TEMPERATURE
plt.figure()

T_int = utils_ana.integrate_along_dens(T, ncdat.dz)
#T_dens_int = utils_ana.integrate_along_dens(T_dens[1:-1], ddb)
T_dens_int = utils_ana.integrate_along_dens(T_dens, vol_dbs_col)
min_T = np.nanmin([T_int])
max_T = np.nanmax([T_int])
cmap_T = utils_plt.shiftCMap(ml.cm.seismic,
                             midpoint=1 - max_T / (max_T - min_T),
                             name='shifted')
min_T_dens = np.nanmin([T_dens_int])
max_T_dens = np.nanmax([T_dens_int])
cmap_T_dens = utils_plt.shiftCMap(ml.cm.seismic,
                                  midpoint=1 - max_T_dens /
                                  (max_T_dens - min_T_dens),
                                  name='shifted')

# - plotting
plt.suptitle('Values integrated over columns')
plt.subplot(1, 2, 1)
plt.imshow(utils_conv.rollATL(T_int), cmap=cmap_T)
plt.colorbar()
#plt.contour(utils_conv.rollATL(T_int), cmap='Reds', levels=np.linspace(-5, 30, 5))
plt.contour(utils_conv.rollATL(ncdat.HT),