forked from wrfchem-leeds/WRFotron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotgrids.ncl
executable file
·142 lines (115 loc) · 5.56 KB
/
plotgrids.ncl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
; Script display location of model domains
; Only works for ARW domains
; Reads namelist file directly
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "./WRFUserARW.ncl"
begin
;
; We generate plots, but what kind do we prefer?
type = "pdf"
; type = "ps"
; type = "ncgm"
wks = gsn_open_wks(type,"wps_show_dom")
; read the following namelist file
filename = "./namelist.wps.domain_test"
; Set the colors to be used
colors = (/"white","black","White","ForestGreen","DeepSkyBlue","Red","Blue"/)
gsn_define_colormap(wks, colors)
; Set some map information ; line and text information
mpres = True
mpres@mpFillOn = True
mpres@mpFillColors = (/"background","DeepSkyBlue","ForestGreen","DeepSkyBlue", "transparent"/)
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGridLineColor = "Black"
mpres@mpLimbLineColor = "Black"
mpres@mpNationalLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpUSStateLineColor = "Black"
;mpres@mpGridSpacingF = 45
mpres@tiMainString = " WPS Domain Configuration "
mpres@mpOutlineOn = True ; turn on continental outlines
mpres@mpOutlineBoundarySets = "National" ; add country boundaries
mpres@mpNationalLineThicknessF = 2.0 ; interior boundaries
mpres@mpGeophysicalLineThicknessF = 1.0 ; lines separating land/ocean
; so the plot is not rotated
mpres@gsnPaperOrientation = "portrait"
lnres = True
lnres@gsLineThicknessF = 2.5
lnres@domLineColors = (/ "white", "Red" , "Red" , "Blue" /)
txres = True
txres@txFont = "helvetica-bold"
;txres@txJust = "BottomLeft"
txres@txJust = "TopLeft"
txres@txPerimOn = False
txres@txFontHeightF = 0.015
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Do not change anything between the ";;;;;" lines
mpres@max_dom = stringtoint (systemfunc("grep max_dom " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
mpres@dx = stringtofloat(systemfunc("grep dx " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
mpres@dy = stringtofloat(systemfunc("grep dy " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
mpres@ref_lat = stringtofloat(systemfunc("grep ref_lat " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
mpres@ref_lon = stringtofloat(systemfunc("grep ref_lon " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
test = systemfunc("grep truelat1 " +filename )
if ( .not. ismissing(test) )
mpres@truelat1 = stringtofloat(systemfunc("grep truelat1 " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
else
mpres@truelat1 = 0.0
end if
test = systemfunc("grep truelat2 " +filename )
if ( .not. ismissing(test) )
mpres@truelat2 = stringtofloat(systemfunc("grep truelat2 " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
else
mpres@truelat2 = 0.0
end if
mpres@stand_lon = stringtofloat(systemfunc("grep stand_lon " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
test = systemfunc("grep lambert " +filename )
if ( .not. ismissing(test) )
mpres@map_proj = "lambert"
end if
test = systemfunc("grep mercator " +filename )
if ( .not. ismissing(test) )
mpres@map_proj = "mercator"
end if
test = systemfunc("grep polar " +filename )
if ( .not. ismissing(test) )
mpres@map_proj = "polar"
end if
testa = systemfunc("grep 'lat-lon' " +filename )
if ( .not. ismissing(testa) )
mpres@map_proj = "lat-lon"
mpres@pole_lat = stringtofloat(systemfunc("grep pole_lat " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
mpres@pole_lon = stringtofloat(systemfunc("grep pole_lon " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )
end if
parent_id = new ( mpres@max_dom , integer )
parent_grid_ratio = new ( mpres@max_dom , integer )
i_parent_start = new ( mpres@max_dom , integer )
j_parent_start = new ( mpres@max_dom , integer )
e_we = new ( mpres@max_dom , integer )
e_sn = new ( mpres@max_dom , integer )
do n = 1, mpres@max_dom
n0 = n - 1
parent_id(n0) = stringtoint(systemfunc("grep parent_id " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
parent_grid_ratio(n0) = stringtoint(systemfunc("grep parent_grid_ratio " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
i_parent_start(n0) = stringtoint(systemfunc("grep i_parent_start " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
j_parent_start(n0) = stringtoint(systemfunc("grep j_parent_start " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
e_we(n0) = stringtoint(systemfunc("grep e_we " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
e_sn(n0) = stringtoint(systemfunc("grep e_sn " +filename+ " | cut -f2 -d'=' | cut -f"+n+" -d','" ) )
end do
mpres@parent_id = parent_id
mpres@parent_grid_ratio = parent_grid_ratio
mpres@i_parent_start = i_parent_start
mpres@j_parent_start = j_parent_start
mpres@e_we = e_we
mpres@e_sn = e_sn
mp = wrf_wps_dom (wks,mpres,lnres,txres)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now you can add some information to the plot.
; Below is an example of adding a white dot over the DC location.
;pmres = True
;pmres@gsMarkerColor = "White"
;pmres@gsMarkerIndex = 16
;pmres@gsMarkerSizeF = 0.01
;gsn_polymarker(wks,mp,-77.26,38.56,pmres)
frame(wks) ; lets frame the plot - do not delete
end