示例#1
0
# -*- 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 map_season
import matplotlib.pyplot as plt

file_name = '../../../pycmbs/examples/example_data/air.mon.mean.nc'
air = Data(file_name, 'air', lat_name='lat', lon_name='lon', read=True, label='air temperature')
c = air.get_climatology(return_object=True)

# a quick plot as well as a projection plot
f1 = map_season(c, show_stat=False, vmin=-30., vmax=30., cticks=[-30., 0., 30.])  # unprojected
plt.show()
示例#2
0
f=plt.figure()
ax1=f.add_subplot(221)
ax2=f.add_subplot(222)
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')
f = plt.figure()
ax1 = f.add_subplot(221)
ax2 = f.add_subplot(222)
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'))