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 |
;**************************************************************
|
forrest@0
|
6 |
procedure set_line(lines:string,nline:integer,newlines:string)
|
forrest@0
|
7 |
begin
|
forrest@0
|
8 |
; add line to ascci/html file
|
forrest@0
|
9 |
|
forrest@0
|
10 |
nnewlines = dimsizes(newlines)
|
forrest@0
|
11 |
if(nline+nnewlines-1.ge.dimsizes(lines))
|
forrest@0
|
12 |
print("set_line: bad index, not setting anything.")
|
forrest@0
|
13 |
return
|
forrest@0
|
14 |
end if
|
forrest@0
|
15 |
lines(nline:nline+nnewlines-1) = newlines
|
forrest@0
|
16 |
; print ("lines = " + lines(nline:nline+nnewlines-1))
|
forrest@0
|
17 |
nline = nline + nnewlines
|
forrest@0
|
18 |
return
|
forrest@0
|
19 |
end
|
forrest@0
|
20 |
;**************************************************************
|
forrest@0
|
21 |
; Main code.
|
forrest@0
|
22 |
begin
|
forrest@0
|
23 |
|
forrest@0
|
24 |
plot_type = "ps"
|
forrest@0
|
25 |
plot_type_new = "png"
|
forrest@0
|
26 |
|
forrest@0
|
27 |
;-----------------------------------------------------
|
forrest@0
|
28 |
; edit table.html of current model for movel1_vs_model2
|
forrest@0
|
29 |
|
forrest@0
|
30 |
if (isvar("compare")) then
|
forrest@0
|
31 |
html_name2 = compare+"/table.html"
|
forrest@0
|
32 |
html_new2 = html_name2 +".new"
|
forrest@0
|
33 |
end if
|
forrest@0
|
34 |
|
forrest@0
|
35 |
;------------------------------------------------------
|
forrest@0
|
36 |
; edit table.html for current model
|
forrest@0
|
37 |
|
forrest@0
|
38 |
html_name = model_name+"/table.html"
|
forrest@0
|
39 |
html_new = html_name +".new"
|
forrest@0
|
40 |
|
forrest@0
|
41 |
;------------------------------------------------------
|
forrest@0
|
42 |
; read data: model
|
forrest@0
|
43 |
|
forrest@0
|
44 |
fm = addfile(dirm+film10,"r")
|
forrest@0
|
45 |
laimod = fm->TLAI
|
forrest@0
|
46 |
|
forrest@0
|
47 |
delete (fm)
|
forrest@0
|
48 |
|
forrest@0
|
49 |
dsizes = dimsizes(laimod)
|
forrest@0
|
50 |
ntime = dsizes(0)
|
forrest@0
|
51 |
nlat = dsizes(1)
|
forrest@0
|
52 |
nlon = dsizes(2)
|
forrest@0
|
53 |
|
forrest@0
|
54 |
;-----------------------------------
|
forrest@0
|
55 |
; get landfrac data
|
forrest@0
|
56 |
|
forrest@0
|
57 |
film_l = "lnd_"+ model_grid + ".nc"
|
forrest@0
|
58 |
fm_l = addfile (dirs+film_l,"r")
|
forrest@0
|
59 |
landfrac = fm_l->landfrac
|
forrest@0
|
60 |
|
forrest@0
|
61 |
delete (fm_l)
|
forrest@0
|
62 |
;----------------------------------
|
forrest@0
|
63 |
; read biome data: model
|
forrest@0
|
64 |
|
forrest@0
|
65 |
biome_name_mod = "Model PFT Class"
|
forrest@0
|
66 |
|
forrest@0
|
67 |
film_c = "class_pft_"+model_grid+".nc"
|
forrest@0
|
68 |
fm_c = addfile(dirs+film_c,"r")
|
forrest@0
|
69 |
classmod = fm_c->CLASS_PFT
|
forrest@0
|
70 |
|
forrest@0
|
71 |
delete (fm_c)
|
forrest@0
|
72 |
|
forrest@0
|
73 |
; model data has 17 land-type classes
|
forrest@0
|
74 |
nclass_mod = 17
|
forrest@0
|
75 |
|
forrest@0
|
76 |
;----------------------------------------------------------
|
forrest@0
|
77 |
; read data: ob
|
forrest@0
|
78 |
|
forrest@0
|
79 |
;----------------------------------
|
forrest@0
|
80 |
; read biome data: observed
|
forrest@0
|
81 |
|
forrest@0
|
82 |
biome_name_ob = "MODIS LandCover"
|
forrest@0
|
83 |
|
forrest@0
|
84 |
dir_c = diro + "lai/"
|
forrest@0
|
85 |
filo_c = "land_class_"+model_grid+".nc"
|
forrest@0
|
86 |
fo = addfile(dir_c+filo_c,"r")
|
forrest@0
|
87 |
classob = tofloat(fo->LAND_CLASS)
|
forrest@0
|
88 |
|
forrest@0
|
89 |
delete (fo)
|
forrest@0
|
90 |
|
forrest@0
|
91 |
; input observed data has 20 land-type classes
|
forrest@0
|
92 |
nclass_ob = 20
|
forrest@0
|
93 |
|
forrest@0
|
94 |
;---------------------------------
|
forrest@0
|
95 |
; read lai data: observed
|
forrest@0
|
96 |
|
forrest@0
|
97 |
;ob_name = "MODIS MOD 15A2 2000-2005"
|
forrest@0
|
98 |
ob_name = "MODIS MOD 15A2 2000-2004"
|
forrest@0
|
99 |
|
forrest@0
|
100 |
dir_l = diro + "lai/"
|
forrest@0
|
101 |
;filo = "LAI_2000-2005_MONS_"+model_grid+".nc"
|
forrest@0
|
102 |
filo = "LAI_2000-2004_MONS_"+model_grid+".nc"
|
forrest@0
|
103 |
fo = addfile(dir_l+filo,"r")
|
forrest@0
|
104 |
laiob = fo->LAI
|
forrest@0
|
105 |
|
forrest@0
|
106 |
delete (fo)
|
forrest@0
|
107 |
|
forrest@0
|
108 |
;-------------------------------------------------
|
forrest@0
|
109 |
; take into account landfrac
|
forrest@0
|
110 |
|
forrest@0
|
111 |
laimod = laimod * conform(laimod,landfrac,(/1,2/))
|
forrest@0
|
112 |
laiob = laiob * conform(laiob ,landfrac,(/1,2/))
|
forrest@0
|
113 |
|
forrest@0
|
114 |
delete (landfrac)
|
forrest@0
|
115 |
|
forrest@0
|
116 |
;************************************************
|
forrest@0
|
117 |
; global res
|
forrest@0
|
118 |
;************************************************
|
forrest@0
|
119 |
resg = True ; Use plot options
|
forrest@0
|
120 |
resg@cnFillOn = True ; Turn on color fill
|
forrest@0
|
121 |
resg@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
122 |
resg@cnLinesOn = False ; Turn off contourn lines
|
forrest@0
|
123 |
resg@mpFillOn = False ; Turn off map fill
|
forrest@0
|
124 |
resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
|
forrest@0
|
125 |
|
forrest@0
|
126 |
;************************************************
|
forrest@0
|
127 |
; plot global biome class: (1) observed
|
forrest@0
|
128 |
;************************************************
|
forrest@0
|
129 |
|
forrest@0
|
130 |
resg@cnMinLevelValF = 1. ; Min level
|
forrest@0
|
131 |
resg@cnMaxLevelValF = 19. ; Max level
|
forrest@0
|
132 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
133 |
|
forrest@0
|
134 |
classob@_FillValue = 1.e+36
|
forrest@0
|
135 |
classob = where(classob.eq.0,classob@_FillValue,classob)
|
forrest@0
|
136 |
|
forrest@0
|
137 |
plot_name = "global_class_ob"
|
forrest@0
|
138 |
title = biome_name_ob
|
forrest@0
|
139 |
resg@tiMainString = title
|
forrest@0
|
140 |
|
forrest@0
|
141 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
142 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
143 |
|
forrest@0
|
144 |
plot = gsn_csm_contour_map_ce(wks,classob,resg)
|
forrest@0
|
145 |
|
forrest@0
|
146 |
delete (wks)
|
forrest@0
|
147 |
|
forrest@0
|
148 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
149 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
150 |
|
forrest@0
|
151 |
;************************************************
|
forrest@0
|
152 |
; plot global biome class: (2) model
|
forrest@0
|
153 |
;************************************************
|
forrest@0
|
154 |
|
forrest@0
|
155 |
resg@cnMinLevelValF = 0. ; Min level
|
forrest@0
|
156 |
resg@cnMaxLevelValF = 16. ; Max level
|
forrest@0
|
157 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
158 |
|
forrest@0
|
159 |
plot_name = "global_class_model"
|
forrest@0
|
160 |
title = biome_name_mod
|
forrest@0
|
161 |
resg@tiMainString = title
|
forrest@0
|
162 |
|
forrest@0
|
163 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
164 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
165 |
|
forrest@0
|
166 |
plot = gsn_csm_contour_map_ce(wks,classmod,resg)
|
forrest@0
|
167 |
|
forrest@0
|
168 |
delete (wks)
|
forrest@0
|
169 |
|
forrest@0
|
170 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
171 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
172 |
|
forrest@0
|
173 |
;*******************************************************************
|
forrest@0
|
174 |
; for html table : all 3 components (Mean, Max, Phase)
|
forrest@0
|
175 |
;*******************************************************************
|
forrest@0
|
176 |
|
forrest@0
|
177 |
; column (not including header column)
|
forrest@0
|
178 |
|
forrest@0
|
179 |
component = (/"Mean","Max","Phase"/)
|
forrest@0
|
180 |
|
forrest@0
|
181 |
col_head = (/"observed",model_name,"M_score" \
|
forrest@0
|
182 |
,"observed",model_name,"M_score" \
|
forrest@0
|
183 |
,"observed",model_name,"M_score" \
|
forrest@0
|
184 |
/)
|
forrest@0
|
185 |
|
forrest@0
|
186 |
n_comp = dimsizes(component)
|
forrest@0
|
187 |
ncol = dimsizes(col_head )
|
forrest@0
|
188 |
|
forrest@0
|
189 |
; row (not including header row)
|
forrest@0
|
190 |
|
forrest@0
|
191 |
;----------------------------------------------------
|
forrest@0
|
192 |
; using model biome class:
|
forrest@0
|
193 |
row_head = (/"Not Vegetated" \
|
forrest@0
|
194 |
,"Needleleaf Evergreen Temperate Tree" \
|
forrest@0
|
195 |
,"Needleleaf Evergreen Boreal Tree" \
|
forrest@0
|
196 |
; ,"Needleleaf Deciduous Boreal Tree" \
|
forrest@0
|
197 |
,"Broadleaf Evergreen Tropical Tree" \
|
forrest@0
|
198 |
,"Broadleaf Evergreen Temperate Tree" \
|
forrest@0
|
199 |
,"Broadleaf Deciduous Tropical Tree" \
|
forrest@0
|
200 |
,"Broadleaf Deciduous Temperate Tree" \
|
forrest@0
|
201 |
; ,"Broadleaf Deciduous Boreal Tree" \
|
forrest@0
|
202 |
; ,"Broadleaf Evergreen Shrub" \
|
forrest@0
|
203 |
,"Broadleaf Deciduous Temperate Shrub" \
|
forrest@0
|
204 |
,"Broadleaf Deciduous Boreal Shrub" \
|
forrest@0
|
205 |
,"C3 Arctic Grass" \
|
forrest@0
|
206 |
,"C3 Non-Arctic Grass" \
|
forrest@0
|
207 |
,"C4 Grass" \
|
forrest@0
|
208 |
,"Corn" \
|
forrest@0
|
209 |
; ,"Wheat" \
|
forrest@0
|
210 |
,"All Biomes" \
|
forrest@0
|
211 |
/)
|
forrest@0
|
212 |
|
forrest@0
|
213 |
nrow = dimsizes(row_head)
|
forrest@0
|
214 |
|
forrest@0
|
215 |
; arrays to be passed to table.
|
forrest@0
|
216 |
text = new ((/nrow, ncol/),string )
|
forrest@0
|
217 |
|
forrest@0
|
218 |
; total M_score
|
forrest@0
|
219 |
M_total = 0.
|
forrest@0
|
220 |
|
forrest@0
|
221 |
;********************************************************************
|
forrest@0
|
222 |
; use land-type class to bin the data in equally spaced ranges
|
forrest@0
|
223 |
;********************************************************************
|
forrest@0
|
224 |
|
forrest@0
|
225 |
; using model biome class
|
forrest@0
|
226 |
nclass = nclass_mod
|
forrest@0
|
227 |
|
forrest@0
|
228 |
range = fspan(0,nclass,nclass+1)
|
forrest@0
|
229 |
|
forrest@0
|
230 |
; Use this range information to grab all the values in a
|
forrest@0
|
231 |
; particular range, and then take an average.
|
forrest@0
|
232 |
|
forrest@0
|
233 |
nx = dimsizes(range) - 1
|
forrest@0
|
234 |
|
forrest@0
|
235 |
; for 2 data: model and observed
|
forrest@0
|
236 |
data_n = 2
|
forrest@0
|
237 |
|
forrest@0
|
238 |
; using model biome class
|
forrest@0
|
239 |
|
forrest@0
|
240 |
base = ndtooned(classmod)
|
forrest@0
|
241 |
|
forrest@0
|
242 |
; output
|
forrest@0
|
243 |
|
forrest@0
|
244 |
yvalues = new((/data_n,nx/),float)
|
forrest@0
|
245 |
count = new((/data_n,nx/),float)
|
forrest@0
|
246 |
|
forrest@0
|
247 |
;************************************************************************
|
forrest@0
|
248 |
; go through all components
|
forrest@0
|
249 |
;************************************************************************
|
forrest@0
|
250 |
|
forrest@0
|
251 |
do m = 0,n_comp-1
|
forrest@0
|
252 |
|
forrest@0
|
253 |
;===================
|
forrest@0
|
254 |
; get data:
|
forrest@0
|
255 |
;===================
|
forrest@0
|
256 |
; (A) Mean
|
forrest@0
|
257 |
|
forrest@0
|
258 |
if (m .eq. 0) then
|
forrest@0
|
259 |
data_ob = dim_avg_Wrap(laiob (lat|:,lon|:,time|:))
|
forrest@0
|
260 |
data_mod = dim_avg_Wrap(laimod(lat|:,lon|:,time|:))
|
forrest@0
|
261 |
end if
|
forrest@0
|
262 |
|
forrest@0
|
263 |
; (B) Max
|
forrest@0
|
264 |
|
forrest@0
|
265 |
if (m .eq. 1) then
|
forrest@0
|
266 |
|
forrest@0
|
267 |
; observed
|
forrest@0
|
268 |
data_ob = laiob(0,:,:)
|
forrest@0
|
269 |
data_ob@long_name = "Leaf Area Index Max"
|
forrest@0
|
270 |
|
forrest@0
|
271 |
do j = 0,nlat-1
|
forrest@0
|
272 |
do i = 0,nlon-1
|
forrest@0
|
273 |
data_ob(j,i) = max(laiob(:,j,i))
|
forrest@0
|
274 |
end do
|
forrest@0
|
275 |
end do
|
forrest@0
|
276 |
|
forrest@0
|
277 |
; model
|
forrest@0
|
278 |
data_mod = laimod(0,:,:)
|
forrest@0
|
279 |
data_mod@long_name = "Leaf Area Index Max"
|
forrest@0
|
280 |
|
forrest@0
|
281 |
do j = 0,nlat-1
|
forrest@0
|
282 |
do i = 0,nlon-1
|
forrest@0
|
283 |
data_mod(j,i) = max(laimod(:,j,i))
|
forrest@0
|
284 |
end do
|
forrest@0
|
285 |
end do
|
forrest@0
|
286 |
|
forrest@0
|
287 |
end if
|
forrest@0
|
288 |
|
forrest@0
|
289 |
; (C) phase
|
forrest@0
|
290 |
|
forrest@0
|
291 |
if (m .eq. 2) then
|
forrest@0
|
292 |
|
forrest@0
|
293 |
; observed
|
forrest@0
|
294 |
data_ob = laiob(0,:,:)
|
forrest@0
|
295 |
data_ob@long_name = "Leaf Area Index Max Month"
|
forrest@0
|
296 |
|
forrest@0
|
297 |
do j = 0,nlat-1
|
forrest@0
|
298 |
do i = 0,nlon-1
|
forrest@0
|
299 |
data_ob(j,i) = maxind(laiob(:,j,i)) + 1
|
forrest@0
|
300 |
end do
|
forrest@0
|
301 |
end do
|
forrest@0
|
302 |
|
forrest@0
|
303 |
; model
|
forrest@0
|
304 |
data_mod = laimod(0,:,:)
|
forrest@0
|
305 |
data_mod@long_name = "Leaf Area Index Max Month"
|
forrest@0
|
306 |
|
forrest@0
|
307 |
do j = 0,nlat-1
|
forrest@0
|
308 |
do i = 0,nlon-1
|
forrest@0
|
309 |
data_mod(j,i) = maxind(laimod(:,j,i)) + 1
|
forrest@0
|
310 |
end do
|
forrest@0
|
311 |
end do
|
forrest@0
|
312 |
|
forrest@0
|
313 |
end if
|
forrest@0
|
314 |
|
forrest@0
|
315 |
;==============================
|
forrest@0
|
316 |
; put data into bins
|
forrest@0
|
317 |
;==============================
|
forrest@0
|
318 |
|
forrest@0
|
319 |
; Loop through each range, using base
|
forrest@0
|
320 |
|
forrest@0
|
321 |
do i=0,nx-1
|
forrest@0
|
322 |
|
forrest@0
|
323 |
if (i.ne.(nx-1)) then
|
forrest@0
|
324 |
idx = ind((base.ge.range(i)).and.(base.lt.range(i+1)))
|
forrest@0
|
325 |
else
|
forrest@0
|
326 |
idx = ind(base.ge.range(i))
|
forrest@0
|
327 |
end if
|
forrest@0
|
328 |
|
forrest@0
|
329 |
; loop through each dataset
|
forrest@0
|
330 |
|
forrest@0
|
331 |
do n = 0,data_n-1
|
forrest@0
|
332 |
|
forrest@0
|
333 |
if (n .eq. 0) then
|
forrest@0
|
334 |
data = ndtooned(data_ob)
|
forrest@0
|
335 |
end if
|
forrest@0
|
336 |
|
forrest@0
|
337 |
if (n .eq. 1) then
|
forrest@0
|
338 |
data = ndtooned(data_mod)
|
forrest@0
|
339 |
end if
|
forrest@0
|
340 |
|
forrest@0
|
341 |
; Calculate average
|
forrest@0
|
342 |
|
forrest@0
|
343 |
if (.not.any(ismissing(idx))) then
|
forrest@0
|
344 |
yvalues(n,i) = avg(data(idx))
|
forrest@0
|
345 |
count(n,i) = dimsizes(idx)
|
forrest@0
|
346 |
else
|
forrest@0
|
347 |
yvalues(n,i) = yvalues@_FillValue
|
forrest@0
|
348 |
count(n,i) = 0
|
forrest@0
|
349 |
end if
|
forrest@0
|
350 |
|
forrest@0
|
351 |
;#############################################################
|
forrest@0
|
352 |
; using model biome class:
|
forrest@0
|
353 |
;
|
forrest@0
|
354 |
; set the following 4 classes to _FillValue:
|
forrest@0
|
355 |
; (3)Needleleaf Deciduous Boreal Tree,
|
forrest@0
|
356 |
; (8)Broadleaf Deciduous Boreal Tree,
|
forrest@0
|
357 |
; (9)Broadleaf Evergreen Shrub,
|
forrest@0
|
358 |
; (16)Wheat
|
forrest@0
|
359 |
|
forrest@0
|
360 |
if (i.eq.3 .or. i.eq.8 .or. i.eq.9 .or. i.eq.16) then
|
forrest@0
|
361 |
yvalues(n,i) = yvalues@_FillValue
|
forrest@0
|
362 |
count(n,i) = 0
|
forrest@0
|
363 |
end if
|
forrest@0
|
364 |
;#############################################################
|
forrest@0
|
365 |
|
forrest@0
|
366 |
delete(data)
|
forrest@0
|
367 |
end do ; n-loop
|
forrest@0
|
368 |
|
forrest@0
|
369 |
delete(idx)
|
forrest@0
|
370 |
end do ; i-loop
|
forrest@0
|
371 |
|
forrest@0
|
372 |
;=====================================
|
forrest@0
|
373 |
; compute correlation coef and M score
|
forrest@0
|
374 |
;=====================================
|
forrest@0
|
375 |
|
forrest@0
|
376 |
score_max = 5.0
|
forrest@0
|
377 |
|
forrest@0
|
378 |
u = yvalues(0,:)
|
forrest@0
|
379 |
v = yvalues(1,:)
|
forrest@0
|
380 |
u_count = count(0,:)
|
forrest@0
|
381 |
v_count = count(1,:)
|
forrest@0
|
382 |
|
forrest@0
|
383 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
384 |
|
forrest@0
|
385 |
uu = u(good)
|
forrest@0
|
386 |
vv = v(good)
|
forrest@0
|
387 |
uu_count = u_count(good)
|
forrest@0
|
388 |
vv_count = v_count(good)
|
forrest@0
|
389 |
|
forrest@0
|
390 |
; compute correlation coef
|
forrest@0
|
391 |
cc = esccr(uu,vv,0)
|
forrest@0
|
392 |
|
forrest@0
|
393 |
if (n .eq. 2) then
|
forrest@0
|
394 |
bias = avg(abs(vv-uu))
|
forrest@0
|
395 |
bias = where((bias.gt. 6.),12.-bias,bias)
|
forrest@0
|
396 |
Mscore = ((6. - bias)/6.)*score_max
|
forrest@0
|
397 |
else
|
forrest@0
|
398 |
bias = sum(abs(vv-uu)/abs(vv+uu))
|
forrest@0
|
399 |
Mscore = (1.- (bias/dimsizes(uu)))*score_max
|
forrest@0
|
400 |
end if
|
forrest@0
|
401 |
|
forrest@0
|
402 |
M_score = sprintf("%.2f", Mscore)
|
forrest@0
|
403 |
|
forrest@0
|
404 |
; compute M_total
|
forrest@0
|
405 |
|
forrest@0
|
406 |
M_total = M_total + Mscore
|
forrest@0
|
407 |
|
forrest@0
|
408 |
;================================
|
forrest@0
|
409 |
; output M_score to score sheet
|
forrest@0
|
410 |
;===============================
|
forrest@0
|
411 |
|
forrest@0
|
412 |
if (isvar("compare")) then
|
forrest@0
|
413 |
system("sed -e '1,/M_lai_"+component(m)+"/s/M_lai_"+component(m)+"/"+M_score+"/' "+html_name2+" > "+html_new2+";"+ \
|
forrest@0
|
414 |
"mv -f "+html_new2+" "+html_name2)
|
forrest@0
|
415 |
end if
|
forrest@0
|
416 |
|
forrest@0
|
417 |
system("sed s#M_lai_"+component(m)+"#"+M_score+"# "+html_name+" > "+html_new+";"+ \
|
forrest@0
|
418 |
"mv -f "+html_new+" "+html_name)
|
forrest@0
|
419 |
|
forrest@0
|
420 |
;==============================
|
forrest@0
|
421 |
; output M_score to html table
|
forrest@0
|
422 |
;==============================
|
forrest@0
|
423 |
|
forrest@0
|
424 |
n = m*3
|
forrest@0
|
425 |
|
forrest@0
|
426 |
do i=0,nrow-2
|
forrest@0
|
427 |
text(i,n) = sprintf("%.1f",uu(i))
|
forrest@0
|
428 |
text(i,n+1) = sprintf("%.1f",vv(i))
|
forrest@0
|
429 |
text(i,n+2) = "-"
|
forrest@0
|
430 |
end do
|
forrest@0
|
431 |
text(nrow-1,n) = sprintf("%.1f",sum(uu*uu_count)/sum(uu_count))
|
forrest@0
|
432 |
text(nrow-1,n+1) = sprintf("%.1f",sum(vv*vv_count)/sum(vv_count))
|
forrest@0
|
433 |
text(nrow-1,n+2) = M_score
|
forrest@0
|
434 |
|
forrest@0
|
435 |
delete (u)
|
forrest@0
|
436 |
delete (v)
|
forrest@0
|
437 |
delete (uu)
|
forrest@0
|
438 |
delete (vv)
|
forrest@0
|
439 |
delete (u_count)
|
forrest@0
|
440 |
delete (v_count)
|
forrest@0
|
441 |
delete (uu_count)
|
forrest@0
|
442 |
delete (vv_count)
|
forrest@0
|
443 |
delete (good)
|
forrest@0
|
444 |
|
forrest@0
|
445 |
;========================================
|
forrest@0
|
446 |
; global res changes for each component
|
forrest@0
|
447 |
;========================================
|
forrest@0
|
448 |
delta = 0.00001
|
forrest@0
|
449 |
|
forrest@0
|
450 |
if (m .eq. 0) then
|
forrest@0
|
451 |
resg@cnMinLevelValF = 0.
|
forrest@0
|
452 |
resg@cnMaxLevelValF = 10.
|
forrest@0
|
453 |
resg@cnLevelSpacingF = 1.
|
forrest@0
|
454 |
|
forrest@0
|
455 |
data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob)
|
forrest@0
|
456 |
end if
|
forrest@0
|
457 |
|
forrest@0
|
458 |
if (m .eq. 1) then
|
forrest@0
|
459 |
resg@cnMinLevelValF = 0.
|
forrest@0
|
460 |
resg@cnMaxLevelValF = 10.
|
forrest@0
|
461 |
resg@cnLevelSpacingF = 1.
|
forrest@0
|
462 |
|
forrest@0
|
463 |
data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob)
|
forrest@0
|
464 |
end if
|
forrest@0
|
465 |
|
forrest@0
|
466 |
if (m .eq. 2) then
|
forrest@0
|
467 |
resg@cnMinLevelValF = 1.
|
forrest@0
|
468 |
resg@cnMaxLevelValF = 12.
|
forrest@0
|
469 |
resg@cnLevelSpacingF = 1.
|
forrest@0
|
470 |
|
forrest@0
|
471 |
data_mod = where(ismissing(data_ob).or.(data_mod.lt.delta),data_mod@_FillValue,data_mod)
|
forrest@0
|
472 |
data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob)
|
forrest@0
|
473 |
|
forrest@0
|
474 |
end if
|
forrest@0
|
475 |
|
forrest@0
|
476 |
;=========================
|
forrest@0
|
477 |
; global contour : ob
|
forrest@0
|
478 |
;=========================
|
forrest@0
|
479 |
|
forrest@0
|
480 |
plot_name = "global_"+component(m)+"_ob"
|
forrest@0
|
481 |
title = ob_name
|
forrest@0
|
482 |
resg@tiMainString = title
|
forrest@0
|
483 |
|
forrest@0
|
484 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
485 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
486 |
|
forrest@0
|
487 |
plot = gsn_csm_contour_map_ce(wks,data_ob,resg)
|
forrest@0
|
488 |
|
forrest@0
|
489 |
delete (wks)
|
forrest@0
|
490 |
delete (plot)
|
forrest@0
|
491 |
|
forrest@0
|
492 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
493 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
494 |
|
forrest@0
|
495 |
;============================
|
forrest@0
|
496 |
; global contour : model
|
forrest@0
|
497 |
;============================
|
forrest@0
|
498 |
|
forrest@0
|
499 |
plot_name = "global_"+component(m)+"_model"
|
forrest@0
|
500 |
title = "Model " + model_name
|
forrest@0
|
501 |
resg@tiMainString = title
|
forrest@0
|
502 |
|
forrest@0
|
503 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
504 |
gsn_define_colormap(wks,"gui_default")
|
forrest@0
|
505 |
|
forrest@0
|
506 |
plot = gsn_csm_contour_map_ce(wks,data_mod,resg)
|
forrest@0
|
507 |
|
forrest@0
|
508 |
delete (wks)
|
forrest@0
|
509 |
delete (plot)
|
forrest@0
|
510 |
|
forrest@0
|
511 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
512 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
513 |
|
forrest@0
|
514 |
;================================
|
forrest@0
|
515 |
; global contour: model vs ob
|
forrest@0
|
516 |
;================================
|
forrest@0
|
517 |
|
forrest@0
|
518 |
plot_name = "global_"+component(m)+"_model_vs_ob"
|
forrest@0
|
519 |
|
forrest@0
|
520 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
521 |
gsn_define_colormap(wks,"gui_default")
|
forrest@0
|
522 |
|
forrest@0
|
523 |
plot=new(3,graphic) ; create graphic array
|
forrest@0
|
524 |
|
forrest@0
|
525 |
resg@gsnFrame = False ; Do not draw plot
|
forrest@0
|
526 |
resg@gsnDraw = False ; Do not advance frame
|
forrest@0
|
527 |
|
forrest@0
|
528 |
; plot correlation coef
|
forrest@0
|
529 |
|
forrest@0
|
530 |
gRes = True
|
forrest@0
|
531 |
gRes@txFontHeightF = 0.02
|
forrest@0
|
532 |
gRes@txAngleF = 90
|
forrest@0
|
533 |
|
forrest@0
|
534 |
correlation_text = "(correlation coef = "+sprintf("%.2f", cc)+")"
|
forrest@0
|
535 |
|
forrest@0
|
536 |
gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes)
|
forrest@0
|
537 |
|
forrest@0
|
538 |
; plot ob
|
forrest@0
|
539 |
|
forrest@0
|
540 |
title = ob_name
|
forrest@0
|
541 |
resg@tiMainString = title
|
forrest@0
|
542 |
|
forrest@0
|
543 |
plot(0) = gsn_csm_contour_map_ce(wks,data_ob,resg)
|
forrest@0
|
544 |
|
forrest@0
|
545 |
; plot model
|
forrest@0
|
546 |
|
forrest@0
|
547 |
title = "Model "+ model_name
|
forrest@0
|
548 |
resg@tiMainString = title
|
forrest@0
|
549 |
|
forrest@0
|
550 |
plot(1) = gsn_csm_contour_map_ce(wks,data_mod,resg)
|
forrest@0
|
551 |
|
forrest@0
|
552 |
; plot model-ob
|
forrest@0
|
553 |
|
forrest@0
|
554 |
if (m .eq. 0) then
|
forrest@0
|
555 |
resg@cnMinLevelValF = -2.
|
forrest@0
|
556 |
resg@cnMaxLevelValF = 2.
|
forrest@0
|
557 |
resg@cnLevelSpacingF = 0.4
|
forrest@0
|
558 |
end if
|
forrest@0
|
559 |
|
forrest@0
|
560 |
if (m .eq. 1) then
|
forrest@0
|
561 |
resg@cnMinLevelValF = -6.
|
forrest@0
|
562 |
resg@cnMaxLevelValF = 6.
|
forrest@0
|
563 |
resg@cnLevelSpacingF = 1.
|
forrest@0
|
564 |
end if
|
forrest@0
|
565 |
|
forrest@0
|
566 |
if (m .eq. 2) then
|
forrest@0
|
567 |
resg@cnMinLevelValF = -6.
|
forrest@0
|
568 |
resg@cnMaxLevelValF = 6.
|
forrest@0
|
569 |
resg@cnLevelSpacingF = 1.
|
forrest@0
|
570 |
end if
|
forrest@0
|
571 |
|
forrest@0
|
572 |
zz = data_mod
|
forrest@0
|
573 |
zz = data_mod - data_ob
|
forrest@0
|
574 |
title = "Model_"+model_name+" - Observed"
|
forrest@0
|
575 |
resg@tiMainString = title
|
forrest@0
|
576 |
|
forrest@0
|
577 |
plot(2) = gsn_csm_contour_map_ce(wks,zz,resg)
|
forrest@0
|
578 |
|
forrest@0
|
579 |
; plot panel
|
forrest@0
|
580 |
|
forrest@0
|
581 |
pres = True ; panel plot mods desired
|
forrest@0
|
582 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
583 |
|
forrest@0
|
584 |
gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
|
forrest@0
|
585 |
|
forrest@0
|
586 |
delete (wks)
|
forrest@0
|
587 |
delete (plot)
|
forrest@0
|
588 |
|
forrest@0
|
589 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
590 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
591 |
|
forrest@0
|
592 |
delete (data_ob)
|
forrest@0
|
593 |
delete (data_mod)
|
forrest@0
|
594 |
|
forrest@0
|
595 |
resg@gsnFrame = True ; Do advance frame
|
forrest@0
|
596 |
resg@gsnDraw = True ; Do draw plot
|
forrest@0
|
597 |
|
forrest@0
|
598 |
end do ; m-loop
|
forrest@0
|
599 |
|
forrest@0
|
600 |
;**************************************************
|
forrest@0
|
601 |
; html table
|
forrest@0
|
602 |
;**************************************************
|
forrest@0
|
603 |
output_html = "table_model_vs_ob.html"
|
forrest@0
|
604 |
|
forrest@0
|
605 |
header_text = "<H1>LAI: Model "+model_name+" vs. MODIS observations</H1>"
|
forrest@0
|
606 |
|
forrest@0
|
607 |
header = (/"<HTML>" \
|
forrest@0
|
608 |
,"<HEAD>" \
|
forrest@0
|
609 |
,"<TITLE>CLAMP metrics</TITLE>" \
|
forrest@0
|
610 |
,"</HEAD>" \
|
forrest@0
|
611 |
,header_text \
|
forrest@0
|
612 |
/)
|
forrest@0
|
613 |
footer = "</HTML>"
|
forrest@0
|
614 |
|
forrest@0
|
615 |
table_header = (/ \
|
forrest@0
|
616 |
"<table border=1 cellspacing=0 cellpadding=3 width=100%>" \
|
forrest@0
|
617 |
,"<tr>" \
|
forrest@0
|
618 |
," <th bgcolor=DDDDDD rowspan=2>Biome Class</th>" \
|
forrest@0
|
619 |
," <th bgcolor=DDDDDD colspan=3>"+component(0)+" (m2/m2)</th>" \
|
forrest@0
|
620 |
," <th bgcolor=DDDDDD colspan=3>"+component(1)+" (m2/m2)</th>" \
|
forrest@0
|
621 |
," <th bgcolor=DDDDDD colspan=3>"+component(2)+" (months)</th>" \
|
forrest@0
|
622 |
," <th bgcolor=DDDDDD rowspan=2>Annual Plot</th>" \
|
forrest@0
|
623 |
,"</tr>" \
|
forrest@0
|
624 |
,"<tr>" \
|
forrest@0
|
625 |
," <th bgcolor=DDDDDD >observed</th>" \
|
forrest@0
|
626 |
," <th bgcolor=DDDDDD >"+model_name+"</th>" \
|
forrest@0
|
627 |
," <th bgcolor=DDDDDD >M_score</th>" \
|
forrest@0
|
628 |
," <th bgcolor=DDDDDD >observed</th>" \
|
forrest@0
|
629 |
," <th bgcolor=DDDDDD >"+model_name+"</th>" \
|
forrest@0
|
630 |
," <th bgcolor=DDDDDD >M_score</th>" \
|
forrest@0
|
631 |
," <th bgcolor=DDDDDD >observed</th>" \
|
forrest@0
|
632 |
," <th bgcolor=DDDDDD >"+model_name+"</th>" \
|
forrest@0
|
633 |
," <th bgcolor=DDDDDD >M_score</th>" \
|
forrest@0
|
634 |
,"</tr>" \
|
forrest@0
|
635 |
/)
|
forrest@0
|
636 |
table_footer = "</table>"
|
forrest@0
|
637 |
row_header = "<tr>"
|
forrest@0
|
638 |
row_footer = "</tr>"
|
forrest@0
|
639 |
|
forrest@0
|
640 |
lines = new(50000,string)
|
forrest@0
|
641 |
nline = 0
|
forrest@0
|
642 |
|
forrest@0
|
643 |
set_line(lines,nline,header)
|
forrest@0
|
644 |
set_line(lines,nline,table_header)
|
forrest@0
|
645 |
;-----------------------------------------------
|
forrest@0
|
646 |
;row of table
|
forrest@0
|
647 |
|
forrest@0
|
648 |
do n = 0,nrow-1
|
forrest@0
|
649 |
set_line(lines,nline,row_header)
|
forrest@0
|
650 |
|
forrest@0
|
651 |
txt1 = row_head(n)
|
forrest@0
|
652 |
txt2 = text(n,0)
|
forrest@0
|
653 |
txt3 = text(n,1)
|
forrest@0
|
654 |
txt4 = text(n,2)
|
forrest@0
|
655 |
txt5 = text(n,3)
|
forrest@0
|
656 |
txt6 = text(n,4)
|
forrest@0
|
657 |
txt7 = text(n,5)
|
forrest@0
|
658 |
txt8 = text(n,6)
|
forrest@0
|
659 |
txt9 = text(n,7)
|
forrest@0
|
660 |
txt10 = text(n,8)
|
forrest@0
|
661 |
txt11 = "<a href=./annual_biome_"+n+".png>model_vs_ob</a>"
|
forrest@0
|
662 |
|
forrest@0
|
663 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
664 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
665 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
666 |
set_line(lines,nline,"<th>"+txt4+"</th>")
|
forrest@0
|
667 |
set_line(lines,nline,"<th>"+txt5+"</th>")
|
forrest@0
|
668 |
set_line(lines,nline,"<th>"+txt6+"</th>")
|
forrest@0
|
669 |
set_line(lines,nline,"<th>"+txt7+"</th>")
|
forrest@0
|
670 |
set_line(lines,nline,"<th>"+txt8+"</th>")
|
forrest@0
|
671 |
set_line(lines,nline,"<th>"+txt9+"</th>")
|
forrest@0
|
672 |
set_line(lines,nline,"<th>"+txt10+"</th>")
|
forrest@0
|
673 |
set_line(lines,nline,"<th>"+txt11+"</th>")
|
forrest@0
|
674 |
|
forrest@0
|
675 |
set_line(lines,nline,row_footer)
|
forrest@0
|
676 |
end do
|
forrest@0
|
677 |
;-----------------------------------------------
|
forrest@0
|
678 |
set_line(lines,nline,table_footer)
|
forrest@0
|
679 |
set_line(lines,nline,footer)
|
forrest@0
|
680 |
|
forrest@0
|
681 |
; Now write to an HTML file
|
forrest@0
|
682 |
|
forrest@0
|
683 |
idx = ind(.not.ismissing(lines))
|
forrest@0
|
684 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
685 |
asciiwrite(output_html,lines(idx))
|
forrest@0
|
686 |
else
|
forrest@0
|
687 |
print ("error?")
|
forrest@0
|
688 |
end if
|
forrest@0
|
689 |
|
forrest@0
|
690 |
delete (yvalues)
|
forrest@0
|
691 |
delete (count)
|
forrest@0
|
692 |
delete (idx)
|
forrest@0
|
693 |
|
forrest@0
|
694 |
;************************************************************************
|
forrest@0
|
695 |
; go through all ntime
|
forrest@0
|
696 |
;************************************************************************
|
forrest@0
|
697 |
|
forrest@0
|
698 |
; for 2 data: model and observed
|
forrest@0
|
699 |
data_n = 2
|
forrest@0
|
700 |
|
forrest@0
|
701 |
; using model biome class
|
forrest@0
|
702 |
|
forrest@0
|
703 |
base = ndtooned(classmod)
|
forrest@0
|
704 |
|
forrest@0
|
705 |
; output
|
forrest@0
|
706 |
|
forrest@0
|
707 |
yvalues = new((/data_n,nx,ntime/),float)
|
forrest@0
|
708 |
|
forrest@0
|
709 |
;==============================
|
forrest@0
|
710 |
; put data into bins
|
forrest@0
|
711 |
;==============================
|
forrest@0
|
712 |
|
forrest@0
|
713 |
; Loop through each range, using base
|
forrest@0
|
714 |
|
forrest@0
|
715 |
do i=0,nx-1
|
forrest@0
|
716 |
|
forrest@0
|
717 |
if (i.ne.(nx-1)) then
|
forrest@0
|
718 |
idx = ind((base.ge.range(i)).and.(base.lt.range(i+1)))
|
forrest@0
|
719 |
else
|
forrest@0
|
720 |
idx = ind(base.ge.range(i))
|
forrest@0
|
721 |
end if
|
forrest@0
|
722 |
|
forrest@0
|
723 |
; loop through each dataset
|
forrest@0
|
724 |
|
forrest@0
|
725 |
do n = 0,data_n-1
|
forrest@0
|
726 |
|
forrest@0
|
727 |
do m = 0,ntime-1
|
forrest@0
|
728 |
|
forrest@0
|
729 |
if (n .eq. 0) then
|
forrest@0
|
730 |
data = ndtooned(laiob (m,:,:))
|
forrest@0
|
731 |
end if
|
forrest@0
|
732 |
|
forrest@0
|
733 |
if (n .eq. 1) then
|
forrest@0
|
734 |
data = ndtooned(laimod(m,:,:))
|
forrest@0
|
735 |
end if
|
forrest@0
|
736 |
|
forrest@0
|
737 |
; Calculate average
|
forrest@0
|
738 |
|
forrest@0
|
739 |
if (.not.any(ismissing(idx))) then
|
forrest@0
|
740 |
yvalues(n,i,m) = avg(data(idx))
|
forrest@0
|
741 |
else
|
forrest@0
|
742 |
yvalues(n,i,m) = yvalues@_FillValue
|
forrest@0
|
743 |
end if
|
forrest@0
|
744 |
|
forrest@0
|
745 |
;#############################################################
|
forrest@0
|
746 |
; using model biome class:
|
forrest@0
|
747 |
;
|
forrest@0
|
748 |
; set the following 4 classes to _FillValue:
|
forrest@0
|
749 |
; (3)Needleleaf Deciduous Boreal Tree,
|
forrest@0
|
750 |
; (8)Broadleaf Deciduous Boreal Tree,
|
forrest@0
|
751 |
; (9)Broadleaf Evergreen Shrub,
|
forrest@0
|
752 |
; (16)Wheat
|
forrest@0
|
753 |
|
forrest@0
|
754 |
if (i.eq.3 .or. i.eq.8 .or. i.eq.9 .or. i.eq.16) then
|
forrest@0
|
755 |
yvalues(n,i,m) = yvalues@_FillValue
|
forrest@0
|
756 |
end if
|
forrest@0
|
757 |
;#############################################################
|
forrest@0
|
758 |
|
forrest@0
|
759 |
end do ; m-loop
|
forrest@0
|
760 |
|
forrest@0
|
761 |
delete(data)
|
forrest@0
|
762 |
end do ; n-loop
|
forrest@0
|
763 |
|
forrest@0
|
764 |
delete(idx)
|
forrest@0
|
765 |
end do ; i-loop
|
forrest@0
|
766 |
|
forrest@0
|
767 |
good = ind(.not.ismissing(yvalues(0,:,0)))
|
forrest@0
|
768 |
|
forrest@0
|
769 |
n_biome = dimsizes(good)
|
forrest@0
|
770 |
|
forrest@0
|
771 |
;----------------------------------------------------------------
|
forrest@0
|
772 |
; data for tseries plot
|
forrest@0
|
773 |
|
forrest@0
|
774 |
yvalues_g = new((/data_n,n_biome,ntime/),float)
|
forrest@0
|
775 |
|
forrest@0
|
776 |
yvalues_g@units = ""
|
forrest@0
|
777 |
|
forrest@0
|
778 |
yvalues_g = yvalues(:,good,:)
|
forrest@0
|
779 |
|
forrest@0
|
780 |
delete (good)
|
forrest@0
|
781 |
|
forrest@0
|
782 |
;*******************************************************************
|
forrest@0
|
783 |
; res for line plot
|
forrest@0
|
784 |
;*******************************************************************
|
forrest@0
|
785 |
; for x-axis in xyplot
|
forrest@0
|
786 |
mon = ispan(1,12,1)
|
forrest@0
|
787 |
mon@long_name = "month"
|
forrest@0
|
788 |
|
forrest@0
|
789 |
res = True ; plot mods desired
|
forrest@0
|
790 |
res@xyLineThicknesses = (/2.0,2.0,2.0/) ; make 2nd lines thicker
|
forrest@0
|
791 |
res@xyLineColors = (/"blue","red"/) ; change line color
|
forrest@0
|
792 |
|
forrest@0
|
793 |
; res@tiMainFontHeightF = 0.025 ; size of title
|
forrest@0
|
794 |
|
forrest@0
|
795 |
; Add a boxed legend using the more simple method
|
forrest@0
|
796 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
797 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
798 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
799 |
res@pmLegendHeightF = 0.06
|
forrest@0
|
800 |
; res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
801 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
802 |
res@pmLegendOrthogonalPosF = -0.30 ;(downward)
|
forrest@0
|
803 |
|
forrest@0
|
804 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
805 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
806 |
|
forrest@0
|
807 |
; res@lgPerimOn = False
|
forrest@0
|
808 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
809 |
res@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
810 |
|
forrest@0
|
811 |
;************************************************************
|
forrest@0
|
812 |
|
forrest@0
|
813 |
plot_data = new((/2,ntime/),float)
|
forrest@0
|
814 |
plot_data@long_name = "Leaf Area Index"
|
forrest@0
|
815 |
|
forrest@0
|
816 |
;----------------------------------------------
|
forrest@0
|
817 |
; time series plot : per biome
|
forrest@0
|
818 |
|
forrest@0
|
819 |
do m = 0, n_biome-1
|
forrest@0
|
820 |
|
forrest@0
|
821 |
plot_name = "annual_biome_"+ m
|
forrest@0
|
822 |
|
forrest@0
|
823 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
824 |
|
forrest@0
|
825 |
title = "LAI : "+ row_head(m)
|
forrest@0
|
826 |
res@tiMainString = title
|
forrest@0
|
827 |
|
forrest@0
|
828 |
plot_data(0,:) = yvalues_g(0,m,:)
|
forrest@0
|
829 |
plot_data(1,:) = yvalues_g(1,m,:)
|
forrest@0
|
830 |
|
forrest@0
|
831 |
plot = gsn_csm_xy(wks,mon,plot_data,res)
|
forrest@0
|
832 |
|
forrest@0
|
833 |
delete (wks)
|
forrest@0
|
834 |
delete (plot)
|
forrest@0
|
835 |
|
forrest@0
|
836 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
837 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
838 |
end do
|
forrest@0
|
839 |
|
forrest@0
|
840 |
;--------------------------------------------
|
forrest@0
|
841 |
; time series plot: all biome
|
forrest@0
|
842 |
|
forrest@0
|
843 |
plot_name = "annual_biome_"+ n_biome
|
forrest@0
|
844 |
|
forrest@0
|
845 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
846 |
|
forrest@0
|
847 |
title = "LAI : "+ row_head(n_biome)
|
forrest@0
|
848 |
res@tiMainString = title
|
forrest@0
|
849 |
|
forrest@0
|
850 |
do k = 0,ntime-1
|
forrest@0
|
851 |
plot_data(0,k) = avg(yvalues_g(0,:,k))
|
forrest@0
|
852 |
plot_data(1,k) = avg(yvalues_g(1,:,k))
|
forrest@0
|
853 |
end do
|
forrest@0
|
854 |
|
forrest@0
|
855 |
plot = gsn_csm_xy(wks,mon,plot_data,res)
|
forrest@0
|
856 |
|
forrest@0
|
857 |
delete (wks)
|
forrest@0
|
858 |
delete (plot)
|
forrest@0
|
859 |
|
forrest@0
|
860 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
861 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
862 |
|
forrest@0
|
863 |
delete (plot_data)
|
forrest@0
|
864 |
|
forrest@0
|
865 |
;***************************************************************************
|
forrest@0
|
866 |
; write total score to file
|
forrest@0
|
867 |
;***************************************************************************
|
forrest@0
|
868 |
|
forrest@0
|
869 |
asciiwrite("M_save.lai", M_total)
|
forrest@0
|
870 |
|
forrest@0
|
871 |
;***************************************************************************
|
forrest@0
|
872 |
; output plots
|
forrest@0
|
873 |
;***************************************************************************
|
forrest@0
|
874 |
output_dir = model_name+"/lai"
|
forrest@0
|
875 |
|
forrest@0
|
876 |
system("mv *.png *.html " + output_dir)
|
forrest@0
|
877 |
;***************************************************************************
|
forrest@0
|
878 |
end
|
forrest@0
|
879 |
|