# -*- coding: utf-8 -*- """ This file is part of pyCMBS. (c) 2012- Alexander Loew For COPYING and LICENSE details, please refer to the LICENSE file """ from pycmbs.data import Data from pycmbs.plots import HovmoellerPlot import matplotlib.pyplot as plt import numpy as np import datetime file_name = '../../../pycmbs/examples/example_data/air.mon.mean.nc' A = Data(file_name, 'air', lat_name='lat', lon_name='lon', read=True, label='air temperature') # a quick plot as well as a projection plot H = HovmoellerPlot(A) H.plot(climits=(-20., 20.)) H.ax.set_yticks([]) H.ax.set_ylabel('lat') plt.show()
def test_Hovmoeller(self): H = HovmoellerPlot(self.D) with self.assertRaises(ValueError): H.plot() H.plot(climits=[0., 1.])
print 'ZonalPlot ...' Z=ZonalPlot() Z.plot(D) print 'Some LinePlot' L=LinePlot(regress=True, title='This is a LinePlot with regression') L.plot(D, label='2m air temperature') L.plot(P, label='Precipitable water', ax=L.ax.twinx(), color='green') # use secondary axis for plotting here L.legend() print 'Scatterplot between different variables ...' S=ScatterPlot(D) # scatterplot is initialized with definition of X-axis object S.plot(P) S.legend() 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')