<p><b>duda</b> 2009-07-30 10:23:47 -0600 (Thu, 30 Jul 2009)</p><p>Updates to NCL scripts:<br>
<br>
tc2_contours.ncl -- updated to work with latest model output, which adds a <br>
vertical dimension for state variables<br>
<br>
cells.ncl -- cleaned up 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 ncl/tc2_contours.ncl<br>
M ncl/cells.ncl<br>
</p><hr noshade><pre><font color="gray">Modified: branches/serial_swmodel/ncl/cells.ncl
===================================================================
--- branches/serial_swmodel/ncl/cells.ncl        2009-07-29 00:01:08 UTC (rev 7)
+++ branches/serial_swmodel/ncl/cells.ncl        2009-07-30 16:23:47 UTC (rev 8)
@@ -2,6 +2,36 @@
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
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 = "Orthographic"
+; projection = "CylindricalEquidistant"
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
r2d = 57.2957795 ; radians to degrees
maxedges = 7
@@ -40,16 +70,20 @@
res@sfXArray = x
res@sfYArray = y
- res@sfXCellBounds = cx
- res@sfYCellBounds = cy
- res@cnFillOn = False
res@cnFillMode = "RasterFill"
- res@cnLinesOn = True
- res@cnLineLabelsOn = True
-; res@cnMaxLevelCount = 22
-; res@cnLevelSelectionMode = "ManualLevels"
-; res@cnMinLevelValF = -100.
+
+ 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@cnMinLevelValF = -50.
; res@cnMaxLevelValF = 1000.
res@cnLevelSpacingF = 50.
res@cnInfoLabelOn = True
@@ -57,50 +91,49 @@
res@lbLabelAutoStride = True
res@lbBoxLinesOn = False
-; res@mpProjection = "Satellite"
+ res@mpProjection = projection
res@mpDataBaseVersion = "MediumRes"
- res@mpCenterLatF = 0.
- res@mpCenterLonF = 0.
- res@mpGridAndLimbOn = False
+ res@mpCenterLatF = cenLat
+ res@mpCenterLonF = cenLon
+ res@mpGridAndLimbOn = True
+ res@mpGridAndLimbDrawOrder = "PreDraw"
+ res@mpGridLineColor = "Background"
res@mpOutlineOn = False
res@mpFillOn = False
res@mpPerimOn = False
res@gsnFrame = False
t = stringtointeger(getenv("T"))
- u = f->u(t,:,0)
- v = f->v(t,:,0)
h = f->h(t,:,0)
hs = f->h_s(:)
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)
-
- 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->u(t,:,0)
+ v = f->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("VCH",0.003)
- wmsetp("VRN",0.010)
- wmsetp("VRS",20.0)
-; wmvectmap(wks, lat_edge, lon_edge, u_earth, v_earth)
+ wmsetp("VCH",0.0010)
+ wmsetp("VRN",0.010)
+ wmsetp("VRS",100.0)
+ wmsetp("VCW",0.10)
+ wmvectmap(wks, lat_edge, lon_edge, u_earth, v_earth)
+ end if
+
frame(wks)
+
end
Modified: branches/serial_swmodel/ncl/tc2_contours.ncl
===================================================================
--- branches/serial_swmodel/ncl/tc2_contours.ncl        2009-07-29 00:01:08 UTC (rev 7)
+++ branches/serial_swmodel/ncl/tc2_contours.ncl        2009-07-30 16:23:47 UTC (rev 8)
@@ -65,13 +65,13 @@
res@mpMaskAreaSpecifiers = "Land"
res@gsnFrame = False
- h0 = f->h(0,:)
+ h0 = f->h(0,:,0)
print("Min/max of initial height field: "+min(h0)+", "+max(h0))
map0 = gsn_csm_contour_map(wks,h0,res)
t = stringtointeger(getenv("T"))
res@cnLineDashPattern = 0
- h = f->h(t,:)
+ h = f->h(t,:,0)
print("Min/max of height field after one rotation: "+min(h)+", "+max(h))
map1 = gsn_csm_contour_map(wks,h,res)
tres = False
</font>
</pre>