Esempio n. 1
0
    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()
Esempio n. 2
0
    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()
Esempio n. 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()
Esempio n. 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()