1 ;_______________________________________________________________________________________
2 ;To run the script type:
3 ; ncl plotfmt.ncl {input file}
6 ; ncl plotfmt.ncl 'filename="FILE:2005-06-01_00"'
9 ; This script can only be used in NCL V6.2 or later!!!!!
10 ;_______________________________________________________________________________________
12 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
13 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
14 load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
18 ; Make sure we have a datafile to work with
19 if (.not. isvar("filename") ) then
21 print(" ### MUST SUPPLY a filename ### ")
23 print(" Something like: ")
24 print(" ncl plotfmt.ncl filename=FILE:2005-06-01_00")
25 print(" REMEMBER TO ADD QUOTES" )
26 print(" Refer to the information at the top of this file for more info and syntax" )
30 head_real = new(14,float)
34 map_source = new(1,string)
37 ; We generate plots, but what kind do we prefer?
44 wks = gsn_open_wks(type,outf)
51 istatus = wrf_wps_open_int(filename)
56 wrf_wps_rdhead_int(istatus,head_real,field,hdate, \
57 units,map_source,desc)
59 do while (istatus.eq.0)
61 version = toint(head_real(0))
64 nx = toint(head_real(3))
65 ny = toint(head_real(4))
66 iproj = toint(head_real(5))
67 print("==================================================")
68 print("VAR = " + field + "__" + xlvl )
73 print("hdate = '" + hdate + "'")
74 print("units = '" + units + "'")
75 print("desc = '" + desc + "'")
76 print("field = '" + field + "'")
77 print("map_source = '" + map_source + "'")
78 print("version = " + version)
79 print("xfcst = " + xfcst)
80 print("xlvl = " + xlvl)
81 print("nx/ny = " + nx + "/" + ny )
82 print("iproj = " + iproj)
83 print("lat0/lon0 = " + lat0 + "/" + lon0)
84 print("head_real(8) = " + head_real(8))
85 print("head_real(9) = " + head_real(9))
86 print("head_real(10) = " + head_real(10))
87 print("head_real(11) = " + head_real(11))
88 print("head_real(12) = " + head_real(12))
89 print("head_real(13) = " + head_real(13))
92 if (iproj.eq.0) then ;Cylindrical Equidistant
93 lat = lat0 + ispan(0,ny-1,1)*head_real(8)
94 lon = lon0 + ispan(0,nx-1,1)*head_real(9)
95 ;---Turn these into 1D coordinate arrays
98 lon@units = "degrees_east"
99 lat@units = "degrees_north"
104 if (iproj.eq.1) then ; Mercator
107 truelat1 = head_real(10)
110 res1@TRUELAT1 = truelat1
121 loc = wrf_ij_to_ll (nx,ny,res1)
123 res@gsnAddCyclic = False
124 res@mpLimitMode = "Corners"
125 res@mpLeftCornerLatF = lat0
126 res@mpLeftCornerLonF = lon0
127 res@mpRightCornerLatF = loc(1)
128 res@mpRightCornerLonF = loc(0)
129 res@tfDoNDCOverlay = True
130 res@mpProjection = "mercator"
133 if (iproj.eq.3) then ; Lambert Conformal
136 xlonc = head_real(10)
137 truelat1 = head_real(11)
138 truelat2 = head_real(12)
141 res1@TRUELAT1 = truelat1
142 res1@TRUELAT2 = truelat2
143 res1@STAND_LON = xlonc
154 loc = wrf_ij_to_ll (nx,ny,res1)
156 res@gsnAddCyclic = False
157 res@mpLimitMode = "Corners"
158 res@mpLeftCornerLatF = lat0
159 res@mpLeftCornerLonF = lon0
160 res@mpRightCornerLatF = loc(1)
161 res@mpRightCornerLonF = loc(0)
162 res@tfDoNDCOverlay = True
163 res@mpProjection = "LambertConformal"
164 res@mpLambertParallel1F = truelat1
165 res@mpLambertParallel2F = truelat2
166 res@mpLambertMeridianF = xlonc
167 res@pmTickMarkDisplayMode = "Always"
168 res@mpGridAndLimbOn = True
171 if (iproj.eq.4) then ;Gaussian
173 deltalon = head_real(9)
174 deltalat = 2.*(lat0)/(2.*nlats-1)
175 if (lat0 .ge. 80.) then
176 deltalat = -1.0*deltalat
178 lat = lat0 + ispan(0,ny-1,1)*deltalat
179 lon = lon0 + ispan(0,nx-1,1)*deltalon
180 ;---Turn these into 1D coordinate arrays
183 lon@units = "degrees_east"
184 lat@units = "degrees_north"
193 slab = wrf_wps_rddata_int(istatus,nx,ny)
195 slab@_FillValue = -1e+30
196 if (iproj.ne.3) then ; NOT Lambert Conformal
204 slab@description = xlvl +" "+ desc
205 ; printVarSummary(slab)
207 map = gsn_csm_contour_map(wks,slab,res)
208 if (iproj.ne.3) then ; NOT Lambert Conformal
214 wrf_wps_rdhead_int(istatus,head_real,field,hdate, \
215 units,map_source,desc)