Exemple #1
0
m2 = Basemap(projection='npaeqd', lon_0=0., boundinglat=60, resolution='l')
m3 = Basemap(projection='spaeqd', lon_0=180., boundinglat=-50, resolution='l')
refdate = 1
for i in range(len(iter)):

    if len(iter) == 1: tmp = sq(d[vind, :, :])
    else: tmp = sq(d[i, vind, :, :])

    daysSinceRefDate = iter[i] / 3
    yearsSinceRefDate = daysSinceRefDate / 365
    monthsSinceRefDate = round(np.mod(daysSinceRefDate, 365) / (365. / 12.))
    mydate = "%04i/%02i" % (refdate + yearsSinceRefDate, monthsSinceRefDate)
    print "iteration[%i] = %i, %s" % (i, iter[i], mydate)
    fig.clf()
    fig.add_subplot(2, 1, 1)
    lh = llc.pcol(xg, yg, tmp, m1, vmax=vmax)
    plt.colorbar()  #orientation='horizontal')
    m1.drawcoastlines(color='k')
    plt.title(
        "%s: time step %06i, %s, min/max= %5.2f/%5.2f" %
        (mydir, iter[i], mydate, round(tmp.min(), 2), round(tmp.max(), 2)))

    fig.add_subplot(2, 2, 3)
    lh = llc.pcol(xg, yg, tmp, m3, vmax=vmax)
    #    m3.drawmapboundary(fill_color='w')
    #    m3.fillcontinents(color='k',lake_color='g',alpha=0.1)
    m3.drawcoastlines(color='k')

    fig.add_subplot(2, 2, 4)
    lh = llc.pcol(xg, yg, tmp, m2, vmax=vmax)
    #    m2.drawmapboundary(fill_color='w')
Exemple #2
0
m2 = Basemap(projection='npaeqd', lon_0=0., boundinglat=60, resolution='l')
m3 = Basemap(projection='spaeqd', lon_0=180., boundinglat=-50, resolution='l')
refdate = 1908
for i in range(len(iter)):

    if len(iter) == 1: tmp = sq(d2[vind, :, :] - d[vind, :, :])
    else: tmp = sq(d2[i, vind, :, :] - d[i, vind, :, :])

    daysSinceRefDate = iter[i] / 3
    yearsSinceRefDate = daysSinceRefDate / 365
    monthsSinceRefDate = round(np.mod(daysSinceRefDate, 365) / (365. / 12.))
    mydate = "%04i/%02i" % (refdate + yearsSinceRefDate, monthsSinceRefDate)
    print "iteration[%i] = %i, %s" % (i, iter[i], mydate)
    fig.clf()
    fig.add_subplot(2, 1, 1)
    lh1 = llc.pcol(xg, yg, tmp, m1)
    plt.colorbar()  #orientation='horizontal')
    m1.drawcoastlines(color='k')
    plt.title(
        "%s: time step %06i, %s, min/max= %5.2f/%5.2f" %
        (mydir, iter[i], mydate, round(tmp.min(), 2), round(tmp.max(), 2)))

    fig.add_subplot(2, 2, 3)
    lh3 = llc.pcol(xg, yg, tmp, m3)
    #    m3.drawmapboundary(fill_color='w')
    #    m3.fillcontinents(color='k',lake_color='g',alpha=0.1)
    m3.drawcoastlines(color='k')

    fig.add_subplot(2, 2, 4)
    lh2 = llc.pcol(xg, yg, tmp, m2)
    #    m2.drawmapboundary(fill_color='w')
Exemple #3
0
    var = fld2 - fld**2
    return np.where(var < 0., 0, np.sqrt(var))


fig, ax = plt.subplots(5,
                       2,
                       sharex=True,
                       sharey=True,
                       squeeze=True,
                       figsize=(8, 10))

csf = np.copy(ax)

ivar = 1  # sea ice thickness
plt.sca(ax[0, 0])
csf[0, 0] = llc.pcol(xg, yg, sq(sip[ivar, :, :]))
plt.sca(ax[0, 1])
csf[0, 1] = llc.pcol(xg, yg, sq(siz[ivar, :, :]))
ivar = 4  # MXLDEPTH
plt.sca(ax[1, 0])
csf[1, 0] = llc.pcol(xg, yg, sq(d2p[ivar, :, :]) / grho)
plt.sca(ax[1, 1])
csf[1, 1] = llc.pcol(xg, yg, sq(d2z[ivar, :, :]))
# sea level
# substract mean sea level
etam = (d2p[2, :, :] * lmsk * rac).sum() / (rac * lmsk).sum()
etap = (sq(d2p[2, :, :]) - etam) / gravity
#etam = 0.
plt.sca(ax[2, 0])
csf[2, 0] = llc.pcol(xg, yg, etap)
plt.sca(ax[2, 1])
Exemple #4
0
# Difference plots
fig = plt.figure(figsize=(10, 11))

labels = [
    'old si code', 'old adx code', 'new adx code', 'n a c + flooding',
    'n a c + plumes', 'n a c + flood + plumes'
]

for i in range(5):
    # Differences in Concentration NH
    fig.add_subplot(5, 4, 1 + i * 4)
    llc.pcol(xg,
             yg,
             np.nanmean(a[0, :, :, :] - a[i + 1, :, :, :], axis=0) * 100,
             mnh,
             cmap=plt.get_cmap('coolwarm'),
             vmax=10,
             vmin=-10)
    mnh.drawcoastlines()
    plt.colorbar()
    plt.gca().set_title('diff conc [%] NH')
    plt.gca().set_ylabel(labels[i + 1])

    # Differences in Concentration SH
    fig.add_subplot(5, 4, 2 + i * 4)
    llc.pcol(xg,
             yg,
             np.nanmean(a[0, :, :, :] - a[i + 1, :, :, :], axis=0) * 100,
             msh,
             cmap=plt.get_cmap('coolwarm'),
Exemple #5
0
#d3=rdmds('diag3Dm',iter)

i = 0
for i in range(1):
    uu = np.mean(f[:, 0, :, :], axis=0)
    vv = np.mean(f[:, 1, :, :], axis=0)
    #    uu = np.mean(d3[:,2,1,:,:],axis=0)
    #    vv = np.mean(d3[:,3,1,:,:],axis=0)
    #    uu = np.ma.masked_array(uu,hf[0,:,:]<=0.0)
    #    vv = np.ma.masked_array(vv,hf[0,:,:]<=0.0)
    spd = np.sqrt(uu * uu + vv * vv)
    u, v = Basemap.rotate_vector(m, uu * cs - vv * sn, uu * sn + vv * cs, xc,
                                 yc)

    fig.clf()
    lh = llc.pcol(xg, yg, sq(wspd[i, :, :] * hf[0, :, :]), m)
    m.drawcoastlines(color='k')
    di = 1
    q = m.quiver(xc[::di, ::di],
                 yc[::di, ::di],
                 u[::di, ::di],
                 v[::di, ::di],
                 latlon=True,
                 scale=200,
                 pivot='mid',
                 edgecolor='none',
                 headaxislength=5)
    #                  pivot = 'mid',units = 'x', edgecolor = 'none',headaxislength = 5)

    plt.show()