<p><b>duda</b> 2009-07-30 10:35:35 -0600 (Thu, 30 Jul 2009)</p><p>Clean up the cells.ncl script, placing control over several aspects of the<br>
   plot (color-filled/contours, winds/no winds, orthographic/cylindrical<br>
   equidistant projection) at the top of the script.<br>
<br>
M    swmodel/ncl/cells.ncl<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/swmodel/ncl/cells.ncl
===================================================================
--- trunk/swmodel/ncl/cells.ncl        2009-07-30 16:23:47 UTC (rev 8)
+++ trunk/swmodel/ncl/cells.ncl        2009-07-30 16:35:35 UTC (rev 9)
@@ -2,6 +2,36 @@
 load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;
 
 begin
+
+  ;
+  ; Whether to do color-filled plot (filled=True) or
+  ;   to plot contours of height field (filled=False)
+  ;
+;  filled   = True
+  filled   = False
+
+  ;
+  ; Whether to plot wind vectors
+  ;
+;  winds    = True
+  winds    = False
+
+  ;
+  ; The (lat,lon) the plot is to be centered over
+  ;
+  cenLat   = 0.0
+  cenLon   = 0.0
+
+  ;
+  ; Projection to use for plot
+  ;
+  projection = &quot;Orthographic&quot;
+;  projection = &quot;CylindricalEquidistant&quot;
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
   r2d = 57.2957795             ; radians to degrees
 
   maxedges = 7 
@@ -40,82 +70,70 @@
 
   res@sfXArray             = x
   res@sfYArray             = y
-;  res@sfXCellBounds        = cx
-;  res@sfYCellBounds        = cy
 
   res@cnFillMode           = &quot;RasterFill&quot;
 
-  res@cnFillOn             = True
-  res@cnLinesOn            = False
-  res@cnLineLabelsOn       = False
+  if (filled) then
+     res@cnFillOn             = True
+     res@cnLinesOn            = False
+     res@cnLineLabelsOn       = False
+  else
+     res@cnFillOn             = False
+     res@cnLinesOn            = True
+     res@cnLineLabelsOn       = True
+  end if
 
-;  res@cnFillOn             = False
-;  res@cnLinesOn            = True
-;  res@cnLineLabelsOn       = True
-
-;  res@cnMaxLevelCount      = 22
-;  res@cnLevelSelectionMode = &quot;ManualLevels&quot;
-  res@cnMinLevelValF       = -50.
-  res@cnMaxLevelValF       = 1000.
+;  res@cnMinLevelValF       = -50.
+;  res@cnMaxLevelValF       = 1000.
   res@cnLevelSpacingF      =  50.
   res@cnInfoLabelOn        = True
 
   res@lbLabelAutoStride    = True
   res@lbBoxLinesOn         = False
 
-;  res@mpProjection      = &quot;Satellite&quot;
+  res@mpProjection      = projection
   res@mpDataBaseVersion = &quot;MediumRes&quot;
-  res@mpCenterLatF      = 0.
-  res@mpCenterLonF      = 0.
-  res@mpGridAndLimbOn   = False
+  res@mpCenterLatF      = cenLat
+  res@mpCenterLonF      = cenLon
+  res@mpGridAndLimbOn   = True
+  res@mpGridAndLimbDrawOrder = &quot;PreDraw&quot;
+  res@mpGridLineColor   = &quot;Background&quot;
   res@mpOutlineOn       = False
   res@mpFillOn          = False
   res@mpPerimOn         = False
   res@gsnFrame          = False
 
   t = stringtointeger(getenv(&quot;T&quot;))
-  u   = f-&gt;u(t,:,0)
-  v   = f-&gt;v(t,:,0)
   h   = f-&gt;h(t,:,0)
   hs  = f-&gt;h_s(:)
-;  hsizes = dimsizes(h)
-;  h_total = new((/hsizes(1)/),double)
-;  h_total = 0.0
-;  do i=1,hsizes(1)
-;     h_total(:) = h_total(:) + h(:)
-;  end do
-;  h_total(:) = h_total(:) + hs(:)
-;  h(:) = h(:) + hs(:)
+  h(:) = h(:) + hs(:)
   res@cnLineDashPattern = 0
   map = gsn_csm_contour_map(wks,h,res)
 
-;  res@cnLineDashPattern = 11
-;  map = gsn_csm_contour_map(wks,hs,res)
-  frame(wks)
-
-  esizes = dimsizes(u)
-  u_earth = new(dimsizes(u),float)
-  v_earth = new(dimsizes(u),float)
-  lat_edge = new(dimsizes(u),float)
-  lon_edge = new(dimsizes(u),float)
-  do i=0,esizes(0)-1
-     j = i % 20
-     if (j .eq. 0) then
+  if (winds) then
+     u   = f-&gt;u(t,:,0)
+     v   = f-&gt;v(t,:,0)
+     esizes = dimsizes(u)
+     u_earth = new(dimsizes(u),float)
+     v_earth = new(dimsizes(u),float)
+     lat_edge = new(dimsizes(u),float)
+     lon_edge = new(dimsizes(u),float)
+     do i=0,esizes(0)-1
         u_earth(i) = doubletofloat(u(i)*cos(alpha(i)) - v(i)*sin(alpha(i)))
         v_earth(i) = doubletofloat(u(i)*sin(alpha(i)) + v(i)*cos(alpha(i)))
-     else
-        u_earth(i) = -999.
-        v_earth(i) = -999.
-     end if
-     lat_edge(i) = doubletofloat(latEdge(i))
-     lon_edge(i) = doubletofloat(lonEdge(i))
-  end do
+        lat_edge(i) = doubletofloat(latEdge(i))
+        lon_edge(i) = doubletofloat(lonEdge(i))
+     end do
 
-  wmsetp(&quot;VCH&quot;,0.003)
-  wmsetp(&quot;VRN&quot;,0.010)
-  wmsetp(&quot;VRS&quot;,20.0)
-;  wmvectmap(wks, lat_edge, lon_edge, u_earth, v_earth)
+     wmsetp(&quot;VCH&quot;,0.0010)
+     wmsetp(&quot;VRN&quot;,0.010)
+     wmsetp(&quot;VRS&quot;,100.0)
+     wmsetp(&quot;VCW&quot;,0.10)
 
-;  frame(wks)
+     wmvectmap(wks, lat_edge, lon_edge, u_earth, v_earth)
+  end if
+
+  frame(wks)
+
 end
 

</font>
</pre>