<p><b>duda</b> 2009-08-12 16:56:04 -0600 (Wed, 12 Aug 2009)</p><p>Update ncl/cells.ncl script to permit ke and vorticity to be plotted<br>
by uncommenting the appropriate line at the top of the file.<br>
<br>
Note: Currently, ke, vorticity, and other diagnostic fields in the<br>
output.nc file have bogus values.<br>
<br>
M    cells.ncl<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/swmodel/ncl/cells.ncl
===================================================================
--- trunk/swmodel/ncl/cells.ncl        2009-08-12 21:40:03 UTC (rev 28)
+++ trunk/swmodel/ncl/cells.ncl        2009-08-12 22:56:04 UTC (rev 29)
@@ -4,11 +4,11 @@
 begin
 
   ;
-  ; Whether to do color-filled plot (filled=True) or
-  ;   to plot contours of height field (filled=False)
+  ; Which field to plot
   ;
-;  filled   = True
-  filled   = False
+  plotfield = "h"
+;  plotfield = "ke"
+;  plotfield = "vorticity"
 
   ;
   ; Whether to plot wind vectors
@@ -17,6 +17,13 @@
   winds    = False
 
   ;
+  ; Whether to do color-filled plot (filled=True) or
+  ;   to plot contours of height field (filled=False)
+  ;
+;  filled   = True
+  filled   = False
+
+  ;
   ; The (lat,lon) the plot is to be centered over
   ;
   cenLat   = 0.0
@@ -25,8 +32,8 @@
   ;
   ; Projection to use for plot
   ;
-  projection = "Orthographic"
-;  projection = "CylindricalEquidistant"
+;  projection = "Orthographic"
+  projection = "CylindricalEquidistant"
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -41,8 +48,8 @@
 
   f = addfile("output.nc","r")
 
-  x   = f->lonCell(:) * r2d
-  y   = f->latCell(:) * r2d
+  lonCell   = f->lonCell(:) * r2d
+  latCell   = f->latCell(:) * r2d
   lonVertex = f->lonVertex(:) * r2d
   latVertex = f->latVertex(:) * r2d
   lonEdge = f->lonEdge(:) * r2d
@@ -50,28 +57,20 @@
   verticesOnCell = f->verticesOnCell(:,:)
   alpha = f->angleEdge(:)
 
-  sizes = dimsizes(verticesOnCell)
-
-  cx = new((/sizes(0),maxedges/),double)
-  cy = new((/sizes(0),maxedges/),double)
-
-  do j=0,sizes(0)-1
-  do i=0,maxedges-2
-     cy(j,i) = latVertex(verticesOnCell(j,i)-1)
-     cx(j,i) = lonVertex(verticesOnCell(j,i)-1)
-  end do
-  cx(j,maxedges-1) = cx(j,0)
-  cy(j,maxedges-1) = cy(j,0)
-  end do
-
   res                      = True
   res@gsnMaximize          = True
   res@gsnSpreadColors      = True
 
-  res@sfXArray             = x
-  res@sfYArray             = y
+  if (plotfield .eq. "h" .or. plotfield .eq. "ke") then
+     res@sfXArray             = lonCell
+     res@sfYArray             = latCell
+  end if
+  if (plotfield .eq. "vorticity") then
+     res@sfXArray             = lonVertex
+     res@sfYArray             = latVertex
+  end if
 
-  res@cnFillMode           = "RasterFill"
+  res@cnFillMode           = "AreaFill"
 
   if (filled) then
      res@cnFillOn             = True
@@ -83,9 +82,7 @@
      res@cnLineLabelsOn       = True
   end if
 
-;  res@cnMinLevelValF       = -50.
-;  res@cnMaxLevelValF       = 1000.
-  res@cnLevelSpacingF      =  50.
+  res@cnLevelSpacingF      =  50.0
   res@cnInfoLabelOn        = True
 
   res@lbLabelAutoStride    = True
@@ -104,11 +101,19 @@
   res@gsnFrame          = False
 
   t = stringtointeger(getenv("T"))
-  h   = f->h(t,:,0)
-  hs  = f->h_s(:)
-  h(:) = h(:) + hs(:)
+  if (plotfield .eq. "h") then
+     h   = f->h(t,:,0)
+     hs  = f->h_s(:)
+     fld = h + hs
+  end if
+  if (plotfield .eq. "ke") then
+     fld = f->ke(t,:,0)
+  end if
+  if (plotfield .eq. "vorticity") then
+     fld = f->vorticity(t,:,0)
+  end if
   res@cnLineDashPattern = 0
-  map = gsn_csm_contour_map(wks,h,res)
+  map = gsn_csm_contour_map(wks,fld,res)
 
   if (winds) then
      u   = f->u(t,:,0)
</font>
</pre>