Пример #1
0
            precipOBSvals[i] = precipOBSvals[i] + precipOBSvals[i - 1]
        if (i == num - 1):
            precip_vals = precip_vals[i]
            precipOBSvals = precipOBSvals[i]

    diff = precip_vals - precipOBSvals
    t2a = time.clock()
    t3a = round(t2a - t1a, 3)
    print(repr(t3a) + " seconds to read all gribs msgs!")

    ###################################################
    #       START PLOTTING FOR EACH DOMAIN            #
    ###################################################

    #Use gempak color table for precipitation
    gemlist = ncepy.gem_color_list()
    # Use gempak fline color levels from pcp verif page
    pcplist = [23, 22, 21, 20, 19, 10, 17, 16, 15, 14, 29, 28, 24, 25]
    #Extract these colors to a new list for plotting
    pcolors = [gemlist[i] for i in pcplist]

    for dom in domains:
        t1dom = time.clock()
        print('Working on ' + dom)

        # create figure and axes instances
        fig = plt.figure(figsize=(11, 11))
        ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])

        # create LCC basemap instance and set the dimensions
        #llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat,res=ncepy.corners_res(dom)
Пример #2
0
m.drawcoastlines()
m.drawstates()
m.drawcountries()
# draw parallels.
parallels = np.arange(0.,90,10.)
m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)
# draw meridians
meridians = np.arange(180.,360.,10.)
m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
#ny = data.shape[0]; nx = data.shape[1]
#lons, lats = m.makegrid(nx, ny) # get lat/lons of ny by nx evenly space grid.
#x, y = m(lons, lats) # compute map proj coordinates.
# draw filled contours.
clevs = [0,0.1,2,5,10,15,20,25,35,50,75,100,125,150,175]
#Use gempak color table for precipitation
gemlist=gem_color_list()
pcplist=[31,23,22,21,20,19,10,17,16,15,14,29,28,24,25]
#Extract these colors to a new list for plotting
pcolors=[gemlist[i] for i in pcplist]
# Set up the colormap and normalize it so things look nice
mycmap=matplotlib.colors.ListedColormap(pcolors)
norm = matplotlib.colors.BoundaryNorm(clevs, mycmap.N)

cs = m.contourf(lons,lats,data,clevs,cmap=mycmap,norm=norm,latlon=True)
# add colorbar.
cbar = m.colorbar(cs,location='bottom',pad="5%")
cbar.set_label('mm')
# add title
plt.title(infile)
#plt.show()
plt.savefig(infile+'.png',bbox_inches='tight')
Пример #3
0
def gemplot(clist):
    gemlist = ncepy.gem_color_list()
    colors = [gemlist[i] for i in clist]
    cm = matplotlib.colors.ListedColormap(colors)
    return cm