Ejemplo n.º 1
0
#
#txres             = Ngl.Resources()          # Text resources desired
#txres.txFontHeightF = 0.015

#txres.txFontColor = "OrangeRed"

istart = 356
jstart = 373
iend = 387
jend = 411

for file in lst_file:
    print "Plotting "+file
    nc = netCDF4.Dataset(file, "r")
    temp = nc.variables["temp"][0,:,:,:]
    time = nc.variables["ocean_time"][0]
    myday = jday2date(time/86400.)
#    date_tag = myday.strftime('%d %B %Y')
    date_tag = myday.strftime('%Y_%m_%d')
    print date_tag
    plotout = date_tag + '.png'
#    plot = Ngl.contour_map(wks, aice, res)
#    Ngl.text_ndc(wks, date_tag, 0.85, 0.84, txres)
    plt.clf()
    pyroms_toolbox.transectview(temp, -1, istart, iend, jstart, \
          jend, 'ARCTIC2', outfile=plotout, cmin=-1.8, cmax=10.25)
    nc.close()
#    Ngl.frame(wks)

#Ngl.end()
Ejemplo n.º 2
0
        m.drawmapboundary(fill_color='#99ffff')
        m.fillcontinents(color='0.3', lake_color='0.3')
        #   m.fillcontinents(color='coral',lake_color='aqua')
        idiv = nc.variables["sh_d_hf"][it, :, :]
        aice = nc.variables["aice"][it, :, :]
        idiv = np.where(aice == 0.0, 0.0, idiv)
        idiv *= 1.e5
        cs = m.pcolormesh(x, y, idiv, vmin=-.6, vmax=.6, cmap=cmap)
        #       cs = m.contourf(x, y, idiv, levels=levels, cmap=cmap, extend='both')
        parallels = np.arange(45., 90., 15.)
        # labels = [left,right,top,bottom]
        m.drawparallels(parallels)
        meridians = np.arange(0., 360., 15.)
        m.drawmeridians(meridians, labels=[1, 0, 0, 1])
        #   csa = m.contour(x, y, idiv, levels=levels, linewidths=(1,), colors='k')
        #   csa = m.contour(x, y, idiv, levels=levels, colors=('k',))

        myday = jday2date(times[it] / 24.)
        date_tag = myday.strftime('%d %B %Y')
        plt.title(date_tag, fontsize=20)
        fname = myday.strftime('movie_idiv/frame_%(number)04d.png' %
                               {'number': it})
        print(date_tag)
        cbar = plt.colorbar(cs, orientation='vertical')
        cbar.ax.tick_params(labelsize=15)

        plt.savefig(fname)
        plt.close()

    nc.close()
Ejemplo n.º 3
0
    if plot_grid: plt.plot(x, z.T, 'k')
    #   if plot_grid: plt.plot(x, z.T, 'k', hold=True);
    #   plt.ylim(-700,1)
    plt.ylim(-60, 3)
    cbar = plt.colorbar(cs, orientation='horizontal')
    cbar.ax.tick_params(labelsize=15)
    #plt.xlim(400,600)


times = z_file.variables["time"][:]
ntimes = len(times)
cmap = plt.cm.get_cmap("seismic")
for record in range(ntimes - 10, ntimes):
    #record = -1 # Last record

    myday = jday2date(times[record] / 24.)
    date_tag = myday.strftime('%H:%M, %d %B %Y')
    plt.figure(figsize=(10, 6))
    plt.suptitle(date_tag, fontsize=20)
    #   plt.subplot(1,2,1); plot_section(z_file, record, variable='u', vmin=-2., vmax=2.); plt.title('U');
    #   plt.subplot(1,2,2); plot_section(z_file, record, y=427, variable='v', vmin=-2., vmax=2.); plt.title('V');
    plt.subplot(2, 2, 1)
    plot_section(z_file, record, variable='u', vmin=-2., vmax=2.)
    plt.title('U')
    plt.subplot(2, 2, 2)
    plot_section(z_file, record, y=359, variable='v', vmin=-2., vmax=2.)
    plt.title('V')
    plt.subplot(2, 2, 3)
    plot_section(z_file, record, variable='salt', vmin=None, vmax=None)
    plt.title('salt')
    plt.subplot(2, 2, 4)