2 ; Script display location of model domains
3 ; Only works for ARW domains
4 ; Only works for NCL versions later than 6.1
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 or later to run this script. Try running plotgrids.ncl. Stopping now...")
20 ; We generate plots, but what kind do we prefer?
25 wks = gsn_open_wks(type,"wps_show_dom")
27 ; read the following namelist file
28 filename = "namelist.wps"
30 ; Set the colors to be used
31 colors = (/"white","black","White","ForestGreen","DeepSkyBlue","Red","Blue"/)
32 gsn_define_colormap(wks, colors)
35 ; Set some map information ; line and text information
38 mpres@mpFillColors = (/"background","DeepSkyBlue","ForestGreen","DeepSkyBlue", "transparent"/)
39 mpres@mpDataBaseVersion = "Ncarg4_1"
40 mpres@mpGeophysicalLineColor = "Black"
41 mpres@mpGridLineColor = "Black"
42 mpres@mpLimbLineColor = "Black"
43 mpres@mpNationalLineColor = "Black"
44 mpres@mpPerimLineColor = "Black"
45 mpres@mpUSStateLineColor = "Black"
46 ; mpres@mpOutlineBoundarySets = "AllBoundaries"
47 ;mpres@mpGridSpacingF = 45
48 mpres@tiMainString = " WPS Domain Configuration "
51 lnres@gsLineThicknessF = 2.5
52 lnres@domLineColors = (/ "white", "Red" , "Red" , "Blue" /)
55 txres@txFont = "helvetica-bold"
56 ;txres@txJust = "BottomLeft"
57 txres@txJust = "TopLeft"
58 txres@txPerimOn = False
59 txres@txFontHeightF = 0.015
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62 ; Do not change anything between the ";;;;;" lines
66 parent_idn = new (maxdom,integer)
67 parent_grid_ration = new (maxdom,integer)
68 i_parent_startn = new (maxdom,integer)
69 j_parent_startn = new (maxdom,integer)
70 e_wen = new (maxdom,integer)
71 e_snn = new (maxdom,integer)
72 plotvar = new((/maxdom,nvar/),float)
73 plotvar@_FillValue = -999.0
75 plotvar = wrf_wps_read_nml(filename)
77 mpres@max_dom = floattointeger(plotvar(0,0))
78 mpres@dx = plotvar(0,1)
79 mpres@dy = plotvar(0,2)
80 mpres@ref_lat = plotvar(0,3)
81 mpres@ref_lon = plotvar(0,4)
82 mpres@truelat1 = plotvar(0,5)
83 mpres@truelat2 = plotvar(0,6)
84 mpres@stand_lon = plotvar(0,7)
85 mproj_int = plotvar(0,8)
86 mpres@pole_lat = plotvar(0,9)
87 mpres@pole_lon = plotvar(0,10)
90 parent_idn(i) = floattointeger(plotvar(i,11))
91 parent_grid_ration(i) = floattointeger(plotvar(i,12))
92 i_parent_startn(i) = floattointeger(plotvar(i,13))
93 j_parent_startn(i) = floattointeger(plotvar(i,14))
94 e_wen(i) = floattointeger(plotvar(i,15))
95 e_snn(i) = floattointeger(plotvar(i,16))
98 if(mpres@max_dom .gt. 1) then
99 do i = 1,mpres@max_dom-1
101 ;Making sure edge is nested grid is at least 5 grid points from mother domain.
102 if(i_parent_startn(i) .lt. 5) then
103 print("Warning: Western edge of grid must be at least 5 grid points from mother domain!")
105 if(j_parent_startn(i) .lt. 5) then
106 print("Warning: Southern edge of grid must be at least 5 grid points from mother domain!")
108 pointwe = (e_wen(i)-1.)/parent_grid_ration(i)
109 pointsn = (e_snn(i)-1.)/parent_grid_ration(i)
110 gridwe = e_wen(parent_idn(i)-1)-(pointwe+i_parent_startn(i))
111 gridsn = e_snn(parent_idn(i)-1)-(pointsn+j_parent_startn(i))
112 if(gridwe .lt. 5) then
113 print("Warning: Eastern edge of grid must be at least 5 grid points from mother domain!")
115 if(gridsn .lt. 5) then
116 print("Warning: Northern edge of grid must be at least 5 grid points from mother domain!")
119 ;Making sure nested grid is fully contained in mother domain.
120 gridsizewe = (((e_wen(parent_idn(i)-1)-4)-i_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
121 gridsizesn = (((e_snn(parent_idn(i)-1)-4)-j_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
122 if(gridwe .lt. 5) then
123 print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
124 print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
127 if(gridsn .lt. 5) then
128 print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
129 print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
133 ;Making sure the nest ends of a mother grid domain point.
134 pointwetrunc = decimalPlaces(pointwe,0,False)
135 pointsntrunc = decimalPlaces(pointsn,0,False)
136 if((pointwe-pointwetrunc) .ne. 0.) then
137 nest_we_up = (ceil(pointwe)*parent_grid_ration(i))+1
138 nest_we_dn = (floor(pointwe)*parent_grid_ration(i))+1
139 print("Nest does not end on mother grid domain point. Try " + nest_we_dn + " or " + nest_we_up + ".")
141 if((pointsn-pointsntrunc) .ne. 0.) then
142 nest_sn_up = (ceil(pointsn)*parent_grid_ration(i))+1
143 nest_sn_dn = (floor(pointsn)*parent_grid_ration(i))+1
144 print("Nest does not end on mother grid domain point. Try " + nest_sn_dn + " or " + nest_sn_up + ".")
150 mpres@parent_id = parent_idn(0:mpres@max_dom-1)
151 mpres@parent_grid_ratio = parent_grid_ration(0:mpres@max_dom-1)
152 mpres@i_parent_start = i_parent_startn(0:mpres@max_dom-1)
153 mpres@j_parent_start = j_parent_startn(0:mpres@max_dom-1)
154 mpres@e_we = e_wen(0:mpres@max_dom-1)
155 mpres@e_sn = e_snn(0:mpres@max_dom-1)
157 if(mproj_int .eq. 1) then
158 mpres@map_proj = "lambert"
161 else if(mproj_int .eq. 2) then
162 mpres@map_proj = "mercator"
165 else if(mproj_int .eq. 3) then
166 mpres@map_proj = "polar"
169 else if(mproj_int .eq. 4) then
170 mpres@map_proj = "lat-lon"
176 mp = wrf_wps_dom (wks,mpres,lnres,txres)
178 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
180 ; Now you can add some information to the plot.
181 ; Below is an example of adding a white dot over the DC location.
183 ;pmres@gsMarkerColor = "White"
184 ;pmres@gsMarkerIndex = 16
185 ;pmres@gsMarkerSizeF = 0.01
186 ;gsn_polymarker(wks,mp,-77.26,38.56,pmres)
189 frame(wks) ; lets frame the plot - do not delete