2 ; Script display location of model domains
3 ; Only works for ARW domains
4 ; Only works for NCL versions 6.1.x
5 ; Reads namelist file directly
7 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
8 load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
13 ; Check the version of NCL
14 version = systemfunc("ncl -V")
15 if(version.lt.6.1) then
16 print("You need NCL V6.1 to run this script. Try running util/plotgrids_old.ncl. Stopping now...")
19 if(version.ge.6.2) then
20 print("You need NCL V6.1 to run this script. Try running util/plotgrids_new.ncl. Stopping now...")
24 ; We generate plots, but what kind do we prefer?
29 wks = gsn_open_wks(type,"wps_show_dom")
31 ; read the following namelist file
32 filename = "namelist.wps"
34 ; Set the colors to be used
35 colors = (/"white","black","White","ForestGreen","DeepSkyBlue","Red","Blue"/)
36 gsn_define_colormap(wks, colors)
39 ; Set some map information ; line and text information
42 mpres@mpFillColors = (/"background","DeepSkyBlue","ForestGreen","DeepSkyBlue", "transparent"/)
43 mpres@mpDataBaseVersion = "Ncarg4_1"
44 mpres@mpGeophysicalLineColor = "Black"
45 mpres@mpGridLineColor = "Black"
46 mpres@mpLimbLineColor = "Black"
47 mpres@mpNationalLineColor = "Black"
48 mpres@mpPerimLineColor = "Black"
49 mpres@mpUSStateLineColor = "Black"
50 ; mpres@mpOutlineBoundarySets = "AllBoundaries"
51 ;mpres@mpGridSpacingF = 45
52 mpres@tiMainString = " WPS Domain Configuration "
55 lnres@gsLineThicknessF = 2.5
56 lnres@domLineColors = (/ "white", "Red" , "Red" , "Blue" /)
59 txres@txFont = "helvetica-bold"
60 ;txres@txJust = "BottomLeft"
61 txres@txJust = "TopLeft"
62 txres@txPerimOn = False
63 txres@txFontHeightF = 0.015
65 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
66 ; Do not change anything between the ";;;;;" lines
70 parent_idn = new (maxdom,integer)
71 parent_grid_ration = new (maxdom,integer)
72 i_parent_startn = new (maxdom,integer)
73 j_parent_startn = new (maxdom,integer)
74 e_wen = new (maxdom,integer)
75 e_snn = new (maxdom,integer)
76 plotvar = new((/maxdom,nvar/),float)
77 plotvar@_FillValue = -999.0
79 plotvar = wrf_wps_read_nml(filename)
81 mpres@max_dom = floattointeger(plotvar(0,0))
82 mpres@dx = plotvar(0,1)
83 mpres@dy = plotvar(0,2)
84 mpres@ref_lat = plotvar(0,3)
85 mpres@ref_lon = plotvar(0,4)
86 mpres@truelat1 = plotvar(0,5)
87 mpres@truelat2 = plotvar(0,6)
88 mpres@stand_lon = plotvar(0,7)
89 mproj_int = plotvar(0,8)
90 mpres@pole_lat = plotvar(0,9)
91 mpres@pole_lon = plotvar(0,10)
94 parent_idn(i) = floattointeger(plotvar(i,11))
95 parent_grid_ration(i) = floattointeger(plotvar(i,12))
96 i_parent_startn(i) = floattointeger(plotvar(i,13))
97 j_parent_startn(i) = floattointeger(plotvar(i,14))
98 e_wen(i) = floattointeger(plotvar(i,15))
99 e_snn(i) = floattointeger(plotvar(i,16))
102 if(mpres@max_dom .gt. 1) then
103 do i = 1,mpres@max_dom-1
105 ;Making sure edge is nested grid is at least 5 grid points from mother domain.
106 if(i_parent_startn(i) .lt. 5) then
107 print("Warning: Western edge of grid must be at least 5 grid points from mother domain!")
109 if(j_parent_startn(i) .lt. 5) then
110 print("Warning: Southern edge of grid must be at least 5 grid points from mother domain!")
112 pointwe = (e_wen(i)-1.)/parent_grid_ration(i)
113 pointsn = (e_snn(i)-1.)/parent_grid_ration(i)
114 gridwe = e_wen(parent_idn(i)-1)-(pointwe+i_parent_startn(i))
115 gridsn = e_snn(parent_idn(i)-1)-(pointsn+j_parent_startn(i))
116 if(gridwe .lt. 5) then
117 print("Warning: Eastern edge of grid must be at least 5 grid points from mother domain!")
119 if(gridsn .lt. 5) then
120 print("Warning: Northern edge of grid must be at least 5 grid points from mother domain!")
123 ;Making sure nested grid is fully contained in mother domain.
124 gridsizewe = (((e_wen(parent_idn(i)-1)-4)-i_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
125 gridsizesn = (((e_snn(parent_idn(i)-1)-4)-j_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
126 if(gridwe .lt. 5) then
127 print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
128 print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
131 if(gridsn .lt. 5) then
132 print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
133 print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
137 ;Making sure the nest ends of a mother grid domain point.
138 pointwetrunc = decimalPlaces(pointwe,0,False)
139 pointsntrunc = decimalPlaces(pointsn,0,False)
140 if((pointwe-pointwetrunc) .ne. 0.) then
141 nest_we_up = (ceil(pointwe)*parent_grid_ration(i))+1
142 nest_we_dn = (floor(pointwe)*parent_grid_ration(i))+1
143 print("Nest does not end on mother grid domain point. Try " + nest_we_dn + " or " + nest_we_up + ".")
145 if((pointsn-pointsntrunc) .ne. 0.) then
146 nest_sn_up = (ceil(pointsn)*parent_grid_ration(i))+1
147 nest_sn_dn = (floor(pointsn)*parent_grid_ration(i))+1
148 print("Nest does not end on mother grid domain point. Try " + nest_sn_dn + " or " + nest_sn_up + ".")
154 mpres@parent_id = parent_idn(0:mpres@max_dom-1)
155 mpres@parent_grid_ratio = parent_grid_ration(0:mpres@max_dom-1)
156 mpres@i_parent_start = i_parent_startn(0:mpres@max_dom-1)
157 mpres@j_parent_start = j_parent_startn(0:mpres@max_dom-1)
158 mpres@e_we = e_wen(0:mpres@max_dom-1)
159 mpres@e_sn = e_snn(0:mpres@max_dom-1)
161 if(mproj_int .eq. 1) then
162 mpres@map_proj = "lambert"
165 else if(mproj_int .eq. 2) then
166 mpres@map_proj = "mercator"
169 else if(mproj_int .eq. 3) then
170 mpres@map_proj = "polar"
173 else if(mproj_int .eq. 4) then
174 mpres@map_proj = "lat-lon"
180 mp = wrf_wps_dom (wks,mpres,lnres,txres)
182 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
184 ; Now you can add some information to the plot.
185 ; Below is an example of adding a white dot over the DC location.
187 ;pmres@gsMarkerColor = "White"
188 ;pmres@gsMarkerIndex = 16
189 ;pmres@gsMarkerSizeF = 0.01
190 ;gsn_polymarker(wks,mp,-77.26,38.56,pmres)
193 frame(wks) ; lets frame the plot - do not delete