コード例 #1
0
ファイル: mapping.py プロジェクト: marcelorodriguesss/pycmbs
    def _draw_zonal_plot(self, timmean=True, vmin=None, vmax=None,
                         fontsize=8):
        """
        calculate zonal statistics and add to zonal axis

        Parameters
        ----------
        timmean : bool
            temporal mean for zonal plot [default=True]
        vmin : float
            minimum value for zonal plot
        vmax : float
            maximum value for zonal plot
        """

        ZP = ZonalPlot(ax=self.zax, dir='y')

        if self.x.ndim == 2:
            pass
        elif self.x.ndim == 3:
            nt, ny, nx = self.x.shape

        ZP.plot(self.x, timmean=timmean, show_ylabel=False)

        # set limits
        if ((vmin is None) & (vmax is None)):
            vmin = self.zax.get_xlim()[0]
            vmax = self.zax.get_xlim()[1]
            # symmetry if neg. and positive limits
            if (vmin < 0.) & (vmax > 0.):
                val = max(abs(vmin), abs(vmax))
                vmin = -val
                vmax = val

        if vmin is None:
            vmin = self.zax.get_xlim()[0]
        if vmax is None:
            vmax = self.zax.get_xlim()[1]
        self.zax.set_xlim(vmin, vmax)

        # set only first and last label
        self.zax.set_xticks([vmin, vmax])
        self.zax.plot([0, 0], self.zax.get_ylim(), linestyle='-',
                      color='grey')

        for tick in self.zax.xaxis.get_major_ticks():
            tick.label.set_fontsize(fontsize)
コード例 #2
0
    def _draw_zonal_plot(self, timmean=True, vmin=None, vmax=None,
                         fontsize=8):
        """
        calculate zonal statistics and add to zonal axis

        Parameters
        ----------
        timmean : bool
            temporal mean for zonal plot [default=True]
        vmin : float
            minimum value for zonal plot
        vmax : float
            maximum value for zonal plot
        """

        ZP = ZonalPlot(ax=self.zax, dir='y')

        if self.x.ndim == 2:
            pass
        elif self.x.ndim == 3:
            nt, ny, nx = self.x.shape

        ZP.plot(self.x, timmean=timmean, show_ylabel=False)

        # set limits
        if ((vmin is None) & (vmax is None)):
            vmin = self.zax.get_xlim()[0]
            vmax = self.zax.get_xlim()[1]
            # symmetry if neg. and positive limits
            if (vmin < 0.) & (vmax > 0.):
                val = max(abs(vmin), abs(vmax))
                vmin = -val
                vmax = val

        if vmin is None:
            vmin = self.zax.get_xlim()[0]
        if vmax is None:
            vmax = self.zax.get_xlim()[1]
        self.zax.set_xlim(vmin, vmax)

        # set only first and last label
        self.zax.set_xticks([vmin, vmax])
        self.zax.plot([0, 0], self.zax.get_ylim(), linestyle='-',
                      color='grey')

        for tick in self.zax.xaxis.get_major_ticks():
            tick.label.set_fontsize(fontsize)
コード例 #3
0
map_plot(R, use_basemap=True, ax=ax1)
map_plot(S, use_basemap=True, ax=ax2)
map_plot(I, use_basemap=True, ax=ax3)
map_plot(P, use_basemap=True, ax=ax4)
f.suptitle('Example of temporal correlation analysis results', size=20)


print 'Calculate climatology and plot ...'
# get_climatology() returns 12 values which are then used for plotting
map_season(D.get_climatology(return_object=True), use_basemap=True, vmin=-20., vmax=30.)

print 'Map difference between datasets ...'
map_difference(D, P)

print 'ZonalPlot ...'
Z=ZonalPlot()
Z.plot(D)

#~ print 'Hovmoeller diagrams ...'
#~ hm = HovmoellerPlot(D)
#~ hm.plot(climits=[-20.,30.])

#~ print '... generate Hovmoeller plot from deseasonalized anomalies'
#~ ha=HovmoellerPlot(D.get_deseasonalized_anomaly(base='all'))
#~ ha.plot(climits=[-2.,2.], cmap='RdBu_r')

plt.show()
r = raw_input("Press Enter to continue...")

plt.close('all')
コード例 #4
0
 def test_ZonalPlot(self):
     Z = ZonalPlot()
     Z.plot(self.D)
コード例 #5
0
ファイル: test_plots.py プロジェクト: zengeo/pycmbs
 def test_ZonalPlot(self):
     Z = ZonalPlot()
     Z.plot(self.D)
コード例 #6
0
map_plot(I, use_basemap=True, ax=ax3)
map_plot(P, use_basemap=True, ax=ax4)
f.suptitle('Example of temporal correlation analysis results', size=20)

print 'Calculate climatology and plot ...'
# get_climatology() returns 12 values which are then used for plotting
map_season(D.get_climatology(return_object=True),
           use_basemap=True,
           vmin=-20.,
           vmax=30.)

print 'Map difference between datasets ...'
map_difference(D, P)

print 'ZonalPlot ...'
Z = ZonalPlot()
Z.plot(D)

#~ print 'Hovmoeller diagrams ...'
#~ hm = HovmoellerPlot(D)
#~ hm.plot(climits=[-20.,30.])

#~ print '... generate Hovmoeller plot from deseasonalized anomalies'
#~ ha=HovmoellerPlot(D.get_deseasonalized_anomaly(base='all'))
#~ ha.plot(climits=[-2.,2.], cmap='RdBu_r')

plt.show()
r = raw_input("Press Enter to continue...")

plt.close('all')