FV3 Bundle
QgPlot.py
Go to the documentation of this file.
1 # (C) Copyright 2009-2016 ECMWF.
2 #
3 # This software is licensed under the terms of the Apache Licence Version 2.0
4 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 # In applying this licence, ECMWF does not waive the privileges and immunities
6 # granted to it by virtue of its status as an intergovernmental organisation nor
7 # does it submit to any jurisdiction.
8 
9 import numpy as np
10 import matplotlib.pyplot as plt
11 import matplotlib.cm as cm
12 
13 class QgPlot:
14 
15  def plot(self,pv,psi):
16  if (pv.shape != psi.shape):
17  raise "pv.shape != psi.shape"
18 
19  nz,ny,nx=pv.shape
20 
21  x = np.arange(1,nx+1)
22  y = np.arange(1,ny+1)
23 
24  # colour map
25  CM = cm.jet
26 
27  plt.figure()
28 
29  # ================= upper plot (k=0)
30  ax = plt.subplot(2,1,1) # 2 rows, 1 column, first plot
31  ax.set_autoscale_on(False)
32  plt.axis([0, nx+1, 0, ny+1])
33  plt.title("Upper Layer")
34 
35  CSPV = plt.contourf(x,y, pv[0,:,:],20,cmap=CM)
36  CSPSI = plt.contour (x,y,psi[0,:,:],10,colors='k')
37 
38  plt.clabel(CSPSI, fontsize=9, inline=1)
39  CB = plt.colorbar(CSPV)
40 
41  # ================= lower plot (k=1)
42  bx = plt.subplot(2,1,2)
43  bx.set_autoscale_on(False)
44  plt.axis([0, nx+1, 0, ny+1])
45  plt.title("Lower Layer")
46 
47  CSPV = plt.contourf(x,y, pv[1,:,:],20,cmap=CM)
48  CSPSI = plt.contour (x,y,psi[1,:,:],10,colors='k')
49 
50  plt.clabel(CSPSI, fontsize=9, inline=1)
51  CB = plt.colorbar(CSPV)
52 
53  plt.show()
def plot(self, pv, psi)
Definition: QgPlot.py:15