def test_GlobalMean(self): GM1 = GlobalMeanPlot(climatology=False) self.assertEqual(GM1.nplots, 1) f = plt.figure() ax1 = f.add_subplot(111) axA = f.add_subplot(211) axB = f.add_subplot(212) with self.assertRaises(ValueError): GM2 = GlobalMeanPlot(climatology=True, ax=ax1) GM2 = GlobalMeanPlot(climatology=True, ax=axA, ax1=axB) self.assertEqual(GM2.nplots, 2)
# -*- 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 GlobalMeanPlot import matplotlib.pyplot as plt 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') B = A.copy() B.mulc(2.3, copy=False) # a quick plot as well as a projection plot GM = GlobalMeanPlot() GM.plot(A, label='model A') GM.plot(B, label='model V') GM.ax.grid() GM.ax1.grid() plt.show()
def test_globalmeanplot(self): G = GlobalMeanPlot() with self.assertRaises(ValueError): G.plot(self.D, stat_type='no_stat_type') G.plot(self.D, show_std=True) G.plot_mean_result()