forrest@0
|
1 |
; ***********************************************
|
forrest@0
|
2 |
; using gsn_table for all
|
forrest@0
|
3 |
; combine 19.metric_plot.ncl and 24.lines.ncl
|
forrest@0
|
4 |
; ***********************************************
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
|
forrest@0
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
|
forrest@0
|
7 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
8 |
;load "/fis/cgd/cseg/people/jeff/clamp/co2/metrics_table.ncl"
|
forrest@0
|
9 |
;************************************************
|
forrest@0
|
10 |
begin
|
forrest@0
|
11 |
|
forrest@0
|
12 |
;************************************************
|
forrest@0
|
13 |
; read model data
|
forrest@0
|
14 |
;************************************************
|
forrest@0
|
15 |
|
forrest@0
|
16 |
; from command line inputs
|
forrest@0
|
17 |
|
forrest@0
|
18 |
;--------------------------------------------------
|
forrest@0
|
19 |
; edit table.html of current model for movel1_vs_model2
|
forrest@0
|
20 |
|
forrest@0
|
21 |
if (isvar("compare")) then
|
forrest@0
|
22 |
html_name2 = compare+"/table.html"
|
forrest@0
|
23 |
html_new2 = html_name2 +".new"
|
forrest@0
|
24 |
|
forrest@0
|
25 |
; the following only needs to execute once
|
forrest@0
|
26 |
; system("sed 1,/model_nameA/s//"+model_name+"/ "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
27 |
; "mv -f "+html_new2+" "+html_name2+";"+ \
|
forrest@0
|
28 |
; "sed 1,/model_nameB/s//"+model_name+"/ "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
29 |
; "mv -f "+html_new2+" "+html_name2+";"+ \
|
forrest@0
|
30 |
; "sed s#"+modeln+"#"+model_name+"# "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
31 |
; "mv -f "+html_new2+" "+html_name2)
|
forrest@0
|
32 |
end if
|
forrest@0
|
33 |
|
forrest@0
|
34 |
;-------------------------------------
|
forrest@0
|
35 |
; edit table.html for current model
|
forrest@0
|
36 |
|
forrest@0
|
37 |
html_name = model_name+"/table.html"
|
forrest@0
|
38 |
html_new = html_name +".new"
|
forrest@0
|
39 |
|
forrest@0
|
40 |
; the following only needs to execute once
|
forrest@0
|
41 |
; system("sed s#model_name#"+model_name+"# "+html_name+" > "+html_new+";"+ \
|
forrest@0
|
42 |
; "mv -f "+html_new+" "+html_name)
|
forrest@0
|
43 |
;------------------------------------------------
|
forrest@0
|
44 |
|
forrest@0
|
45 |
fm = addfile(dirm+film3,"r")
|
forrest@0
|
46 |
|
forrest@0
|
47 |
x = fm->CO2
|
forrest@0
|
48 |
xi = fm->lon
|
forrest@0
|
49 |
yi = fm->lat
|
forrest@0
|
50 |
|
forrest@0
|
51 |
xdim = dimsizes(x)
|
forrest@0
|
52 |
nlev = xdim(1)
|
forrest@0
|
53 |
y = x(:,0,:,:)
|
forrest@0
|
54 |
|
forrest@0
|
55 |
; get co2 at the lowest level
|
forrest@0
|
56 |
y = x(:,nlev-1,:,:)
|
forrest@0
|
57 |
|
forrest@0
|
58 |
; change to unit of observed (u mol/mol)
|
forrest@0
|
59 |
; Model_units [=] kgCO2 / kgDryAir
|
forrest@0
|
60 |
; 28.966 = molecular weight of dry air
|
forrest@0
|
61 |
; 44. = molecular weight of CO2
|
forrest@0
|
62 |
; u mol = 1e-6 mol
|
forrest@0
|
63 |
|
forrest@0
|
64 |
factor = (28.966/44.) * 1e6
|
forrest@0
|
65 |
y = y * factor
|
forrest@0
|
66 |
|
forrest@0
|
67 |
y@_FillValue = 1.e36
|
forrest@0
|
68 |
y@units = "u mol/mol"
|
forrest@0
|
69 |
;************************************************
|
forrest@0
|
70 |
; read data: observed
|
forrest@0
|
71 |
;************************************************
|
forrest@0
|
72 |
diri = "/fis/cgd/cseg/people/jeff/clamp_data/co2/ob/"
|
forrest@0
|
73 |
fili = "co2_globalView_98.nc"
|
forrest@0
|
74 |
g = addfile (diri+fili,"r")
|
forrest@0
|
75 |
val = g->CO2_SEAS
|
forrest@0
|
76 |
lon = g->LON
|
forrest@0
|
77 |
lat = g->LAT
|
forrest@0
|
78 |
sta = chartostring(g->STATION)
|
forrest@0
|
79 |
delete (g)
|
forrest@0
|
80 |
|
forrest@0
|
81 |
ncase = dimsizes(lat)
|
forrest@0
|
82 |
;**************************************************************
|
forrest@0
|
83 |
; get only the lowest level at each station
|
forrest@0
|
84 |
;**************************************************************
|
forrest@0
|
85 |
lat_tmp = lat
|
forrest@0
|
86 |
lat_tmp@_FillValue = 1.e+36
|
forrest@0
|
87 |
|
forrest@0
|
88 |
do n = 0,ncase-1
|
forrest@0
|
89 |
if (.not. ismissing(lat_tmp(n))) then
|
forrest@0
|
90 |
indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon)
|
forrest@0
|
91 |
if (dimsizes(indexes) .gt. 1) then
|
forrest@0
|
92 |
lat_tmp(indexes(1:)) = lat_tmp@_FillValue
|
forrest@0
|
93 |
end if
|
forrest@0
|
94 |
delete (indexes)
|
forrest@0
|
95 |
end if
|
forrest@0
|
96 |
end do
|
forrest@0
|
97 |
|
forrest@0
|
98 |
indexes = ind(.not. ismissing(lat_tmp))
|
forrest@0
|
99 |
|
forrest@0
|
100 |
lat_ob = lat(indexes)
|
forrest@0
|
101 |
lon_ob = lon(indexes)
|
forrest@0
|
102 |
val_ob = val(indexes,:)
|
forrest@0
|
103 |
;************************************************************
|
forrest@0
|
104 |
; interpolate model data into observed station
|
forrest@0
|
105 |
; note: model is 0-360E, 90S-90N
|
forrest@0
|
106 |
;************************************************************
|
forrest@0
|
107 |
; to be able to handle observation at (-89.98,-24.80)
|
forrest@0
|
108 |
yi(0) = -90.
|
forrest@0
|
109 |
|
forrest@0
|
110 |
i = ind(lon_ob .lt. 0.)
|
forrest@0
|
111 |
lon_ob(i) = lon_ob(i) + 360.
|
forrest@0
|
112 |
|
forrest@0
|
113 |
yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0)
|
forrest@0
|
114 |
|
forrest@0
|
115 |
val_model = yo(pts|:,time|:)
|
forrest@0
|
116 |
val_model_0 = val_model
|
forrest@0
|
117 |
|
forrest@0
|
118 |
; remove annual mean
|
forrest@0
|
119 |
val_model = val_model - conform(val_model,dim_avg(val_model),0)
|
forrest@0
|
120 |
|
forrest@0
|
121 |
nzone = 4
|
forrest@0
|
122 |
|
forrest@0
|
123 |
;*******************************************************************
|
forrest@0
|
124 |
; for table -- zone
|
forrest@0
|
125 |
;*******************************************************************
|
forrest@0
|
126 |
; table header name
|
forrest@0
|
127 |
table_header_name = "Zone"
|
forrest@0
|
128 |
|
forrest@0
|
129 |
; column (not including header column)
|
forrest@0
|
130 |
col_header_zone = (/"Stations","Amplitude Ratio", \
|
forrest@0
|
131 |
"Correlation Coef","M score","Combined Score"/)
|
forrest@0
|
132 |
ncol_zone = dimsizes(col_header_zone )
|
forrest@0
|
133 |
|
forrest@0
|
134 |
; row (not including header row)
|
forrest@0
|
135 |
row_header_zone = (/"60N-90N","30N-60N","EQ-30N","90S-EQ","Total"/)
|
forrest@0
|
136 |
nrow_zone = dimsizes(row_header_zone)
|
forrest@0
|
137 |
|
forrest@0
|
138 |
; arrays to be passed to table.
|
forrest@0
|
139 |
value_zone = new ((/nrow_zone, ncol_zone/),string )
|
forrest@0
|
140 |
;--------------------------------------------------------------------
|
forrest@0
|
141 |
|
forrest@0
|
142 |
table_length_zone = 0.4
|
forrest@0
|
143 |
|
forrest@0
|
144 |
; Table header
|
forrest@0
|
145 |
ncr1 = (/1,1/) ; 1 row, 1 column
|
forrest@0
|
146 |
x1 = (/0.005,0.15/) ; Start and end X
|
forrest@0
|
147 |
y1 = (/0.900,0.995/) ; Start and end Y
|
forrest@0
|
148 |
text1 = table_header_name
|
forrest@0
|
149 |
res1 = True
|
forrest@0
|
150 |
res1@txFontHeightF = 0.03
|
forrest@0
|
151 |
res1@gsFillColor = "CornFlowerBlue"
|
forrest@0
|
152 |
|
forrest@0
|
153 |
; Column header (equally space in x2)
|
forrest@0
|
154 |
ncr2 = (/1,ncol_zone/) ; 1 rows, 5 columns
|
forrest@0
|
155 |
x2 = (/x1(1),0.995/) ; start from end of x1
|
forrest@0
|
156 |
y2 = y1 ; same as y1
|
forrest@0
|
157 |
text2 = col_header_zone
|
forrest@0
|
158 |
res2 = True
|
forrest@0
|
159 |
res2@txFontHeightF = 0.015
|
forrest@0
|
160 |
res2@gsFillColor = "Gray"
|
forrest@0
|
161 |
|
forrest@0
|
162 |
; Row header (equally space in y2)
|
forrest@0
|
163 |
ncr3 = (/nrow_zone,1/) ; 5 rows, 1 columns
|
forrest@0
|
164 |
x3 = x1 ; same as x1
|
forrest@0
|
165 |
y3 = (/1.0-table_length_zone,0.900/) ; end at start of y1
|
forrest@0
|
166 |
text3 = row_header_zone
|
forrest@0
|
167 |
res3 = True
|
forrest@0
|
168 |
res3@txFontHeightF = 0.02
|
forrest@0
|
169 |
res3@gsFillColor = "Gray"
|
forrest@0
|
170 |
|
forrest@0
|
171 |
; Main table body
|
forrest@0
|
172 |
ncr4 = (/nrow_zone,ncol_zone/) ; 5 rows, 5 columns
|
forrest@0
|
173 |
x4 = x2 ; Start and end x
|
forrest@0
|
174 |
y4 = y3 ; Start and end Y
|
forrest@0
|
175 |
text4 = new((/nrow_zone,ncol_zone/),string)
|
forrest@0
|
176 |
|
forrest@0
|
177 |
color_fill4 = new((/nrow_zone,ncol_zone/),string)
|
forrest@0
|
178 |
color_fill4 = "white"
|
forrest@0
|
179 |
color_fill4(:,ncol_zone-1) = "grey"
|
forrest@0
|
180 |
|
forrest@0
|
181 |
res4 = True ; Set up resource list
|
forrest@0
|
182 |
; res4@gsnDebug = True ; Useful to print NDC row,col values used.
|
forrest@0
|
183 |
res4@txFontHeightF = 0.02
|
forrest@0
|
184 |
res4@gsFillColor = color_fill4
|
forrest@0
|
185 |
|
forrest@0
|
186 |
delete (color_fill4)
|
forrest@0
|
187 |
|
forrest@0
|
188 |
;*******************************************************************
|
forrest@0
|
189 |
; for table -- station
|
forrest@0
|
190 |
;*******************************************************************
|
forrest@0
|
191 |
; column (not including header column)
|
forrest@0
|
192 |
col_header_sta = (/"Latitude","Longitude","Amplitude Ratio", \
|
forrest@0
|
193 |
"Correlation Coef","M score","Combined Score"/)
|
forrest@0
|
194 |
ncol_sta = dimsizes(col_header_sta )
|
forrest@0
|
195 |
;-------------------------------------------------------------------
|
forrest@0
|
196 |
|
forrest@0
|
197 |
; Table header
|
forrest@0
|
198 |
ncr5 = (/1,1/) ; 1 row, 1 column
|
forrest@0
|
199 |
x5 = (/0.005,0.15/) ; Start and end X
|
forrest@0
|
200 |
y5 = (/0.900,0.995/) ; Start and end Y
|
forrest@0
|
201 |
res5 = True
|
forrest@0
|
202 |
res5@txFontHeightF = 0.02
|
forrest@0
|
203 |
res5@gsFillColor = "CornFlowerBlue"
|
forrest@0
|
204 |
|
forrest@0
|
205 |
; Column header (equally space in x2)
|
forrest@0
|
206 |
ncr6 = (/1,ncol_sta/) ; 1 rows, 5 columns
|
forrest@0
|
207 |
x6 = (/x5(1),0.995/) ; start from end of x1
|
forrest@0
|
208 |
y6 = y5 ; same as y1
|
forrest@0
|
209 |
text6 = col_header_sta
|
forrest@0
|
210 |
res6 = True
|
forrest@0
|
211 |
res6@txFontHeightF = 0.012
|
forrest@0
|
212 |
res6@gsFillColor = "Gray"
|
forrest@0
|
213 |
|
forrest@0
|
214 |
; Row header (equally space in y2)
|
forrest@0
|
215 |
|
forrest@0
|
216 |
res7 = True
|
forrest@0
|
217 |
res7@txFontHeightF = 0.015
|
forrest@0
|
218 |
res7@gsFillColor = "Gray"
|
forrest@0
|
219 |
;--------------------------------------------------------------
|
forrest@0
|
220 |
; for station line plot
|
forrest@0
|
221 |
|
forrest@0
|
222 |
; for x-axis in xyplot
|
forrest@0
|
223 |
mon = ispan(1,12,1)
|
forrest@0
|
224 |
mon@long_name = "month"
|
forrest@0
|
225 |
|
forrest@0
|
226 |
plot_type = "ps"
|
forrest@0
|
227 |
plot_type_new = "png"
|
forrest@0
|
228 |
|
forrest@0
|
229 |
res = True ; plot mods desired
|
forrest@0
|
230 |
res@xyLineThicknesses = (/2.0,2.0,2.0/) ; make 2nd lines thicker
|
forrest@0
|
231 |
res@xyLineColors = (/"red","black"/) ; change line color
|
forrest@0
|
232 |
|
forrest@0
|
233 |
; Add a boxed legend using the more simple method
|
forrest@0
|
234 |
|
forrest@0
|
235 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
236 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
237 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
238 |
res@pmLegendHeightF = 0.06
|
forrest@0
|
239 |
; res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
240 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
241 |
res@pmLegendOrthogonalPosF = -0.30 ;(downward)
|
forrest@0
|
242 |
|
forrest@0
|
243 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
244 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
245 |
|
forrest@0
|
246 |
; res@lgPerimOn = False
|
forrest@0
|
247 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
248 |
res@xyExplicitLegendLabels = (/"b30.061n","observed"/)
|
forrest@0
|
249 |
;-------------------------------------------------------------------
|
forrest@0
|
250 |
|
forrest@0
|
251 |
do z = 0,nzone-1
|
forrest@0
|
252 |
|
forrest@0
|
253 |
if (z .eq. 0) then
|
forrest@0
|
254 |
; maximum score for the zone, 60N-90N
|
forrest@0
|
255 |
zone = "60N-90N"
|
forrest@0
|
256 |
score_max = 5.0
|
forrest@0
|
257 |
; index of stations in this zone
|
forrest@0
|
258 |
ind_z = ind(lat_ob .ge. 60.)
|
forrest@0
|
259 |
end if
|
forrest@0
|
260 |
|
forrest@0
|
261 |
if (z .eq. 1) then
|
forrest@0
|
262 |
; maximum score for the zone, 30N-60N
|
forrest@0
|
263 |
zone = "30N-60N"
|
forrest@0
|
264 |
score_max = 5.0
|
forrest@0
|
265 |
; index of stations in this zone
|
forrest@0
|
266 |
ind_z = ind(lat_ob .ge. 30. .and. lat_ob .lt. 60.)
|
forrest@0
|
267 |
end if
|
forrest@0
|
268 |
|
forrest@0
|
269 |
if (z .eq. 2) then
|
forrest@0
|
270 |
; maximum score for the zone, EQ-30N
|
forrest@0
|
271 |
zone = "EQ-30N"
|
forrest@0
|
272 |
score_max = 5.0
|
forrest@0
|
273 |
; index of stations in this zone
|
forrest@0
|
274 |
ind_z = ind(lat_ob .ge. 0. .and. lat_ob .lt. 30.)
|
forrest@0
|
275 |
end if
|
forrest@0
|
276 |
|
forrest@0
|
277 |
if (z .eq. 3) then
|
forrest@0
|
278 |
; maximum score for the zone, 90S-EQ
|
forrest@0
|
279 |
zone = "90S-EQ"
|
forrest@0
|
280 |
score_max = 5.0
|
forrest@0
|
281 |
; index of stations in this zone
|
forrest@0
|
282 |
ind_z = ind(lat_ob .lt. 0. )
|
forrest@0
|
283 |
end if
|
forrest@0
|
284 |
|
forrest@0
|
285 |
npts = dimsizes(ind_z)
|
forrest@0
|
286 |
|
forrest@0
|
287 |
;-------------------------------------------------------------------------
|
forrest@0
|
288 |
; for metric table computation
|
forrest@0
|
289 |
|
forrest@0
|
290 |
amp_ob = new((/npts/),float)
|
forrest@0
|
291 |
amp_model = new((/npts/),float)
|
forrest@0
|
292 |
|
forrest@0
|
293 |
amp_ratio_sta = new((/npts/),float)
|
forrest@0
|
294 |
ccr_sta = new((/npts/),float)
|
forrest@0
|
295 |
M_sta = new((/npts/),float)
|
forrest@0
|
296 |
score_sta = new((/npts/),float)
|
forrest@0
|
297 |
|
forrest@0
|
298 |
;----------------------
|
forrest@0
|
299 |
; for table -- station
|
forrest@0
|
300 |
;----------------------
|
forrest@0
|
301 |
|
forrest@0
|
302 |
; row (not including header row)
|
forrest@0
|
303 |
nrow_sta = npts
|
forrest@0
|
304 |
|
forrest@0
|
305 |
; Table header
|
forrest@0
|
306 |
ncr5 = (/1,1/) ; 1 row, 1 column
|
forrest@0
|
307 |
x5 = (/0.005,0.15/) ; Start and end X
|
forrest@0
|
308 |
y5 = (/0.900,0.995/) ; Start and end Y
|
forrest@0
|
309 |
res5 = True
|
forrest@0
|
310 |
res5@txFontHeightF = 0.02
|
forrest@0
|
311 |
res5@gsFillColor = "CornFlowerBlue"
|
forrest@0
|
312 |
|
forrest@0
|
313 |
; Column header (equally space in x2)
|
forrest@0
|
314 |
ncr6 = (/1,ncol_sta/) ; 1 rows, 5 columns
|
forrest@0
|
315 |
x6 = (/x1(1),0.995/) ; start from end of x1
|
forrest@0
|
316 |
y6 = y1 ; same as y1
|
forrest@0
|
317 |
text6 = col_header_sta
|
forrest@0
|
318 |
res6 = True
|
forrest@0
|
319 |
res6@txFontHeightF = 0.012
|
forrest@0
|
320 |
res6@gsFillColor = "Gray"
|
forrest@0
|
321 |
|
forrest@0
|
322 |
; Row header (equally space in y2)
|
forrest@0
|
323 |
ncr7 = (/nrow_sta,1/) ; 5 rows, 1 columns
|
forrest@0
|
324 |
x7 = x1 ; same as x1
|
forrest@0
|
325 |
; y7 = (/1.0-table_length_sta,0.900/) ; end at start of y1
|
forrest@0
|
326 |
text7 = new((/nrow_sta/),string)
|
forrest@0
|
327 |
res7 = True
|
forrest@0
|
328 |
res7@txFontHeightF = 0.015
|
forrest@0
|
329 |
res7@gsFillColor = "Gray"
|
forrest@0
|
330 |
;-------------------------------------------------------------------------
|
forrest@0
|
331 |
; for station line plot
|
forrest@0
|
332 |
|
forrest@0
|
333 |
npts_str = ""
|
forrest@0
|
334 |
npts_str = npts
|
forrest@0
|
335 |
|
forrest@0
|
336 |
plot_data = new((/2,12,npts/),float)
|
forrest@0
|
337 |
plot_data_0 = new((/12,npts/),float)
|
forrest@0
|
338 |
|
forrest@0
|
339 |
plot_data!0 = "case"
|
forrest@0
|
340 |
plot_data!1 = "month"
|
forrest@0
|
341 |
plot_data!2 = "pts"
|
forrest@0
|
342 |
plot_data@long_name = "CO2 Seasonal"
|
forrest@0
|
343 |
|
forrest@0
|
344 |
plot_data_0!0 = "month"
|
forrest@0
|
345 |
plot_data_0!1 = "pts"
|
forrest@0
|
346 |
plot_data_0@long_name = "CO2"
|
forrest@0
|
347 |
;--------------------------------------------------------------------------
|
forrest@0
|
348 |
do n=0,npts-1
|
forrest@0
|
349 |
amp_ob(n) = max(val_ob(ind_z(n),:)) - min(val_ob(ind_z(n),:))
|
forrest@0
|
350 |
amp_model(n) = max(val_model(ind_z(n),:)) - min(val_model(ind_z(n),:))
|
forrest@0
|
351 |
|
forrest@0
|
352 |
amp_ratio_sta(n) = amp_model(n)/amp_ob(n)
|
forrest@0
|
353 |
ccr_sta(n) = esccr(val_ob(ind_z(n),:),val_model(ind_z(n),:),0)
|
forrest@0
|
354 |
M_sta(n) = 1.-abs(amp_ratio_sta(n)-1.)
|
forrest@0
|
355 |
score_sta(n) = (ccr_sta(n)*ccr_sta(n) + M_sta(n))*0.5 * score_max
|
forrest@0
|
356 |
|
forrest@0
|
357 |
;----------------------------------------------------------------------
|
forrest@0
|
358 |
; for station line plot
|
forrest@0
|
359 |
|
forrest@0
|
360 |
plot_data(0,:,n) = (/val_model(ind_z(n),:)/)
|
forrest@0
|
361 |
plot_data(1,:,n) = (/val_ob(ind_z(n),:)/)
|
forrest@0
|
362 |
|
forrest@0
|
363 |
plot_data_0(:,n) = (/val_model_0(ind_z(n),:)/)
|
forrest@0
|
364 |
|
forrest@0
|
365 |
plot_name = sta(ind_z(n))
|
forrest@0
|
366 |
title = plot_name+"("+lat(ind_z(n))+","+lon(ind_z(n))+")"
|
forrest@0
|
367 |
|
forrest@0
|
368 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
369 |
;------------------------------------------
|
forrest@0
|
370 |
; for panel plot
|
forrest@0
|
371 |
|
forrest@0
|
372 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
373 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
374 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
375 |
|
forrest@0
|
376 |
pres = True ; panel plot mods desired
|
forrest@0
|
377 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
378 |
; indiv. plots in panel
|
forrest@0
|
379 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
380 |
;------------------------------------------
|
forrest@0
|
381 |
res@tiMainString = title ; add title
|
forrest@0
|
382 |
|
forrest@0
|
383 |
plot(0)=gsn_csm_xy(wks,mon,plot_data(:,:,n),res) ; create plot 1
|
forrest@0
|
384 |
|
forrest@0
|
385 |
plot(1)=gsn_csm_xy(wks,mon,plot_data_0(:,n),res) ; create plot 2
|
forrest@0
|
386 |
|
forrest@0
|
387 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
388 |
|
forrest@0
|
389 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
390 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
391 |
|
forrest@0
|
392 |
clear (wks)
|
forrest@0
|
393 |
;---------------------------------------------------------------------------
|
forrest@0
|
394 |
end do
|
forrest@0
|
395 |
;-------------------------------------------------------------------------
|
forrest@0
|
396 |
; for line plot in a zone
|
forrest@0
|
397 |
|
forrest@0
|
398 |
plot_name = "All_"+npts_str
|
forrest@0
|
399 |
title = plot_name + " in "+ zone
|
forrest@0
|
400 |
|
forrest@0
|
401 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
402 |
;-----------------------------------------
|
forrest@0
|
403 |
; for panel plot
|
forrest@0
|
404 |
|
forrest@0
|
405 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
406 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
407 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
408 |
|
forrest@0
|
409 |
pres = True ; panel plot mods desired
|
forrest@0
|
410 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
411 |
; indiv. plots in panel
|
forrest@0
|
412 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
413 |
;-----------------------------------------
|
forrest@0
|
414 |
res@tiMainString = title ; add title
|
forrest@0
|
415 |
|
forrest@0
|
416 |
plot(0) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data),res) ; create plot 1
|
forrest@0
|
417 |
|
forrest@0
|
418 |
plot(1) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data_0),res) ; create plot 2
|
forrest@0
|
419 |
|
forrest@0
|
420 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
421 |
|
forrest@0
|
422 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
423 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
424 |
|
forrest@0
|
425 |
clear (wks)
|
forrest@0
|
426 |
; delete (ind_z)
|
forrest@0
|
427 |
delete (plot_data)
|
forrest@0
|
428 |
delete (plot_data_0)
|
forrest@0
|
429 |
;---------------------------------------------------------------------------
|
forrest@0
|
430 |
; for zone table value
|
forrest@0
|
431 |
|
forrest@0
|
432 |
amp_ratio_zone = avg(amp_ratio_sta)
|
forrest@0
|
433 |
ccr_zone = avg(ccr_sta)
|
forrest@0
|
434 |
M_zone = 1.- (sum(abs(amp_model-amp_ob)/(amp_model+amp_ob))/npts)
|
forrest@0
|
435 |
score_zone = (ccr_zone*ccr_zone + M_zone)*0.5 * score_max
|
forrest@0
|
436 |
|
forrest@0
|
437 |
text4(z,0) = sprintf("%5.2f", npts)
|
forrest@0
|
438 |
text4(z,1) = sprintf("%5.2f", amp_ratio_zone)
|
forrest@0
|
439 |
text4(z,2) = sprintf("%5.2f", ccr_zone)
|
forrest@0
|
440 |
text4(z,3) = sprintf("%5.2f", M_zone)
|
forrest@0
|
441 |
text4(z,4) = sprintf("%5.2f", score_zone)
|
forrest@0
|
442 |
;---------------------------------------------------------------------------
|
forrest@0
|
443 |
; plot station table
|
forrest@0
|
444 |
;----------------------------------
|
forrest@0
|
445 |
; header value for station table
|
forrest@0
|
446 |
text5 = zone
|
forrest@0
|
447 |
|
forrest@0
|
448 |
; row value for station table
|
forrest@0
|
449 |
text7 = sta(ind_z)
|
forrest@0
|
450 |
|
forrest@0
|
451 |
if (z .eq. 0) then
|
forrest@0
|
452 |
table_length_sta = 0.5
|
forrest@0
|
453 |
end if
|
forrest@0
|
454 |
if (z .eq. 1) then
|
forrest@0
|
455 |
table_length_sta = 0.995
|
forrest@0
|
456 |
end if
|
forrest@0
|
457 |
if (z .eq. 2) then
|
forrest@0
|
458 |
table_length_sta = 0.8
|
forrest@0
|
459 |
end if
|
forrest@0
|
460 |
if (z .eq. 3) then
|
forrest@0
|
461 |
table_length_sta = 0.8
|
forrest@0
|
462 |
end if
|
forrest@0
|
463 |
|
forrest@0
|
464 |
x7 = x5
|
forrest@0
|
465 |
y7 = (/1.0-table_length_sta,0.900/) ; end at start of y1
|
forrest@0
|
466 |
|
forrest@0
|
467 |
; Main table body
|
forrest@0
|
468 |
ncr8 = (/nrow_sta,ncol_sta/) ; 5 rows, 5 columns
|
forrest@0
|
469 |
x8 = x6 ; Start and end x
|
forrest@0
|
470 |
y8 = y7 ; Start and end Y
|
forrest@0
|
471 |
text8 = new((/nrow_sta,ncol_sta/),string)
|
forrest@0
|
472 |
|
forrest@0
|
473 |
color_fill8 = text8
|
forrest@0
|
474 |
color_fill8 = "white"
|
forrest@0
|
475 |
color_fill8(:,ncol_sta-1) = "grey"
|
forrest@0
|
476 |
|
forrest@0
|
477 |
res8 = True ; Set up resource list
|
forrest@0
|
478 |
; res8@gsnDebug = True ; Useful to print NDC row,col values used.
|
forrest@0
|
479 |
res8@txFontHeightF = 0.02
|
forrest@0
|
480 |
res8@gsFillColor = color_fill8
|
forrest@0
|
481 |
|
forrest@0
|
482 |
delete (color_fill8)
|
forrest@0
|
483 |
|
forrest@0
|
484 |
; table value for station table
|
forrest@0
|
485 |
text8(:,0) = sprintf("%5.2f", (/lat(ind_z)/))
|
forrest@0
|
486 |
text8(:,1) = sprintf("%5.2f", (/lon(ind_z)/))
|
forrest@0
|
487 |
text8(:,2) = sprintf("%5.2f", (/amp_ratio_sta/))
|
forrest@0
|
488 |
text8(:,3) = sprintf("%5.2f", (/ccr_sta/))
|
forrest@0
|
489 |
text8(:,4) = sprintf("%5.2f", (/M_sta/))
|
forrest@0
|
490 |
text8(:,5) = sprintf("%5.2f", (/score_sta/))
|
forrest@0
|
491 |
|
forrest@0
|
492 |
plot_name = "table_sta." + zone
|
forrest@0
|
493 |
|
forrest@0
|
494 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
495 |
|
forrest@0
|
496 |
gsn_table(wks,ncr5,x5,y5,text5,res5)
|
forrest@0
|
497 |
gsn_table(wks,ncr6,x6,y6,text6,res6)
|
forrest@0
|
498 |
gsn_table(wks,ncr7,x7,y7,text7,res7)
|
forrest@0
|
499 |
gsn_table(wks,ncr8,x8,y8,text8,res8)
|
forrest@0
|
500 |
|
forrest@0
|
501 |
frame(wks)
|
forrest@0
|
502 |
|
forrest@0
|
503 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
504 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
505 |
|
forrest@0
|
506 |
delete (ind_z)
|
forrest@0
|
507 |
delete (amp_model)
|
forrest@0
|
508 |
delete (amp_ob)
|
forrest@0
|
509 |
delete (amp_ratio_sta)
|
forrest@0
|
510 |
delete (ccr_sta)
|
forrest@0
|
511 |
delete (M_sta)
|
forrest@0
|
512 |
delete (score_sta)
|
forrest@0
|
513 |
delete (text7)
|
forrest@0
|
514 |
delete (text8)
|
forrest@0
|
515 |
delete (res7)
|
forrest@0
|
516 |
delete (res8)
|
forrest@0
|
517 |
clear (wks)
|
forrest@0
|
518 |
end do
|
forrest@0
|
519 |
;**************************************************
|
forrest@0
|
520 |
; plot zone table
|
forrest@0
|
521 |
;**************************************************
|
forrest@0
|
522 |
|
forrest@0
|
523 |
text4(4,0) = sum(stringtofloat(text4(0:3,0)))
|
forrest@0
|
524 |
text4(4,1) = 0.
|
forrest@0
|
525 |
text4(4,2) = 0.
|
forrest@0
|
526 |
text4(4,3) = 0.
|
forrest@0
|
527 |
text4(4,4) = sum(stringtofloat(text4(0:3,4)))
|
forrest@0
|
528 |
|
forrest@0
|
529 |
plot_name = "table_zone"
|
forrest@0
|
530 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
531 |
|
forrest@0
|
532 |
gsn_table(wks,ncr1,x1,y1,text1,res1)
|
forrest@0
|
533 |
gsn_table(wks,ncr2,x2,y2,text2,res2)
|
forrest@0
|
534 |
gsn_table(wks,ncr3,x3,y3,text3,res3)
|
forrest@0
|
535 |
gsn_table(wks,ncr4,x4,y4,text4,res4)
|
forrest@0
|
536 |
|
forrest@0
|
537 |
frame(wks)
|
forrest@0
|
538 |
|
forrest@0
|
539 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
540 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
541 |
|
forrest@0
|
542 |
M_co2 = text4(4,4)
|
forrest@0
|
543 |
|
forrest@0
|
544 |
if (isvar("compare")) then
|
forrest@0
|
545 |
system("sed 1,/M_co2/s//"+M_co2+"/ "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
546 |
"mv -f "+html_new2+" "+html_name2)
|
forrest@0
|
547 |
end if
|
forrest@0
|
548 |
|
forrest@0
|
549 |
system("sed s#M_co2#"+M_co2+"# "+html_name+" > "+html_new+";"+ \
|
forrest@0
|
550 |
"mv -f "+html_new+" "+html_name)
|
forrest@0
|
551 |
;***************************************************************************
|
forrest@0
|
552 |
; output plots
|
forrest@0
|
553 |
;***************************************************************************
|
forrest@0
|
554 |
output_dir = model_name+"/co2"
|
forrest@0
|
555 |
|
forrest@0
|
556 |
system("mv *.png " + output_dir)
|
forrest@0
|
557 |
;***************************************************************************
|
forrest@0
|
558 |
end
|