示例#1
0
文件: ecmwf.py 项目: NicWayand/WEM
    def plot(self,va,lv,times,**kwargs):
        for t in times:

            fig = plt.figure()
            data = self.get(va,lv,t)
            m, x, y = self.basemap_setup()

            if 'scale' in kwargs:   
                S = kwargs['scale']
                f1 = m.contour(x,y,data,S,colors='k')
            else:
                f1 = m.contour(x,y,data,colors='k')

            if self.C.plot_titles:
                title = utils.string_from_time('title',t)
                plt.title(title)

            if 'wind_overlay' in kwargs:
                jet = kwargs['wind_overlay']
                wind = self.get('wind',lv,t)
                windplot = m.contourf(x,y,wind,jet,alpha=0.6)
                plt.colorbar(windplot)

            elif 'W_overlay' in kwargs:
                Wscale = kwargs['W_overlay']
                W = self.get('W',lv,t)
                windplot = m.contourf(x,y,W,alpha=0.6)
                plt.colorbar(windplot)


            # if self.C.colorbar:
                # plt.colorbar(orientation='horizontal')

            datestr = utils.string_from_time('output',t)
            fname = '_'.join(('ECMWF',va,str(lv),datestr)) + '.png'

            print("Plotting {0} at {1} for {2}".format(
                        va,lv,datestr))

            plt.clabel(f1, inline=1, fmt='%4u', fontsize=12, colors='k')

            utils.trycreate(self.C.output_root)
            plt.savefig(os.path.join(self.C.output_root,fname))
            plt.clf()
            plt.close()
示例#2
0
文件: ecmwf.py 项目: wf835334/WEM
    def plot(self, va, lv, times, **kwargs):
        for t in times:

            fig = plt.figure()
            data = self.get(va, lv, t)
            m, x, y = self.basemap_setup()

            if 'scale' in kwargs:
                S = kwargs['scale']
                f1 = m.contour(x, y, data, S, colors='k')
            else:
                f1 = m.contour(x, y, data, colors='k')

            if self.C.plot_titles:
                title = utils.string_from_time('title', t)
                plt.title(title)

            if 'wind_overlay' in kwargs:
                jet = kwargs['wind_overlay']
                wind = self.get('wind', lv, t)
                windplot = m.contourf(x, y, wind, jet, alpha=0.6)
                plt.colorbar(windplot)

            elif 'W_overlay' in kwargs:
                Wscale = kwargs['W_overlay']
                W = self.get('W', lv, t)
                windplot = m.contourf(x, y, W, alpha=0.6)
                plt.colorbar(windplot)

            # if self.C.colorbar:
            # plt.colorbar(orientation='horizontal')

            datestr = utils.string_from_time('output', t)
            fname = '_'.join(('ECMWF', va, str(lv), datestr)) + '.png'

            print("Plotting {0} at {1} for {2}".format(va, lv, datestr))

            plt.clabel(f1, inline=1, fmt='%4u', fontsize=12, colors='k')

            utils.trycreate(self.C.output_root)
            plt.savefig(os.path.join(self.C.output_root, fname))
            plt.clf()
            plt.close()
示例#3
0
        elif p == 1 and not verifplot and ex is not "ICBC":
            img = M.image.imread(fpath)
            ax.imshow(img)
        elif (p == 2) & (ex != "ICBC"):
            img = M.image.imread(fpath)
            ax.imshow(img)
        else:
            try:
                img = M.image.imread(fpath)
            except:
                print("Skipping ", panel)
            else:
                print("Plotting ", panel)
                ax.imshow(img)
        ax.axis("off")
        plt.title(panel)

    # pdb.set_trace()
    if ex == "STCH":
        outfiledir = os.path.join(config.output_root, case_str, IC, ens, MP)
    else:
        outfiledir = os.path.join(config.output_root, case_str, IC, ens)

    outfilename = "_".join(("postage", ex, va_str, lv_str, time_str)) + ".png"
    outfilepath = os.path.join(outfiledir, outfilename)
    print(outfilepath)
    utils.trycreate(outfiledir)
    # plt.tight_layout()
    fig.savefig(outfilepath)
    fig.clf()
示例#4
0
                print("Verif skipped")
        elif p == 1 and not verifplot and ex is not 'ICBC':
            img = M.image.imread(fpath)
            ax.imshow(img)
        elif (p == 2) & (ex != 'ICBC'):
            img = M.image.imread(fpath)
            ax.imshow(img)
        else:
            try:
                img = M.image.imread(fpath)
            except:
                print("Skipping ", panel)
            else:
                print("Plotting ", panel)
                ax.imshow(img)
        ax.axis('off')
        plt.title(panel)

    #pdb.set_trace()
    if ex == 'STCH':
        outfiledir = os.path.join(config.output_root, case_str, IC, ens, MP)
    else:
        outfiledir = os.path.join(config.output_root, case_str, IC, ens)

    outfilename = '_'.join(('postage', ex, va_str, lv_str, time_str)) + '.png'
    outfilepath = os.path.join(outfiledir, outfilename)
    print(outfilepath)
    utils.trycreate(outfiledir)
    #plt.tight_layout()
    fig.savefig(outfilepath)
    fig.clf()