# -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE files
"""
from pycmbs.data import Data
from pycmbs.plots import map_difference
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 = A.get_climatology(return_object=True)
b = B.get_climatology(return_object=True)

# a quick plot as well as a projection plot
f1 = map_difference(a, b, show_stat=False, vmin=-30., vmax=30., dmin=-60., dmax=60.)  # unprojected
plt.show()
Esempio n. 2
0
"""
This file is part of pyCMBS.
(c) 2012- Alexander Loew
For COPYING and LICENSE details, please refer to the LICENSE files
"""
from pycmbs.data import Data
from pycmbs.plots import map_difference
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 = A.get_climatology(return_object=True)
b = B.get_climatology(return_object=True)

# a quick plot as well as a projection plot
f1 = map_difference(a,
                    b,
                    show_stat=False,
                    vmin=-30.,
                    vmax=30.,
                    dmin=-60.,
                    dmax=60.)  # unprojected
plt.show()
Esempio n. 3
0
ax3=f.add_subplot(223)
ax4=f.add_subplot(224)
R,S,I,P = D.temporal_trend(return_object=True)
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...")
Esempio n. 4
0
 def test_map_difference_General(self):
     map_difference(self.D, self.D)
Esempio n. 5
0
 def test_map_difference_General(self):
     map_difference(self.D, self.D)
R, S, I, P = D.temporal_trend(return_object=True)
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...")