forrest@0
|
1 |
; ***********************************************
|
forrest@0
|
2 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
3 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
4 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
5 |
load dirscript + "taylor_diagram.ncl"
|
forrest@0
|
6 |
;************************************************
|
forrest@0
|
7 |
procedure set_line(lines:string,nline:integer,newlines:string)
|
forrest@0
|
8 |
begin
|
forrest@0
|
9 |
; add line to ascci/html file
|
forrest@0
|
10 |
|
forrest@0
|
11 |
nnewlines = dimsizes(newlines)
|
forrest@0
|
12 |
if(nline+nnewlines-1.ge.dimsizes(lines))
|
forrest@0
|
13 |
print("set_line: bad index, not setting anything.")
|
forrest@0
|
14 |
return
|
forrest@0
|
15 |
end if
|
forrest@0
|
16 |
lines(nline:nline+nnewlines-1) = newlines
|
forrest@0
|
17 |
; print ("lines = " + lines(nline:nline+nnewlines-1))
|
forrest@0
|
18 |
nline = nline + nnewlines
|
forrest@0
|
19 |
return
|
forrest@0
|
20 |
end
|
forrest@0
|
21 |
;****************************************************************************
|
forrest@0
|
22 |
|
forrest@0
|
23 |
begin
|
forrest@0
|
24 |
|
forrest@0
|
25 |
plot_type = "ps"
|
forrest@0
|
26 |
plot_type_new = "png"
|
forrest@0
|
27 |
|
forrest@0
|
28 |
;-----------------------------------------------------
|
forrest@0
|
29 |
; edit table.html of current model for movel1_vs_model2
|
forrest@0
|
30 |
|
forrest@0
|
31 |
if (isvar("compare")) then
|
forrest@0
|
32 |
html_name2 = compare+"/table.html"
|
forrest@0
|
33 |
html_new2 = html_name2 +".new"
|
forrest@0
|
34 |
end if
|
forrest@0
|
35 |
|
forrest@0
|
36 |
;------------------------------------------------------
|
forrest@0
|
37 |
; edit table.html for current model
|
forrest@0
|
38 |
|
forrest@0
|
39 |
html_name = model_name+"/table.html"
|
forrest@0
|
40 |
html_new = html_name +".new"
|
forrest@0
|
41 |
|
forrest@0
|
42 |
;------------------------------------------------------
|
forrest@0
|
43 |
; read model data
|
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 |
delete (fm)
|
forrest@0
|
52 |
|
forrest@0
|
53 |
xdim = dimsizes(x)
|
forrest@0
|
54 |
nlev = xdim(1)
|
forrest@0
|
55 |
y = x(:,0,:,:)
|
forrest@0
|
56 |
|
forrest@0
|
57 |
; get co2 at the lowest level
|
forrest@0
|
58 |
y = x(:,nlev-1,:,:)
|
forrest@0
|
59 |
|
forrest@0
|
60 |
; change to unit of observed (u mol/mol)
|
forrest@0
|
61 |
; Model_units [=] kgCO2 / kgDryAir
|
forrest@0
|
62 |
; 28.966 = molecular weight of dry air
|
forrest@0
|
63 |
; 44. = molecular weight of CO2
|
forrest@0
|
64 |
; u mol = 1e-6 mol
|
forrest@0
|
65 |
|
forrest@0
|
66 |
factor = (28.966/44.) * 1e6
|
forrest@0
|
67 |
y = y * factor
|
forrest@0
|
68 |
|
forrest@0
|
69 |
y@_FillValue = 1.e36
|
forrest@0
|
70 |
y@units = "u mol/mol"
|
forrest@0
|
71 |
|
forrest@0
|
72 |
;************************************************
|
forrest@0
|
73 |
; read data: observed
|
forrest@0
|
74 |
;************************************************
|
forrest@0
|
75 |
diri = diro + "co2/"
|
forrest@0
|
76 |
fili = "co2_globalView_98.nc"
|
forrest@0
|
77 |
g = addfile (diri+fili,"r")
|
forrest@0
|
78 |
|
forrest@0
|
79 |
val = g->CO2_SEAS
|
forrest@0
|
80 |
lon = g->LON
|
forrest@0
|
81 |
lat = g->LAT
|
forrest@0
|
82 |
sta = chartostring(g->STATION)
|
forrest@0
|
83 |
|
forrest@0
|
84 |
delete (g)
|
forrest@0
|
85 |
|
forrest@0
|
86 |
ncase = dimsizes(lat)
|
forrest@0
|
87 |
;**************************************************************
|
forrest@0
|
88 |
; get only the lowest level at each station
|
forrest@0
|
89 |
;**************************************************************
|
forrest@0
|
90 |
lat_tmp = lat
|
forrest@0
|
91 |
lat_tmp@_FillValue = 1.e+36
|
forrest@0
|
92 |
|
forrest@0
|
93 |
do n = 0,ncase-1
|
forrest@0
|
94 |
if (.not. ismissing(lat_tmp(n))) then
|
forrest@0
|
95 |
indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon)
|
forrest@0
|
96 |
if (dimsizes(indexes) .gt. 1) then
|
forrest@0
|
97 |
lat_tmp(indexes(1:)) = lat_tmp@_FillValue
|
forrest@0
|
98 |
end if
|
forrest@0
|
99 |
delete (indexes)
|
forrest@0
|
100 |
end if
|
forrest@0
|
101 |
end do
|
forrest@0
|
102 |
|
forrest@0
|
103 |
indexes = ind(.not. ismissing(lat_tmp))
|
forrest@0
|
104 |
|
forrest@0
|
105 |
lat_ob = lat(indexes)
|
forrest@0
|
106 |
lon_ob = lon(indexes)
|
forrest@0
|
107 |
val_ob = val(indexes,:)
|
forrest@0
|
108 |
;************************************************************
|
forrest@0
|
109 |
; interpolate model data into observed station
|
forrest@0
|
110 |
; note: model is 0-360E, 90S-90N
|
forrest@0
|
111 |
;************************************************************
|
forrest@0
|
112 |
; to be able to handle observation at (-89.98,-24.80)
|
forrest@0
|
113 |
yi(0) = -90.
|
forrest@0
|
114 |
|
forrest@0
|
115 |
i = ind(lon_ob .lt. 0.)
|
forrest@0
|
116 |
lon_ob(i) = lon_ob(i) + 360.
|
forrest@0
|
117 |
|
forrest@0
|
118 |
yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0)
|
forrest@0
|
119 |
|
forrest@0
|
120 |
val_model = yo(pts|:,time|:)
|
forrest@0
|
121 |
val_model_0 = val_model
|
forrest@0
|
122 |
;************************************************************
|
forrest@0
|
123 |
; remove annual mean
|
forrest@0
|
124 |
;************************************************************
|
forrest@0
|
125 |
val_model = val_model - conform(val_model,dim_avg(val_model),0)
|
forrest@0
|
126 |
|
forrest@0
|
127 |
;*******************************************************************
|
forrest@0
|
128 |
; res for station line plot
|
forrest@0
|
129 |
;*******************************************************************
|
forrest@0
|
130 |
; for x-axis in xyplot
|
forrest@0
|
131 |
mon = ispan(1,12,1)
|
forrest@0
|
132 |
mon@long_name = "month"
|
forrest@0
|
133 |
|
forrest@0
|
134 |
res = True ; plot mods desired
|
forrest@0
|
135 |
res@xyLineThicknesses = (/2.0,2.0,2.0/) ; make 2nd lines thicker
|
forrest@0
|
136 |
res@xyLineColors = (/"red","blue"/) ; change line color
|
forrest@0
|
137 |
|
forrest@0
|
138 |
; Add a boxed legend using the more simple method
|
forrest@0
|
139 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
140 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
141 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
142 |
res@pmLegendHeightF = 0.06
|
forrest@0
|
143 |
; res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
144 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
145 |
res@pmLegendOrthogonalPosF = -0.30 ;(downward)
|
forrest@0
|
146 |
|
forrest@0
|
147 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
148 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
149 |
|
forrest@0
|
150 |
; res@lgPerimOn = False
|
forrest@0
|
151 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
152 |
res@xyExplicitLegendLabels = (/model_name,"observed"/)
|
forrest@0
|
153 |
;************************************************************
|
forrest@0
|
154 |
; number of latitude zone
|
forrest@0
|
155 |
;************************************************************
|
forrest@0
|
156 |
nzone = 4
|
forrest@0
|
157 |
|
forrest@0
|
158 |
; saving data for zone
|
forrest@0
|
159 |
; number of rows for zone table (with data)
|
forrest@0
|
160 |
nrow_zone = nzone
|
forrest@0
|
161 |
|
forrest@0
|
162 |
; number of columns for zone table
|
forrest@0
|
163 |
ncol_zone = 7
|
forrest@0
|
164 |
|
forrest@0
|
165 |
text = new((/nrow_zone,ncol_zone/),string)
|
forrest@0
|
166 |
|
forrest@0
|
167 |
do z = 0,nzone-1
|
forrest@0
|
168 |
|
forrest@0
|
169 |
if (z .eq. 0) then
|
forrest@0
|
170 |
zone = "60N-90N"
|
forrest@0
|
171 |
score_max = 5.0
|
forrest@0
|
172 |
ind_z = ind(lat_ob .ge. 60.)
|
forrest@0
|
173 |
end if
|
forrest@0
|
174 |
|
forrest@0
|
175 |
if (z .eq. 1) then
|
forrest@0
|
176 |
zone = "30N-60N"
|
forrest@0
|
177 |
score_max = 5.0
|
forrest@0
|
178 |
ind_z = ind(lat_ob .ge. 30. .and. lat_ob .lt. 60.)
|
forrest@0
|
179 |
end if
|
forrest@0
|
180 |
|
forrest@0
|
181 |
if (z .eq. 2) then
|
forrest@0
|
182 |
zone = "EQ-30N"
|
forrest@0
|
183 |
score_max = 5.0
|
forrest@0
|
184 |
ind_z = ind(lat_ob .ge. 0. .and. lat_ob .lt. 30.)
|
forrest@0
|
185 |
end if
|
forrest@0
|
186 |
|
forrest@0
|
187 |
if (z .eq. 3) then
|
forrest@0
|
188 |
zone = "90S-EQ"
|
forrest@0
|
189 |
score_max = 5.0
|
forrest@0
|
190 |
ind_z = ind(lat_ob .lt. 0. )
|
forrest@0
|
191 |
end if
|
forrest@0
|
192 |
|
forrest@0
|
193 |
npts = dimsizes(ind_z)
|
forrest@0
|
194 |
|
forrest@0
|
195 |
;------------------------------------------------------
|
forrest@0
|
196 |
; for metric table computation
|
forrest@0
|
197 |
amp_ob = new((/npts/),float)
|
forrest@0
|
198 |
amp_model = new((/npts/),float)
|
forrest@0
|
199 |
|
forrest@0
|
200 |
amp_ratio_sta = new((/npts/),float)
|
forrest@0
|
201 |
ccr_sta = new((/npts/),float)
|
forrest@0
|
202 |
M_sta = new((/npts/),float)
|
forrest@0
|
203 |
score_sta = new((/npts/),float)
|
forrest@0
|
204 |
|
forrest@0
|
205 |
var_sta = new((/npts/),float)
|
forrest@0
|
206 |
;-----------------------------------------------------
|
forrest@0
|
207 |
; for station line plot
|
forrest@0
|
208 |
npts_str = ""
|
forrest@0
|
209 |
npts_str = npts
|
forrest@0
|
210 |
|
forrest@0
|
211 |
plot_data = new((/2,12,npts/),float)
|
forrest@0
|
212 |
plot_data_0 = new((/12,npts/),float)
|
forrest@0
|
213 |
|
forrest@0
|
214 |
plot_data!0 = "case"
|
forrest@0
|
215 |
plot_data!1 = "month"
|
forrest@0
|
216 |
plot_data!2 = "pts"
|
forrest@0
|
217 |
plot_data@long_name = "CO2 Annual Cycle (ppm)"
|
forrest@0
|
218 |
|
forrest@0
|
219 |
plot_data_0!0 = "month"
|
forrest@0
|
220 |
plot_data_0!1 = "pts"
|
forrest@0
|
221 |
plot_data_0@long_name = "CO2 (ppm)"
|
forrest@0
|
222 |
;--------------------------------------------------------------------------
|
forrest@0
|
223 |
do n=0,npts-1
|
forrest@0
|
224 |
|
forrest@0
|
225 |
amp_ob(n) = max(val_ob(ind_z(n),:)) - min(val_ob(ind_z(n),:))
|
forrest@0
|
226 |
amp_model(n) = max(val_model(ind_z(n),:)) - min(val_model(ind_z(n),:))
|
forrest@0
|
227 |
|
forrest@0
|
228 |
amp_ratio_sta(n) = amp_model(n)/amp_ob(n)
|
forrest@0
|
229 |
ccr_sta(n) = esccr(val_ob(ind_z(n),:),val_model(ind_z(n),:),0)
|
forrest@0
|
230 |
M_sta(n) = 1.-abs(amp_ratio_sta(n)-1.)
|
forrest@0
|
231 |
score_sta(n) = (ccr_sta(n)*ccr_sta(n) + M_sta(n))*0.5 * score_max
|
forrest@0
|
232 |
|
forrest@0
|
233 |
var_model = stddev(val_model(ind_z(n),:))
|
forrest@0
|
234 |
var_ob = stddev(val_ob(ind_z(n),:))
|
forrest@0
|
235 |
var_sta(n)= var_model/var_ob
|
forrest@0
|
236 |
;----------------------------------------------------------------------
|
forrest@0
|
237 |
; for station line plot
|
forrest@0
|
238 |
|
forrest@0
|
239 |
plot_data(0,:,n) = (/val_model(ind_z(n),:)/)
|
forrest@0
|
240 |
plot_data(1,:,n) = (/val_ob(ind_z(n),:)/)
|
forrest@0
|
241 |
|
forrest@0
|
242 |
plot_data_0(:,n) = (/val_model_0(ind_z(n),:)/)
|
forrest@0
|
243 |
|
forrest@0
|
244 |
plot_name = sta(ind_z(n))
|
forrest@0
|
245 |
title = plot_name+" ("+lat(ind_z(n))+","+lon(ind_z(n))+")"
|
forrest@0
|
246 |
|
forrest@0
|
247 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
248 |
;------------------------------------------
|
forrest@0
|
249 |
; for panel plot
|
forrest@0
|
250 |
|
forrest@0
|
251 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
252 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
253 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
254 |
|
forrest@0
|
255 |
pres = True ; panel plot mods desired
|
forrest@0
|
256 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
257 |
; indiv. plots in panel
|
forrest@0
|
258 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
259 |
;------------------------------------------
|
forrest@0
|
260 |
res@tiMainString = title ; add title
|
forrest@0
|
261 |
|
forrest@0
|
262 |
plot(0)=gsn_csm_xy(wks,mon,plot_data(:,:,n),res) ; create plot 1
|
forrest@0
|
263 |
|
forrest@0
|
264 |
plot(1)=gsn_csm_xy(wks,mon,plot_data_0(:,n),res) ; create plot 2
|
forrest@0
|
265 |
|
forrest@0
|
266 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
267 |
|
forrest@0
|
268 |
delete (wks)
|
forrest@0
|
269 |
delete (plot)
|
forrest@0
|
270 |
|
forrest@0
|
271 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
272 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
273 |
|
forrest@0
|
274 |
;---------------------------------------------------------------------------
|
forrest@0
|
275 |
end do
|
forrest@0
|
276 |
|
forrest@0
|
277 |
;-------------------------------------------------------------------------
|
forrest@0
|
278 |
; for Taylor plot in a zone
|
forrest@0
|
279 |
|
forrest@0
|
280 |
; Cases [Model]
|
forrest@0
|
281 |
case = (/ model_name /)
|
forrest@0
|
282 |
nCase = dimsizes(case ) ; # of Cases [Cases]
|
forrest@0
|
283 |
|
forrest@0
|
284 |
; station compared
|
forrest@0
|
285 |
var = sta(ind_z)
|
forrest@0
|
286 |
nVar = dimsizes(var) ; # of stations
|
forrest@0
|
287 |
|
forrest@0
|
288 |
; arrays to be passed to taylor plot
|
forrest@0
|
289 |
ratio = new ((/nCase, nVar/),typeof(var_sta) )
|
forrest@0
|
290 |
cc = new ((/nCase, nVar/),typeof(ccr_sta) )
|
forrest@0
|
291 |
|
forrest@0
|
292 |
ratio(0,:) = var_sta
|
forrest@0
|
293 |
cc(0,:) = ccr_sta
|
forrest@0
|
294 |
|
forrest@0
|
295 |
;---------------------------------
|
forrest@0
|
296 |
; create plot
|
forrest@0
|
297 |
|
forrest@0
|
298 |
rest = True ; default taylor diagram
|
forrest@0
|
299 |
|
forrest@0
|
300 |
rest@Markers = (/16/) ; make all solid fill
|
forrest@0
|
301 |
rest@Colors = (/"red" /)
|
forrest@0
|
302 |
; rest@varLabels = var
|
forrest@0
|
303 |
rest@caseLabels = case
|
forrest@0
|
304 |
|
forrest@0
|
305 |
rOpts = True
|
forrest@0
|
306 |
rOpts@caseLabels = True
|
forrest@0
|
307 |
; rOpts@caseLabelsFontHeightF = 0.05
|
forrest@0
|
308 |
rOpts@caseLabelsFontHeightF = 0.15
|
forrest@0
|
309 |
|
forrest@0
|
310 |
plot_name = "taylor_diagram_"+ zone
|
forrest@0
|
311 |
title = "CO2 Annual Cycle: "+ zone
|
forrest@0
|
312 |
rest@tiMainString = title
|
forrest@0
|
313 |
|
forrest@0
|
314 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
315 |
plot = taylor_diagram(wks,ratio,cc,rest)
|
forrest@0
|
316 |
|
forrest@0
|
317 |
delete (wks)
|
forrest@0
|
318 |
delete (plot)
|
forrest@0
|
319 |
|
forrest@0
|
320 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
321 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
322 |
|
forrest@0
|
323 |
delete (ratio)
|
forrest@0
|
324 |
delete (cc)
|
forrest@0
|
325 |
delete (var_sta)
|
forrest@0
|
326 |
delete (var)
|
forrest@0
|
327 |
|
forrest@0
|
328 |
;-------------------------------------------------------------------------
|
forrest@0
|
329 |
; for line plot in a zone
|
forrest@0
|
330 |
|
forrest@0
|
331 |
plot_name = "All_"+npts_str
|
forrest@0
|
332 |
title = plot_name + " in "+ zone
|
forrest@0
|
333 |
|
forrest@0
|
334 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
335 |
;-----------------------------------------
|
forrest@0
|
336 |
; for panel plot
|
forrest@0
|
337 |
|
forrest@0
|
338 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
339 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
340 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
341 |
|
forrest@0
|
342 |
pres = True ; panel plot mods desired
|
forrest@0
|
343 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
344 |
; indiv. plots in panel
|
forrest@0
|
345 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
346 |
;-----------------------------------------
|
forrest@0
|
347 |
res@tiMainString = title ; add title
|
forrest@0
|
348 |
|
forrest@0
|
349 |
plot(0) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data),res) ; create plot 1
|
forrest@0
|
350 |
|
forrest@0
|
351 |
plot(1) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data_0),res) ; create plot 2
|
forrest@0
|
352 |
|
forrest@0
|
353 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
354 |
|
forrest@0
|
355 |
delete (wks)
|
forrest@0
|
356 |
delete (plot)
|
forrest@0
|
357 |
|
forrest@0
|
358 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
359 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
360 |
|
forrest@0
|
361 |
delete (plot_data)
|
forrest@0
|
362 |
delete (plot_data_0)
|
forrest@0
|
363 |
;---------------------------------------------------------------------------
|
forrest@0
|
364 |
; values saved for zone table
|
forrest@0
|
365 |
|
forrest@0
|
366 |
amp_ratio_zone = avg(amp_ratio_sta)
|
forrest@0
|
367 |
ccr_zone = avg(ccr_sta)
|
forrest@0
|
368 |
M_zone = 1.- (sum(abs(amp_model-amp_ob)/(amp_model+amp_ob))/npts)
|
forrest@0
|
369 |
score_zone = (ccr_zone*ccr_zone + M_zone)*0.5 * score_max
|
forrest@0
|
370 |
|
forrest@0
|
371 |
text(z,0) = zone
|
forrest@0
|
372 |
text(z,1) = sprintf("%.0f", npts)
|
forrest@0
|
373 |
text(z,2) = sprintf("%.2f", amp_ratio_zone)
|
forrest@0
|
374 |
text(z,3) = sprintf("%.2f", ccr_zone)
|
forrest@0
|
375 |
text(z,4) = sprintf("%.2f", M_zone)
|
forrest@0
|
376 |
text(z,5) = sprintf("%.2f", score_zone)
|
forrest@0
|
377 |
text(z,6) = zone
|
forrest@0
|
378 |
|
forrest@0
|
379 |
;*******************************************************************
|
forrest@0
|
380 |
; html table -- station
|
forrest@0
|
381 |
;*******************************************************************
|
forrest@0
|
382 |
output_html = "score+line_"+zone+".html"
|
forrest@0
|
383 |
|
forrest@0
|
384 |
header = (/"<HTML>" \
|
forrest@0
|
385 |
,"<HEAD>" \
|
forrest@0
|
386 |
,"<TITLE>CLAMP metrics</TITLE>" \
|
forrest@0
|
387 |
,"</HEAD>" \
|
forrest@0
|
388 |
,"<H1>Latitude Zone "+zone+": Model "+model_name+"</H1>" \
|
forrest@0
|
389 |
/)
|
forrest@0
|
390 |
footer = "</HTML>"
|
forrest@0
|
391 |
|
forrest@0
|
392 |
table_header = (/ \
|
forrest@0
|
393 |
"<table border=1 cellspacing=0 cellpadding=3 width=100%>" \
|
forrest@0
|
394 |
,"<tr>" \
|
forrest@0
|
395 |
," <th bgcolor=DDDDDD >Site Name</th>" \
|
forrest@0
|
396 |
," <th bgcolor=DDDDDD >Latitude</th>" \
|
forrest@0
|
397 |
," <th bgcolor=DDDDDD >Longitude</th>" \
|
forrest@0
|
398 |
," <th bgcolor=DDDDDD >model vs obs.<br>amplitude ratio</th>" \
|
forrest@0
|
399 |
," <th bgcolor=DDDDDD >Correlation Coef.</th>" \
|
forrest@0
|
400 |
," <th bgcolor=DDDDDD >M Score</th>" \
|
forrest@0
|
401 |
," <th bgcolor=DDDDDD >Combined Score</th>" \
|
forrest@0
|
402 |
,"</tr>" \
|
forrest@0
|
403 |
/)
|
forrest@0
|
404 |
table_footer = "</table>"
|
forrest@0
|
405 |
row_header = "<tr>"
|
forrest@0
|
406 |
row_footer = "</tr>"
|
forrest@0
|
407 |
|
forrest@0
|
408 |
lines = new(50000,string)
|
forrest@0
|
409 |
nline = 0
|
forrest@0
|
410 |
|
forrest@0
|
411 |
set_line(lines,nline,header)
|
forrest@0
|
412 |
set_line(lines,nline,table_header)
|
forrest@0
|
413 |
;-----------------------------------------------
|
forrest@0
|
414 |
; row of table
|
forrest@0
|
415 |
|
forrest@0
|
416 |
do n = 0,npts-1
|
forrest@0
|
417 |
set_line(lines,nline,row_header)
|
forrest@0
|
418 |
|
forrest@0
|
419 |
txt0 = sta(ind_z(n))
|
forrest@0
|
420 |
txt1 = sprintf("%5.2f", (/lat(ind_z(n))/))
|
forrest@0
|
421 |
txt2 = sprintf("%5.2f", (/lon(ind_z(n))/))
|
forrest@0
|
422 |
txt3 = sprintf("%5.2f", (/amp_ratio_sta(n)/))
|
forrest@0
|
423 |
txt4 = sprintf("%5.2f", (/ccr_sta(n)/))
|
forrest@0
|
424 |
txt5 = sprintf("%5.2f", (/M_sta(n)/))
|
forrest@0
|
425 |
txt6 = sprintf("%5.2f", (/score_sta(n)/))
|
forrest@0
|
426 |
|
forrest@0
|
427 |
set_line(lines,nline,"<th><a href="+txt0+".png>"+txt0+"</a></th>")
|
forrest@0
|
428 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
429 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
430 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
431 |
set_line(lines,nline,"<th>"+txt4+"</th>")
|
forrest@0
|
432 |
set_line(lines,nline,"<th>"+txt5+"</th>")
|
forrest@0
|
433 |
set_line(lines,nline,"<th>"+txt6+"</th>")
|
forrest@0
|
434 |
|
forrest@0
|
435 |
set_line(lines,nline,row_footer)
|
forrest@0
|
436 |
end do
|
forrest@0
|
437 |
|
forrest@0
|
438 |
; last row, summary
|
forrest@0
|
439 |
set_line(lines,nline,row_header)
|
forrest@0
|
440 |
|
forrest@0
|
441 |
txt0 = "All_"+sprintf("%.0f", (/npts/))
|
forrest@0
|
442 |
txt1 = "-"
|
forrest@0
|
443 |
txt2 = "-"
|
forrest@0
|
444 |
txt3 = sprintf("%5.2f", (/amp_ratio_zone/))
|
forrest@0
|
445 |
txt4 = sprintf("%5.2f", (/ccr_zone/))
|
forrest@0
|
446 |
txt5 = sprintf("%5.2f", (/M_zone/))
|
forrest@0
|
447 |
txt6 = sprintf("%5.2f", (/score_zone/))
|
forrest@0
|
448 |
|
forrest@0
|
449 |
set_line(lines,nline,"<th><a href="+txt0+".png>"+txt0+"</a></th>")
|
forrest@0
|
450 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
451 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
452 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
453 |
set_line(lines,nline,"<th>"+txt4+"</th>")
|
forrest@0
|
454 |
set_line(lines,nline,"<th>"+txt5+"</th>")
|
forrest@0
|
455 |
set_line(lines,nline,"<th>"+txt6+"</th>")
|
forrest@0
|
456 |
|
forrest@0
|
457 |
set_line(lines,nline,row_footer)
|
forrest@0
|
458 |
;-----------------------------------------------
|
forrest@0
|
459 |
set_line(lines,nline,table_footer)
|
forrest@0
|
460 |
set_line(lines,nline,footer)
|
forrest@0
|
461 |
|
forrest@0
|
462 |
; Now write to an HTML file.
|
forrest@0
|
463 |
idx = ind(.not.ismissing(lines))
|
forrest@0
|
464 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
465 |
asciiwrite(output_html,lines(idx))
|
forrest@0
|
466 |
else
|
forrest@0
|
467 |
print ("error?")
|
forrest@0
|
468 |
end if
|
forrest@0
|
469 |
delete (idx)
|
forrest@0
|
470 |
;-----------------------------------------------------------------
|
forrest@0
|
471 |
|
forrest@0
|
472 |
delete (ind_z)
|
forrest@0
|
473 |
delete (amp_model)
|
forrest@0
|
474 |
delete (amp_ob)
|
forrest@0
|
475 |
delete (amp_ratio_sta)
|
forrest@0
|
476 |
delete (ccr_sta)
|
forrest@0
|
477 |
delete (M_sta)
|
forrest@0
|
478 |
delete (score_sta)
|
forrest@0
|
479 |
end do
|
forrest@0
|
480 |
|
forrest@0
|
481 |
;*******************************************************************
|
forrest@0
|
482 |
; html table -- zone
|
forrest@0
|
483 |
;*******************************************************************
|
forrest@0
|
484 |
output_html = "score+line_vs_ob.html"
|
forrest@0
|
485 |
|
forrest@0
|
486 |
header = (/"<HTML>" \
|
forrest@0
|
487 |
,"<HEAD>" \
|
forrest@0
|
488 |
,"<TITLE>CLAMP metrics</TITLE>" \
|
forrest@0
|
489 |
,"</HEAD>" \
|
forrest@0
|
490 |
,"<H1>CO2 Seasonal Cycle Comparisons by Latitude Zone: Model "+model_name+"</H1>" \
|
forrest@0
|
491 |
/)
|
forrest@0
|
492 |
footer = "</HTML>"
|
forrest@0
|
493 |
|
forrest@0
|
494 |
delete (table_header)
|
forrest@0
|
495 |
table_header = (/ \
|
forrest@0
|
496 |
"<table border=1 cellspacing=0 cellpadding=3 width=80%>" \
|
forrest@0
|
497 |
,"<tr>" \
|
forrest@0
|
498 |
," <th bgcolor=DDDDDD >Zone</th>" \
|
forrest@0
|
499 |
," <th bgcolor=DDDDDD >Number of Site</th>" \
|
forrest@0
|
500 |
," <th bgcolor=DDDDDD >model vs obs.<br>amplitide ratio</th>" \
|
forrest@0
|
501 |
," <th bgcolor=DDDDDD >Correlation Coef.</th>" \
|
forrest@0
|
502 |
," <th bgcolor=DDDDDD >M Score</th>" \
|
forrest@0
|
503 |
," <th bgcolor=DDDDDD >Combined Score</th>" \
|
forrest@0
|
504 |
," <th bgcolor=DDDDDD >Taylor diagram</th>" \
|
forrest@0
|
505 |
,"</tr>" \
|
forrest@0
|
506 |
/)
|
forrest@0
|
507 |
table_footer = "</table>"
|
forrest@0
|
508 |
row_header = "<tr>"
|
forrest@0
|
509 |
row_footer = "</tr>"
|
forrest@0
|
510 |
|
forrest@0
|
511 |
lines = new(50000,string)
|
forrest@0
|
512 |
nline = 0
|
forrest@0
|
513 |
|
forrest@0
|
514 |
set_line(lines,nline,header)
|
forrest@0
|
515 |
set_line(lines,nline,table_header)
|
forrest@0
|
516 |
;-----------------------------------------------
|
forrest@0
|
517 |
;row of table
|
forrest@0
|
518 |
|
forrest@0
|
519 |
do n = 0,nrow_zone-1
|
forrest@0
|
520 |
set_line(lines,nline,row_header)
|
forrest@0
|
521 |
|
forrest@0
|
522 |
set_line(lines,nline,"<th><a href=score+line_"+text(n,0)+".html>"+text(n,0)+"</th>")
|
forrest@0
|
523 |
set_line(lines,nline,"<th>"+text(n,1)+"</th>")
|
forrest@0
|
524 |
set_line(lines,nline,"<th>"+text(n,2)+"</th>")
|
forrest@0
|
525 |
set_line(lines,nline,"<th>"+text(n,3)+"</th>")
|
forrest@0
|
526 |
set_line(lines,nline,"<th>"+text(n,4)+"</th>")
|
forrest@0
|
527 |
set_line(lines,nline,"<th>"+text(n,5)+"</th>")
|
forrest@0
|
528 |
set_line(lines,nline,"<th><a href=taylor_diagram_"+text(n,6)+".png>Taylor_diagram</th>")
|
forrest@0
|
529 |
|
forrest@0
|
530 |
set_line(lines,nline,row_footer)
|
forrest@0
|
531 |
end do
|
forrest@0
|
532 |
|
forrest@0
|
533 |
; for the last row
|
forrest@0
|
534 |
|
forrest@0
|
535 |
txt0 = "All"
|
forrest@0
|
536 |
txt1 = sum(stringtofloat(text(0:3,1)))
|
forrest@0
|
537 |
txt2 = "-"
|
forrest@0
|
538 |
txt3 = "-"
|
forrest@0
|
539 |
txt4 = "-"
|
forrest@0
|
540 |
txt5 = sum(stringtofloat(text(0:3,5)))
|
forrest@0
|
541 |
txt6 = "-"
|
forrest@0
|
542 |
|
forrest@0
|
543 |
set_line(lines,nline,row_header)
|
forrest@0
|
544 |
|
forrest@0
|
545 |
set_line(lines,nline,"<th>"+txt0+"</th>")
|
forrest@0
|
546 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
547 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
548 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
549 |
set_line(lines,nline,"<th>"+txt4+"</th>")
|
forrest@0
|
550 |
set_line(lines,nline,"<th>"+txt5+"</th>")
|
forrest@0
|
551 |
set_line(lines,nline,"<th>"+txt6+"</th>")
|
forrest@0
|
552 |
|
forrest@0
|
553 |
set_line(lines,nline,row_footer)
|
forrest@0
|
554 |
;-----------------------------------------------
|
forrest@0
|
555 |
set_line(lines,nline,table_footer)
|
forrest@0
|
556 |
set_line(lines,nline,footer)
|
forrest@0
|
557 |
|
forrest@0
|
558 |
; Now write to an HTML file.
|
forrest@0
|
559 |
idx = ind(.not.ismissing(lines))
|
forrest@0
|
560 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
561 |
asciiwrite(output_html,lines(idx))
|
forrest@0
|
562 |
else
|
forrest@0
|
563 |
print ("error?")
|
forrest@0
|
564 |
end if
|
forrest@0
|
565 |
delete (idx)
|
forrest@0
|
566 |
;--------------------------------------------------------------------------
|
forrest@0
|
567 |
|
forrest@0
|
568 |
M_co2 = txt5
|
forrest@0
|
569 |
|
forrest@0
|
570 |
if (isvar("compare")) then
|
forrest@0
|
571 |
|
forrest@0
|
572 |
system("sed -e '1,/M_co2/s/M_co2/"+M_co2+"/' "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
573 |
"mv -f "+html_new2+" "+html_name2)
|
forrest@0
|
574 |
end if
|
forrest@0
|
575 |
|
forrest@0
|
576 |
system("sed s#M_co2#"+M_co2+"# "+html_name+" > "+html_new+";"+ \
|
forrest@0
|
577 |
"mv -f "+html_new+" "+html_name)
|
forrest@0
|
578 |
|
forrest@0
|
579 |
;***************************************************************************
|
forrest@0
|
580 |
; add total score and write to file
|
forrest@0
|
581 |
;***************************************************************************
|
forrest@0
|
582 |
M_total = M_co2
|
forrest@0
|
583 |
|
forrest@0
|
584 |
asciiwrite("M_save.co2", M_total)
|
forrest@0
|
585 |
|
forrest@0
|
586 |
;***************************************************************************
|
forrest@0
|
587 |
; output plots
|
forrest@0
|
588 |
;***************************************************************************
|
forrest@0
|
589 |
output_dir = model_name+"/co2"
|
forrest@0
|
590 |
|
forrest@0
|
591 |
system("mv *.png *.html " + output_dir)
|
forrest@0
|
592 |
;***************************************************************************
|
forrest@0
|
593 |
end
|