forrest@0
|
1 |
;********************************************************
|
forrest@0
|
2 |
; histogram normalized by rain and compute correleration
|
forrest@0
|
3 |
;********************************************************
|
forrest@0
|
4 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
7 |
|
forrest@0
|
8 |
procedure pminmax(data:numeric,name:string)
|
forrest@0
|
9 |
begin
|
forrest@0
|
10 |
print ("min/max " + name + " = " + min(data) + "/" + max(data))
|
forrest@0
|
11 |
if(isatt(data,"units")) then
|
forrest@0
|
12 |
print (name + " units = " + data@units)
|
forrest@0
|
13 |
end if
|
forrest@0
|
14 |
end
|
forrest@0
|
15 |
|
forrest@0
|
16 |
; Main code.
|
forrest@0
|
17 |
begin
|
forrest@0
|
18 |
|
forrest@0
|
19 |
;nclass = 18
|
forrest@0
|
20 |
nclass = 20
|
forrest@0
|
21 |
|
forrest@0
|
22 |
plot_type = "ps"
|
forrest@0
|
23 |
plot_type_new = "png"
|
forrest@0
|
24 |
|
forrest@0
|
25 |
;************************************************
|
forrest@0
|
26 |
; read in data: model
|
forrest@0
|
27 |
;************************************************
|
forrest@0
|
28 |
|
forrest@0
|
29 |
model_name = "b30.061n"
|
forrest@0
|
30 |
model_grid = "T31"
|
forrest@0
|
31 |
|
forrest@0
|
32 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
33 |
film = "b30.061n_1995-2004_MONS_climo_lnd.nc"
|
forrest@0
|
34 |
;film = "i01.03cn_1545-1569_MONS_climo.nc"
|
forrest@0
|
35 |
fm = addfile(dirm+film,"r")
|
forrest@0
|
36 |
|
forrest@0
|
37 |
laimod = fm->TLAI
|
forrest@0
|
38 |
|
forrest@0
|
39 |
;************************************************
|
forrest@0
|
40 |
; read in data: observed
|
forrest@0
|
41 |
;************************************************
|
forrest@0
|
42 |
|
forrest@0
|
43 |
ob_name = "MODIS MOD 15A2 2000-2005"
|
forrest@0
|
44 |
|
forrest@0
|
45 |
diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/ob/"
|
forrest@0
|
46 |
filo1 = "land_class_"+model_grid+".nc"
|
forrest@0
|
47 |
filo2 = "LAI_2000-2005_MONS_"+model_grid+".nc"
|
forrest@0
|
48 |
|
forrest@0
|
49 |
fo1 = addfile(diro+filo1,"r")
|
forrest@0
|
50 |
fo2 = addfile(diro+filo2,"r")
|
forrest@0
|
51 |
|
forrest@0
|
52 |
classob = tofloat(fo1->LAND_CLASS)
|
forrest@0
|
53 |
laiob = fo2->LAI
|
forrest@0
|
54 |
;*******************************************************************
|
forrest@0
|
55 |
; Calculate "nice" bins for binning the data in equally spaced ranges
|
forrest@0
|
56 |
;********************************************************************
|
forrest@0
|
57 |
nclassn = nclass + 1
|
forrest@0
|
58 |
range = fspan(0,nclassn-1,nclassn)
|
forrest@0
|
59 |
; print (range)
|
forrest@0
|
60 |
|
forrest@0
|
61 |
; Use this range information to grab all the values in a
|
forrest@0
|
62 |
; particular range, and then take an average.
|
forrest@0
|
63 |
|
forrest@0
|
64 |
nr = dimsizes(range)
|
forrest@0
|
65 |
nx = nr-1
|
forrest@0
|
66 |
xvalues = new((/2,nx/),float)
|
forrest@0
|
67 |
xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
|
forrest@0
|
68 |
dx = xvalues(0,1) - xvalues(0,0) ; range width
|
forrest@0
|
69 |
dx4 = dx/4 ; 1/4 of the range
|
forrest@0
|
70 |
xvalues(1,:) = xvalues(0,:) - dx/5.
|
forrest@0
|
71 |
;-----------------------------------------------------------------
|
forrest@0
|
72 |
|
forrest@0
|
73 |
;-----------------------------------------------------------------
|
forrest@0
|
74 |
;(B) max
|
forrest@0
|
75 |
;--------------------------------------------------------------------
|
forrest@0
|
76 |
; get data
|
forrest@0
|
77 |
|
forrest@0
|
78 |
; observed
|
forrest@0
|
79 |
laiob_max = laiob(0,:,:)
|
forrest@0
|
80 |
s = laiob(:,0,0)
|
forrest@0
|
81 |
laiob_max@long_name = "Leaf Area Index Max"
|
forrest@0
|
82 |
|
forrest@0
|
83 |
dsizes_z = dimsizes(laiob)
|
forrest@0
|
84 |
nlat = dsizes_z(1)
|
forrest@0
|
85 |
nlon = dsizes_z(2)
|
forrest@0
|
86 |
|
forrest@0
|
87 |
do j = 0,nlat-1
|
forrest@0
|
88 |
do i = 0,nlon-1
|
forrest@0
|
89 |
s = laiob(:,j,i)
|
forrest@0
|
90 |
laiob_max(j,i) = max(s)
|
forrest@0
|
91 |
end do
|
forrest@0
|
92 |
end do
|
forrest@0
|
93 |
|
forrest@0
|
94 |
; print (min(y)+"/"+max(y))
|
forrest@0
|
95 |
delete (s)
|
forrest@0
|
96 |
delete (dsizes_z)
|
forrest@0
|
97 |
;-------------------------
|
forrest@0
|
98 |
; model
|
forrest@0
|
99 |
laimod_max = laimod(0,:,:)
|
forrest@0
|
100 |
s = laimod(:,0,0)
|
forrest@0
|
101 |
laimod_max@long_name = "Leaf Area Index Max"
|
forrest@0
|
102 |
|
forrest@0
|
103 |
dsizes_z = dimsizes(laimod)
|
forrest@0
|
104 |
nlat = dsizes_z(1)
|
forrest@0
|
105 |
nlon = dsizes_z(2)
|
forrest@0
|
106 |
|
forrest@0
|
107 |
do j = 0,nlat-1
|
forrest@0
|
108 |
do i = 0,nlon-1
|
forrest@0
|
109 |
s = laimod(:,j,i)
|
forrest@0
|
110 |
laimod_max(j,i) = max(s)
|
forrest@0
|
111 |
end do
|
forrest@0
|
112 |
end do
|
forrest@0
|
113 |
|
forrest@0
|
114 |
; print (min(laimod_max)+"/"+max(laimod_max))
|
forrest@0
|
115 |
delete (s)
|
forrest@0
|
116 |
delete (dsizes_z)
|
forrest@0
|
117 |
;------------------------
|
forrest@0
|
118 |
DATA11_1D = ndtooned(classob)
|
forrest@0
|
119 |
DATA12_1D = ndtooned(laiob_max)
|
forrest@0
|
120 |
DATA22_1D = ndtooned(laimod_max)
|
forrest@0
|
121 |
|
forrest@0
|
122 |
yvalues = new((/2,nx/),float)
|
forrest@0
|
123 |
mn_yvalues = new((/2,nx/),float)
|
forrest@0
|
124 |
mx_yvalues = new((/2,nx/),float)
|
forrest@0
|
125 |
|
forrest@0
|
126 |
do nd=0,1
|
forrest@0
|
127 |
|
forrest@0
|
128 |
; See if we are doing model or observational data.
|
forrest@0
|
129 |
|
forrest@0
|
130 |
if(nd.eq.0) then
|
forrest@0
|
131 |
data_ob = DATA11_1D
|
forrest@0
|
132 |
data_mod = DATA12_1D
|
forrest@0
|
133 |
else
|
forrest@0
|
134 |
data_ob = DATA11_1D
|
forrest@0
|
135 |
data_mod = DATA22_1D
|
forrest@0
|
136 |
end if
|
forrest@0
|
137 |
|
forrest@0
|
138 |
; Loop through each range and check for values.
|
forrest@0
|
139 |
|
forrest@0
|
140 |
do i=0,nr-2
|
forrest@0
|
141 |
if (i.ne.(nr-2)) then
|
forrest@0
|
142 |
; print("")
|
forrest@0
|
143 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
144 |
idx = ind((range(i).le.data_ob).and.(data_ob.lt.range(i+1)))
|
forrest@0
|
145 |
else
|
forrest@0
|
146 |
; print("")
|
forrest@0
|
147 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
148 |
idx = ind(range(i).le.data_ob)
|
forrest@0
|
149 |
end if
|
forrest@0
|
150 |
|
forrest@0
|
151 |
; Calculate average, and get min and max.
|
forrest@0
|
152 |
|
forrest@0
|
153 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
154 |
yvalues(nd,i) = avg(data_mod(idx))
|
forrest@0
|
155 |
mn_yvalues(nd,i) = min(data_mod(idx))
|
forrest@0
|
156 |
mx_yvalues(nd,i) = max(data_mod(idx))
|
forrest@0
|
157 |
count = dimsizes(idx)
|
forrest@0
|
158 |
else
|
forrest@0
|
159 |
count = 0
|
forrest@0
|
160 |
yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
161 |
mn_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
162 |
mx_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
163 |
end if
|
forrest@0
|
164 |
|
forrest@0
|
165 |
; print(nd + ": " + count + " points, avg = " + yvalues(nd,i))
|
forrest@0
|
166 |
; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
|
forrest@0
|
167 |
|
forrest@0
|
168 |
; Clean up for next time in loop.
|
forrest@0
|
169 |
|
forrest@0
|
170 |
delete(idx)
|
forrest@0
|
171 |
end do
|
forrest@0
|
172 |
delete(data_ob)
|
forrest@0
|
173 |
delete(data_mod)
|
forrest@0
|
174 |
end do
|
forrest@0
|
175 |
;-----------------------------------------------------------------
|
forrest@0
|
176 |
; compute correlation coef and M score
|
forrest@0
|
177 |
|
forrest@0
|
178 |
u = yvalues(0,:)
|
forrest@0
|
179 |
v = yvalues(1,:)
|
forrest@0
|
180 |
|
forrest@0
|
181 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
182 |
uu = u(good)
|
forrest@0
|
183 |
vv = v(good)
|
forrest@0
|
184 |
|
forrest@0
|
185 |
ccrMax = esccr(uu,vv,0)
|
forrest@0
|
186 |
; print (ccrMax)
|
forrest@0
|
187 |
|
forrest@0
|
188 |
; new eq
|
forrest@0
|
189 |
bias = sum(abs(vv-uu)/(vv+uu))
|
forrest@0
|
190 |
Mmax = (1.- (bias/dimsizes(uu)))*5.
|
forrest@0
|
191 |
|
forrest@0
|
192 |
print (Mmax)
|
forrest@0
|
193 |
|
forrest@0
|
194 |
delete (u)
|
forrest@0
|
195 |
delete (v)
|
forrest@0
|
196 |
delete (uu)
|
forrest@0
|
197 |
delete (vv)
|
forrest@0
|
198 |
;--------------------------------------------------------------------
|
forrest@0
|
199 |
; histogram res
|
forrest@0
|
200 |
|
forrest@0
|
201 |
resm = True
|
forrest@0
|
202 |
resm@gsnMaximize = True
|
forrest@0
|
203 |
resm@gsnDraw = False
|
forrest@0
|
204 |
resm@gsnFrame = False
|
forrest@0
|
205 |
resm@xyMarkLineMode = "Markers"
|
forrest@0
|
206 |
resm@xyMarkerSizeF = 0.014
|
forrest@0
|
207 |
resm@xyMarker = 16
|
forrest@0
|
208 |
resm@xyMarkerColors = (/"Brown","Blue"/)
|
forrest@0
|
209 |
; resm@trYMinF = min(mn_yvalues) - 10.
|
forrest@0
|
210 |
; resm@trYMaxF = max(mx_yvalues) + 10.
|
forrest@0
|
211 |
resm@trYMinF = min(mn_yvalues) - 2
|
forrest@0
|
212 |
resm@trYMaxF = max(mx_yvalues) + 4
|
forrest@0
|
213 |
|
forrest@0
|
214 |
resm@tiYAxisString = "Max LAI (Leaf Area Index)"
|
forrest@0
|
215 |
resm@tiXAxisString = "Land Cover Type"
|
forrest@0
|
216 |
|
forrest@0
|
217 |
max_bar = new((/2,nx/),graphic)
|
forrest@0
|
218 |
min_bar = new((/2,nx/),graphic)
|
forrest@0
|
219 |
max_cap = new((/2,nx/),graphic)
|
forrest@0
|
220 |
min_cap = new((/2,nx/),graphic)
|
forrest@0
|
221 |
|
forrest@0
|
222 |
lnres = True
|
forrest@0
|
223 |
line_colors = (/"brown","blue"/)
|
forrest@0
|
224 |
;------------------------------------------------------------------
|
forrest@0
|
225 |
; Start the graphics.
|
forrest@0
|
226 |
|
forrest@0
|
227 |
plot_name = "histogram_max"
|
forrest@0
|
228 |
title = model_name + " vs Observed"
|
forrest@0
|
229 |
resm@tiMainString = title
|
forrest@0
|
230 |
|
forrest@0
|
231 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
232 |
;-----------------------------
|
forrest@0
|
233 |
; Add a boxed legend using the more simple method
|
forrest@0
|
234 |
|
forrest@0
|
235 |
resm@pmLegendDisplayMode = "Always"
|
forrest@0
|
236 |
; resm@pmLegendWidthF = 0.1
|
forrest@0
|
237 |
resm@pmLegendWidthF = 0.08
|
forrest@0
|
238 |
resm@pmLegendHeightF = 0.05
|
forrest@0
|
239 |
resm@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
240 |
; resm@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
241 |
; resm@pmLegendParallelPosF = 0.18
|
forrest@0
|
242 |
resm@pmLegendParallelPosF = 0.88 ;(rightward)
|
forrest@0
|
243 |
|
forrest@0
|
244 |
; resm@lgPerimOn = False
|
forrest@0
|
245 |
resm@lgLabelFontHeightF = 0.015
|
forrest@0
|
246 |
resm@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
247 |
;-----------------------------
|
forrest@0
|
248 |
tRes = True
|
forrest@0
|
249 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
250 |
|
forrest@0
|
251 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrMax)+")"
|
forrest@0
|
252 |
|
forrest@0
|
253 |
gsn_text_ndc(wks,correlation_text,0.56,0.85,tRes)
|
forrest@0
|
254 |
|
forrest@0
|
255 |
xy = gsn_csm_xy(wks,xvalues,yvalues,resm)
|
forrest@0
|
256 |
;-------------------------------
|
forrest@0
|
257 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
258 |
|
forrest@0
|
259 |
do nd=0,1
|
forrest@0
|
260 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
261 |
do i=0,nx-1
|
forrest@0
|
262 |
|
forrest@0
|
263 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
264 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
265 |
|
forrest@0
|
266 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
267 |
|
forrest@0
|
268 |
x1 = xvalues(nd,i)
|
forrest@0
|
269 |
y1 = yvalues(nd,i)
|
forrest@0
|
270 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
271 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
272 |
|
forrest@0
|
273 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
274 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
275 |
|
forrest@0
|
276 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
277 |
|
forrest@0
|
278 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
279 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
280 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
281 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
282 |
|
forrest@0
|
283 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
284 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
285 |
end if
|
forrest@0
|
286 |
end do
|
forrest@0
|
287 |
end do
|
forrest@0
|
288 |
|
forrest@0
|
289 |
draw(xy)
|
forrest@0
|
290 |
frame(wks)
|
forrest@0
|
291 |
|
forrest@0
|
292 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
293 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
294 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
295 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
296 |
|
forrest@0
|
297 |
clear (wks)
|
forrest@0
|
298 |
|
forrest@0
|
299 |
delete (DATA11_1D)
|
forrest@0
|
300 |
delete (DATA12_1D)
|
forrest@0
|
301 |
delete (DATA22_1D)
|
forrest@0
|
302 |
;delete (range)
|
forrest@0
|
303 |
;delete (xvalues)
|
forrest@0
|
304 |
delete (yvalues)
|
forrest@0
|
305 |
delete (mn_yvalues)
|
forrest@0
|
306 |
delete (mx_yvalues)
|
forrest@0
|
307 |
delete (good)
|
forrest@0
|
308 |
delete (max_bar)
|
forrest@0
|
309 |
delete (min_bar)
|
forrest@0
|
310 |
delete (max_cap)
|
forrest@0
|
311 |
delete (min_cap)
|
forrest@0
|
312 |
;-----------------------------------------------------------------
|
forrest@0
|
313 |
;global res
|
forrest@0
|
314 |
|
forrest@0
|
315 |
resg = True ; Use plot options
|
forrest@0
|
316 |
resg@cnFillOn = True ; Turn on color fill
|
forrest@0
|
317 |
resg@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
318 |
; resg@cnFillMode = "RasterFill" ; Turn on raster color
|
forrest@0
|
319 |
; resg@lbLabelAutoStride = True
|
forrest@0
|
320 |
resg@cnLinesOn = False ; Turn off contourn lines
|
forrest@0
|
321 |
resg@mpFillOn = False ; Turn off map fill
|
forrest@0
|
322 |
|
forrest@0
|
323 |
resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
|
forrest@0
|
324 |
resg@cnMinLevelValF = 0. ; Min level
|
forrest@0
|
325 |
resg@cnMaxLevelValF = 10. ; Max level
|
forrest@0
|
326 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
327 |
|
forrest@0
|
328 |
;global contour ob
|
forrest@0
|
329 |
|
forrest@0
|
330 |
delta = 0.00001
|
forrest@0
|
331 |
laiob_max = where(ismissing(laiob_max).and.(ismissing(laimod_max).or.(laimod_max.lt.delta)),0.,laiob_max)
|
forrest@0
|
332 |
|
forrest@0
|
333 |
plot_name = "global_max_ob"
|
forrest@0
|
334 |
title = ob_name
|
forrest@0
|
335 |
resg@tiMainString = title
|
forrest@0
|
336 |
|
forrest@0
|
337 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
338 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
339 |
|
forrest@0
|
340 |
plot = gsn_csm_contour_map_ce(wks,laiob_max,resg)
|
forrest@0
|
341 |
frame(wks)
|
forrest@0
|
342 |
|
forrest@0
|
343 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
344 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
345 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
346 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
347 |
|
forrest@0
|
348 |
clear (wks)
|
forrest@0
|
349 |
;------------------------------------------------------------------------
|
forrest@0
|
350 |
;global contour model
|
forrest@0
|
351 |
|
forrest@0
|
352 |
plot_name = "global_max_model"
|
forrest@0
|
353 |
title = "Model " + model_name
|
forrest@0
|
354 |
resg@tiMainString = title
|
forrest@0
|
355 |
|
forrest@0
|
356 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
357 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
358 |
|
forrest@0
|
359 |
delete (plot)
|
forrest@0
|
360 |
plot = gsn_csm_contour_map_ce(wks,laimod_max,resg)
|
forrest@0
|
361 |
frame(wks)
|
forrest@0
|
362 |
|
forrest@0
|
363 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
364 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
365 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
366 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
367 |
|
forrest@0
|
368 |
clear (wks)
|
forrest@0
|
369 |
;------------------------------------------------------------------------
|
forrest@0
|
370 |
;global contour model vs ob
|
forrest@0
|
371 |
|
forrest@0
|
372 |
plot_name = "global_max_model_vs_ob"
|
forrest@0
|
373 |
|
forrest@0
|
374 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
375 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
376 |
|
forrest@0
|
377 |
delete (plot)
|
forrest@0
|
378 |
plot=new(3,graphic) ; create graphic array
|
forrest@0
|
379 |
|
forrest@0
|
380 |
resg@gsnFrame = False ; Do not draw plot
|
forrest@0
|
381 |
resg@gsnDraw = False ; Do not advance frame
|
forrest@0
|
382 |
|
forrest@0
|
383 |
; plot correlation coef
|
forrest@0
|
384 |
|
forrest@0
|
385 |
gRes = True
|
forrest@0
|
386 |
gRes@txFontHeightF = 0.02
|
forrest@0
|
387 |
gRes@txAngleF = 90
|
forrest@0
|
388 |
|
forrest@0
|
389 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrMax)+")"
|
forrest@0
|
390 |
|
forrest@0
|
391 |
gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes)
|
forrest@0
|
392 |
;--------------------------------------------------------------------
|
forrest@0
|
393 |
|
forrest@0
|
394 |
;(a) ob
|
forrest@0
|
395 |
|
forrest@0
|
396 |
title = ob_name
|
forrest@0
|
397 |
resg@tiMainString = title
|
forrest@0
|
398 |
|
forrest@0
|
399 |
plot(0) = gsn_csm_contour_map_ce(wks,laiob_max,resg)
|
forrest@0
|
400 |
|
forrest@0
|
401 |
;(b) model
|
forrest@0
|
402 |
|
forrest@0
|
403 |
title = "Model "+ model_name
|
forrest@0
|
404 |
resg@tiMainString = title
|
forrest@0
|
405 |
|
forrest@0
|
406 |
plot(1) = gsn_csm_contour_map_ce(wks,laimod_max,resg)
|
forrest@0
|
407 |
|
forrest@0
|
408 |
;(c) model-ob
|
forrest@0
|
409 |
|
forrest@0
|
410 |
zz = laimod_max
|
forrest@0
|
411 |
zz = laimod_max - laiob_max
|
forrest@0
|
412 |
title = "Model_"+model_name+" - Observed"
|
forrest@0
|
413 |
resg@tiMainString = title
|
forrest@0
|
414 |
|
forrest@0
|
415 |
resg@cnMinLevelValF = -6. ; Min level
|
forrest@0
|
416 |
resg@cnMaxLevelValF = 6. ; Max level
|
forrest@0
|
417 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
418 |
|
forrest@0
|
419 |
|
forrest@0
|
420 |
plot(2) = gsn_csm_contour_map_ce(wks,zz,resg)
|
forrest@0
|
421 |
|
forrest@0
|
422 |
pres = True ; panel plot mods desired
|
forrest@0
|
423 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
424 |
; indiv. plots in panel
|
forrest@0
|
425 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
426 |
|
forrest@0
|
427 |
gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
|
forrest@0
|
428 |
|
forrest@0
|
429 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
430 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
431 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
432 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
433 |
|
forrest@0
|
434 |
frame (wks)
|
forrest@0
|
435 |
clear (wks)
|
forrest@0
|
436 |
|
forrest@0
|
437 |
delete (plot)
|
forrest@0
|
438 |
;-----------------------------------------------------------------
|
forrest@0
|
439 |
;(C) phase
|
forrest@0
|
440 |
;--------------------------------------------------------------------
|
forrest@0
|
441 |
; get data
|
forrest@0
|
442 |
|
forrest@0
|
443 |
; observed
|
forrest@0
|
444 |
laiob_phase = laiob(0,:,:)
|
forrest@0
|
445 |
s = laiob(:,0,0)
|
forrest@0
|
446 |
laiob_phase@long_name = "Leaf Area Index Max Month"
|
forrest@0
|
447 |
|
forrest@0
|
448 |
dsizes_z = dimsizes(laiob)
|
forrest@0
|
449 |
nlat = dsizes_z(1)
|
forrest@0
|
450 |
nlon = dsizes_z(2)
|
forrest@0
|
451 |
|
forrest@0
|
452 |
do j = 0,nlat-1
|
forrest@0
|
453 |
do i = 0,nlon-1
|
forrest@0
|
454 |
s = laiob(:,j,i)
|
forrest@0
|
455 |
laiob_phase(j,i) = maxind(s) + 1
|
forrest@0
|
456 |
end do
|
forrest@0
|
457 |
end do
|
forrest@0
|
458 |
|
forrest@0
|
459 |
; print (min(laiob_phase)+"/"+max(laiob_phase))
|
forrest@0
|
460 |
delete (s)
|
forrest@0
|
461 |
delete (dsizes_z)
|
forrest@0
|
462 |
;-------------------------
|
forrest@0
|
463 |
; model
|
forrest@0
|
464 |
laimod_phase = laimod(0,:,:)
|
forrest@0
|
465 |
s = laimod(:,0,0)
|
forrest@0
|
466 |
laimod_phase@long_name = "Leaf Area Index Max Month"
|
forrest@0
|
467 |
|
forrest@0
|
468 |
dsizes_z = dimsizes(laimod)
|
forrest@0
|
469 |
nlat = dsizes_z(1)
|
forrest@0
|
470 |
nlon = dsizes_z(2)
|
forrest@0
|
471 |
|
forrest@0
|
472 |
do j = 0,nlat-1
|
forrest@0
|
473 |
do i = 0,nlon-1
|
forrest@0
|
474 |
s = laimod(:,j,i)
|
forrest@0
|
475 |
laimod_phase(j,i) = maxind(s) + 1
|
forrest@0
|
476 |
end do
|
forrest@0
|
477 |
end do
|
forrest@0
|
478 |
|
forrest@0
|
479 |
; print (min(laimod_phase)+"/"+max(laimod_phase))
|
forrest@0
|
480 |
delete (s)
|
forrest@0
|
481 |
delete (dsizes_z)
|
forrest@0
|
482 |
;------------------------
|
forrest@0
|
483 |
DATA11_1D = ndtooned(classob)
|
forrest@0
|
484 |
DATA12_1D = ndtooned(laiob_phase)
|
forrest@0
|
485 |
DATA22_1D = ndtooned(laimod_phase)
|
forrest@0
|
486 |
|
forrest@0
|
487 |
yvalues = new((/2,nx/),float)
|
forrest@0
|
488 |
mn_yvalues = new((/2,nx/),float)
|
forrest@0
|
489 |
mx_yvalues = new((/2,nx/),float)
|
forrest@0
|
490 |
|
forrest@0
|
491 |
do nd=0,1
|
forrest@0
|
492 |
|
forrest@0
|
493 |
; See if we are doing model or observational data.
|
forrest@0
|
494 |
|
forrest@0
|
495 |
if(nd.eq.0) then
|
forrest@0
|
496 |
data_ob = DATA11_1D
|
forrest@0
|
497 |
data_mod = DATA12_1D
|
forrest@0
|
498 |
else
|
forrest@0
|
499 |
data_ob = DATA11_1D
|
forrest@0
|
500 |
data_mod = DATA22_1D
|
forrest@0
|
501 |
end if
|
forrest@0
|
502 |
|
forrest@0
|
503 |
; Loop through each range and check for values.
|
forrest@0
|
504 |
|
forrest@0
|
505 |
do i=0,nr-2
|
forrest@0
|
506 |
if (i.ne.(nr-2)) then
|
forrest@0
|
507 |
; print("")
|
forrest@0
|
508 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
509 |
idx = ind((range(i).le.data_ob).and.(data_ob.lt.range(i+1)))
|
forrest@0
|
510 |
else
|
forrest@0
|
511 |
; print("")
|
forrest@0
|
512 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
513 |
idx = ind(range(i).le.data_ob)
|
forrest@0
|
514 |
end if
|
forrest@0
|
515 |
|
forrest@0
|
516 |
; Calculate average, and get min and max.
|
forrest@0
|
517 |
|
forrest@0
|
518 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
519 |
yvalues(nd,i) = avg(data_mod(idx))
|
forrest@0
|
520 |
mn_yvalues(nd,i) = min(data_mod(idx))
|
forrest@0
|
521 |
mx_yvalues(nd,i) = max(data_mod(idx))
|
forrest@0
|
522 |
count = dimsizes(idx)
|
forrest@0
|
523 |
else
|
forrest@0
|
524 |
count = 0
|
forrest@0
|
525 |
yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
526 |
mn_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
527 |
mx_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
528 |
end if
|
forrest@0
|
529 |
|
forrest@0
|
530 |
; print(nd + ": " + count + " points, avg = " + yvalues(nd,i))
|
forrest@0
|
531 |
; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
|
forrest@0
|
532 |
|
forrest@0
|
533 |
; Clean up for next time in loop.
|
forrest@0
|
534 |
|
forrest@0
|
535 |
delete(idx)
|
forrest@0
|
536 |
end do
|
forrest@0
|
537 |
delete(data_ob)
|
forrest@0
|
538 |
delete(data_mod)
|
forrest@0
|
539 |
end do
|
forrest@0
|
540 |
;-----------------------------------------------------------------
|
forrest@0
|
541 |
; compute correlation coef and M score
|
forrest@0
|
542 |
|
forrest@0
|
543 |
u = yvalues(0,:)
|
forrest@0
|
544 |
v = yvalues(1,:)
|
forrest@0
|
545 |
|
forrest@0
|
546 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
547 |
uu = u(good)
|
forrest@0
|
548 |
vv = v(good)
|
forrest@0
|
549 |
|
forrest@0
|
550 |
ccrPhase = esccr(uu,vv,0)
|
forrest@0
|
551 |
; print (ccrPhase)
|
forrest@0
|
552 |
|
forrest@0
|
553 |
; old eq
|
forrest@0
|
554 |
; bias = abs(avg(vv)-avg(uu))
|
forrest@0
|
555 |
; new eq
|
forrest@0
|
556 |
bias = avg(abs(vv-uu))
|
forrest@0
|
557 |
|
forrest@0
|
558 |
bias = where((bias.gt. 6.),12.-bias,bias)
|
forrest@0
|
559 |
Mphase = ((6. - bias)/6.)*5.
|
forrest@0
|
560 |
|
forrest@0
|
561 |
print (Mphase)
|
forrest@0
|
562 |
|
forrest@0
|
563 |
delete (u)
|
forrest@0
|
564 |
delete (v)
|
forrest@0
|
565 |
delete (uu)
|
forrest@0
|
566 |
delete (vv)
|
forrest@0
|
567 |
;--------------------------------------------------------------------
|
forrest@0
|
568 |
; histogram res
|
forrest@0
|
569 |
|
forrest@0
|
570 |
resm = True
|
forrest@0
|
571 |
resm@gsnMaximize = True
|
forrest@0
|
572 |
resm@gsnDraw = False
|
forrest@0
|
573 |
resm@gsnFrame = False
|
forrest@0
|
574 |
resm@xyMarkLineMode = "Markers"
|
forrest@0
|
575 |
resm@xyMarkerSizeF = 0.014
|
forrest@0
|
576 |
resm@xyMarker = 16
|
forrest@0
|
577 |
resm@xyMarkerColors = (/"Brown","Blue"/)
|
forrest@0
|
578 |
; resm@trYMinF = min(mn_yvalues) - 10.
|
forrest@0
|
579 |
; resm@trYMaxF = max(mx_yvalues) + 10.
|
forrest@0
|
580 |
resm@trYMinF = min(mn_yvalues) - 2
|
forrest@0
|
581 |
resm@trYMaxF = max(mx_yvalues) + 4
|
forrest@0
|
582 |
|
forrest@0
|
583 |
resm@tiYAxisString = "Max LAI (Leaf Area Index) Month"
|
forrest@0
|
584 |
resm@tiXAxisString = "Land Cover Type"
|
forrest@0
|
585 |
|
forrest@0
|
586 |
max_bar = new((/2,nx/),graphic)
|
forrest@0
|
587 |
min_bar = new((/2,nx/),graphic)
|
forrest@0
|
588 |
max_cap = new((/2,nx/),graphic)
|
forrest@0
|
589 |
min_cap = new((/2,nx/),graphic)
|
forrest@0
|
590 |
|
forrest@0
|
591 |
lnres = True
|
forrest@0
|
592 |
line_colors = (/"brown","blue"/)
|
forrest@0
|
593 |
;------------------------------------------------------------------
|
forrest@0
|
594 |
; Start the graphics.
|
forrest@0
|
595 |
|
forrest@0
|
596 |
plot_name = "histogram_phase"
|
forrest@0
|
597 |
title = model_name + " vs Observed"
|
forrest@0
|
598 |
resm@tiMainString = title
|
forrest@0
|
599 |
|
forrest@0
|
600 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
601 |
;-----------------------------
|
forrest@0
|
602 |
; Add a boxed legend using the more simple method
|
forrest@0
|
603 |
|
forrest@0
|
604 |
resm@pmLegendDisplayMode = "Always"
|
forrest@0
|
605 |
; resm@pmLegendWidthF = 0.1
|
forrest@0
|
606 |
resm@pmLegendWidthF = 0.08
|
forrest@0
|
607 |
resm@pmLegendHeightF = 0.05
|
forrest@0
|
608 |
resm@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
609 |
; resm@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
610 |
; resm@pmLegendParallelPosF = 0.18
|
forrest@0
|
611 |
resm@pmLegendParallelPosF = 0.88 ;(rightward)
|
forrest@0
|
612 |
|
forrest@0
|
613 |
; resm@lgPerimOn = False
|
forrest@0
|
614 |
resm@lgLabelFontHeightF = 0.015
|
forrest@0
|
615 |
resm@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
616 |
;-----------------------------
|
forrest@0
|
617 |
tRes = True
|
forrest@0
|
618 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
619 |
|
forrest@0
|
620 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrPhase)+")"
|
forrest@0
|
621 |
|
forrest@0
|
622 |
gsn_text_ndc(wks,correlation_text,0.56,0.85,tRes)
|
forrest@0
|
623 |
|
forrest@0
|
624 |
xy = gsn_csm_xy(wks,xvalues,yvalues,resm)
|
forrest@0
|
625 |
;-------------------------------
|
forrest@0
|
626 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
627 |
|
forrest@0
|
628 |
do nd=0,1
|
forrest@0
|
629 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
630 |
do i=0,nx-1
|
forrest@0
|
631 |
|
forrest@0
|
632 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
633 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
634 |
|
forrest@0
|
635 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
636 |
|
forrest@0
|
637 |
x1 = xvalues(nd,i)
|
forrest@0
|
638 |
y1 = yvalues(nd,i)
|
forrest@0
|
639 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
640 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
641 |
|
forrest@0
|
642 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
643 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
644 |
|
forrest@0
|
645 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
646 |
|
forrest@0
|
647 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
648 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
649 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
650 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
651 |
|
forrest@0
|
652 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
653 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
654 |
end if
|
forrest@0
|
655 |
end do
|
forrest@0
|
656 |
end do
|
forrest@0
|
657 |
|
forrest@0
|
658 |
draw(xy)
|
forrest@0
|
659 |
frame(wks)
|
forrest@0
|
660 |
|
forrest@0
|
661 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
662 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
663 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
664 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
665 |
|
forrest@0
|
666 |
clear (wks)
|
forrest@0
|
667 |
|
forrest@0
|
668 |
delete (DATA11_1D)
|
forrest@0
|
669 |
delete (DATA12_1D)
|
forrest@0
|
670 |
delete (DATA22_1D)
|
forrest@0
|
671 |
;delete (range)
|
forrest@0
|
672 |
;delete (xvalues)
|
forrest@0
|
673 |
delete (yvalues)
|
forrest@0
|
674 |
delete (mn_yvalues)
|
forrest@0
|
675 |
delete (mx_yvalues)
|
forrest@0
|
676 |
delete (good)
|
forrest@0
|
677 |
delete (max_bar)
|
forrest@0
|
678 |
delete (min_bar)
|
forrest@0
|
679 |
delete (max_cap)
|
forrest@0
|
680 |
delete (min_cap)
|
forrest@0
|
681 |
;-----------------------------------------------------------------
|
forrest@0
|
682 |
;global res
|
forrest@0
|
683 |
|
forrest@0
|
684 |
resg = True ; Use plot options
|
forrest@0
|
685 |
resg@cnFillOn = True ; Turn on color fill
|
forrest@0
|
686 |
resg@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
687 |
; resg@cnFillMode = "RasterFill" ; Turn on raster color
|
forrest@0
|
688 |
; resg@lbLabelAutoStride = True
|
forrest@0
|
689 |
resg@cnLinesOn = False ; Turn off contourn lines
|
forrest@0
|
690 |
resg@mpFillOn = False ; Turn off map fill
|
forrest@0
|
691 |
|
forrest@0
|
692 |
resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
|
forrest@0
|
693 |
resg@cnMinLevelValF = 1. ; Min level
|
forrest@0
|
694 |
resg@cnMaxLevelValF = 12. ; Max level
|
forrest@0
|
695 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
696 |
|
forrest@0
|
697 |
;global contour ob
|
forrest@0
|
698 |
|
forrest@0
|
699 |
delta = 0.00001
|
forrest@0
|
700 |
laiob_phase = where(ismissing(laiob_phase).and.(ismissing(laimod_phase).or.(laimod_phase.lt.delta)),0.,laiob_phase)
|
forrest@0
|
701 |
|
forrest@0
|
702 |
plot_name = "global_phase_ob"
|
forrest@0
|
703 |
title = ob_name
|
forrest@0
|
704 |
resg@tiMainString = title
|
forrest@0
|
705 |
|
forrest@0
|
706 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
707 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
708 |
|
forrest@0
|
709 |
plot = gsn_csm_contour_map_ce(wks,laiob_phase,resg)
|
forrest@0
|
710 |
frame(wks)
|
forrest@0
|
711 |
|
forrest@0
|
712 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
713 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
714 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
715 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
716 |
|
forrest@0
|
717 |
clear (wks)
|
forrest@0
|
718 |
;------------------------------------------------------------------------
|
forrest@0
|
719 |
;global contour model
|
forrest@0
|
720 |
|
forrest@0
|
721 |
plot_name = "global_phase_model"
|
forrest@0
|
722 |
title = "Model " + model_name
|
forrest@0
|
723 |
resg@tiMainString = title
|
forrest@0
|
724 |
|
forrest@0
|
725 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
726 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
727 |
|
forrest@0
|
728 |
delete (plot)
|
forrest@0
|
729 |
plot = gsn_csm_contour_map_ce(wks,laimod_phase,resg)
|
forrest@0
|
730 |
frame(wks)
|
forrest@0
|
731 |
|
forrest@0
|
732 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
733 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
734 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
735 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
736 |
|
forrest@0
|
737 |
clear (wks)
|
forrest@0
|
738 |
;------------------------------------------------------------------------
|
forrest@0
|
739 |
;global contour model vs ob
|
forrest@0
|
740 |
|
forrest@0
|
741 |
plot_name = "global_phase_model_vs_ob"
|
forrest@0
|
742 |
|
forrest@0
|
743 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
744 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
745 |
|
forrest@0
|
746 |
delete (plot)
|
forrest@0
|
747 |
plot=new(3,graphic) ; create graphic array
|
forrest@0
|
748 |
|
forrest@0
|
749 |
resg@gsnFrame = False ; Do not draw plot
|
forrest@0
|
750 |
resg@gsnDraw = False ; Do not advance frame
|
forrest@0
|
751 |
|
forrest@0
|
752 |
; plot correlation coef
|
forrest@0
|
753 |
|
forrest@0
|
754 |
gRes = True
|
forrest@0
|
755 |
gRes@txFontHeightF = 0.02
|
forrest@0
|
756 |
gRes@txAngleF = 90
|
forrest@0
|
757 |
|
forrest@0
|
758 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrPhase)+")"
|
forrest@0
|
759 |
|
forrest@0
|
760 |
gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes)
|
forrest@0
|
761 |
;--------------------------------------------------------------------
|
forrest@0
|
762 |
|
forrest@0
|
763 |
;(a) ob
|
forrest@0
|
764 |
|
forrest@0
|
765 |
title = ob_name
|
forrest@0
|
766 |
resg@tiMainString = title
|
forrest@0
|
767 |
|
forrest@0
|
768 |
plot(0) = gsn_csm_contour_map_ce(wks,laiob_phase,resg)
|
forrest@0
|
769 |
|
forrest@0
|
770 |
;(b) model
|
forrest@0
|
771 |
|
forrest@0
|
772 |
title = "Model "+ model_name
|
forrest@0
|
773 |
resg@tiMainString = title
|
forrest@0
|
774 |
|
forrest@0
|
775 |
plot(1) = gsn_csm_contour_map_ce(wks,laimod_phase,resg)
|
forrest@0
|
776 |
|
forrest@0
|
777 |
;(c) model-ob
|
forrest@0
|
778 |
|
forrest@0
|
779 |
delete (zz)
|
forrest@0
|
780 |
zz = laimod_phase
|
forrest@0
|
781 |
zz = laimod_phase - laiob_phase
|
forrest@0
|
782 |
title = "Model_"+model_name+" - Observed"
|
forrest@0
|
783 |
resg@tiMainString = title
|
forrest@0
|
784 |
|
forrest@0
|
785 |
resg@cnMinLevelValF = -6. ; Min level
|
forrest@0
|
786 |
resg@cnMaxLevelValF = 6. ; Max level
|
forrest@0
|
787 |
resg@cnLevelSpacingF = 1. ; interval
|
forrest@0
|
788 |
|
forrest@0
|
789 |
|
forrest@0
|
790 |
plot(2) = gsn_csm_contour_map_ce(wks,zz,resg)
|
forrest@0
|
791 |
|
forrest@0
|
792 |
; pres = True ; panel plot mods desired
|
forrest@0
|
793 |
; pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
794 |
; indiv. plots in panel
|
forrest@0
|
795 |
; pres@gsnMaximize = True ; fill the page
|
forrest@0
|
796 |
|
forrest@0
|
797 |
gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
|
forrest@0
|
798 |
|
forrest@0
|
799 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
800 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
801 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
802 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
803 |
|
forrest@0
|
804 |
frame (wks)
|
forrest@0
|
805 |
clear (wks)
|
forrest@0
|
806 |
|
forrest@0
|
807 |
delete (plot)
|
forrest@0
|
808 |
;-----------------------------------------------------------------
|
forrest@0
|
809 |
;(D) grow day
|
forrest@0
|
810 |
;--------------------------------------------------------------------
|
forrest@0
|
811 |
; get data
|
forrest@0
|
812 |
|
forrest@0
|
813 |
day_of_data = (/31,28,31,30,31,30,31,31,30,31,30,31/)
|
forrest@0
|
814 |
|
forrest@0
|
815 |
; observed
|
forrest@0
|
816 |
laiob_grow = laiob(0,:,:)
|
forrest@0
|
817 |
laiob_grow@long_name = "Days of Growing Season"
|
forrest@0
|
818 |
|
forrest@0
|
819 |
dsizes_z = dimsizes(laiob)
|
forrest@0
|
820 |
ntime = dsizes_z(0)
|
forrest@0
|
821 |
nlat = dsizes_z(1)
|
forrest@0
|
822 |
nlon = dsizes_z(2)
|
forrest@0
|
823 |
|
forrest@0
|
824 |
do j = 0,nlat-1
|
forrest@0
|
825 |
do i = 0,nlon-1
|
forrest@0
|
826 |
nday = 0.
|
forrest@0
|
827 |
do k = 0,ntime-1
|
forrest@0
|
828 |
if (.not. ismissing(laiob(k,j,i)) .and. laiob(k,j,i) .gt. 1.0) then
|
forrest@0
|
829 |
nday = nday + day_of_data(k)
|
forrest@0
|
830 |
end if
|
forrest@0
|
831 |
end do
|
forrest@0
|
832 |
|
forrest@0
|
833 |
laiob_grow(j,i) = nday
|
forrest@0
|
834 |
end do
|
forrest@0
|
835 |
end do
|
forrest@0
|
836 |
|
forrest@0
|
837 |
; print (min(laiob_grow)+"/"+max(laiob_grow))
|
forrest@0
|
838 |
;-------------------------
|
forrest@0
|
839 |
; model
|
forrest@0
|
840 |
laimod_grow = laimod(0,:,:)
|
forrest@0
|
841 |
laimod_grow@long_name = "Days of Growing Season"
|
forrest@0
|
842 |
|
forrest@0
|
843 |
dsizes_z = dimsizes(laimod)
|
forrest@0
|
844 |
ntime = dsizes_z(0)
|
forrest@0
|
845 |
nlat = dsizes_z(1)
|
forrest@0
|
846 |
nlon = dsizes_z(2)
|
forrest@0
|
847 |
|
forrest@0
|
848 |
do j = 0,nlat-1
|
forrest@0
|
849 |
do i = 0,nlon-1
|
forrest@0
|
850 |
nday = 0.
|
forrest@0
|
851 |
do k = 0,ntime-1
|
forrest@0
|
852 |
if (.not. ismissing(laimod(k,j,i)) .and. laimod(k,j,i) .gt. 1.0) then
|
forrest@0
|
853 |
nday = nday + day_of_data(k)
|
forrest@0
|
854 |
end if
|
forrest@0
|
855 |
end do
|
forrest@0
|
856 |
|
forrest@0
|
857 |
laimod_grow(j,i) = nday
|
forrest@0
|
858 |
end do
|
forrest@0
|
859 |
end do
|
forrest@0
|
860 |
|
forrest@0
|
861 |
; print (min(laimod_grow)+"/"+max(laimod_grow))
|
forrest@0
|
862 |
;------------------------
|
forrest@0
|
863 |
DATA11_1D = ndtooned(classob)
|
forrest@0
|
864 |
DATA12_1D = ndtooned(laiob_grow)
|
forrest@0
|
865 |
DATA22_1D = ndtooned(laimod_grow)
|
forrest@0
|
866 |
|
forrest@0
|
867 |
yvalues = new((/2,nx/),float)
|
forrest@0
|
868 |
mn_yvalues = new((/2,nx/),float)
|
forrest@0
|
869 |
mx_yvalues = new((/2,nx/),float)
|
forrest@0
|
870 |
|
forrest@0
|
871 |
do nd=0,1
|
forrest@0
|
872 |
|
forrest@0
|
873 |
; See if we are doing model or observational data.
|
forrest@0
|
874 |
|
forrest@0
|
875 |
if(nd.eq.0) then
|
forrest@0
|
876 |
data_ob = DATA11_1D
|
forrest@0
|
877 |
data_mod = DATA12_1D
|
forrest@0
|
878 |
else
|
forrest@0
|
879 |
data_ob = DATA11_1D
|
forrest@0
|
880 |
data_mod = DATA22_1D
|
forrest@0
|
881 |
end if
|
forrest@0
|
882 |
|
forrest@0
|
883 |
; Loop through each range and check for values.
|
forrest@0
|
884 |
|
forrest@0
|
885 |
do i=0,nr-2
|
forrest@0
|
886 |
if (i.ne.(nr-2)) then
|
forrest@0
|
887 |
; print("")
|
forrest@0
|
888 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
889 |
idx = ind((range(i).le.data_ob).and.(data_ob.lt.range(i+1)))
|
forrest@0
|
890 |
else
|
forrest@0
|
891 |
; print("")
|
forrest@0
|
892 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
893 |
idx = ind(range(i).le.data_ob)
|
forrest@0
|
894 |
end if
|
forrest@0
|
895 |
|
forrest@0
|
896 |
; Calculate average, and get min and max.
|
forrest@0
|
897 |
|
forrest@0
|
898 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
899 |
yvalues(nd,i) = avg(data_mod(idx))
|
forrest@0
|
900 |
mn_yvalues(nd,i) = min(data_mod(idx))
|
forrest@0
|
901 |
mx_yvalues(nd,i) = max(data_mod(idx))
|
forrest@0
|
902 |
count = dimsizes(idx)
|
forrest@0
|
903 |
else
|
forrest@0
|
904 |
count = 0
|
forrest@0
|
905 |
yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
906 |
mn_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
907 |
mx_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
908 |
end if
|
forrest@0
|
909 |
|
forrest@0
|
910 |
; print(nd + ": " + count + " points, avg = " + yvalues(nd,i))
|
forrest@0
|
911 |
; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
|
forrest@0
|
912 |
|
forrest@0
|
913 |
; Clean up for next time in loop.
|
forrest@0
|
914 |
|
forrest@0
|
915 |
delete(idx)
|
forrest@0
|
916 |
end do
|
forrest@0
|
917 |
delete(data_ob)
|
forrest@0
|
918 |
delete(data_mod)
|
forrest@0
|
919 |
end do
|
forrest@0
|
920 |
;-----------------------------------------------------------------
|
forrest@0
|
921 |
; compute correlation coef and M score
|
forrest@0
|
922 |
|
forrest@0
|
923 |
u = yvalues(0,:)
|
forrest@0
|
924 |
v = yvalues(1,:)
|
forrest@0
|
925 |
|
forrest@0
|
926 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
927 |
uu = u(good)
|
forrest@0
|
928 |
vv = v(good)
|
forrest@0
|
929 |
|
forrest@0
|
930 |
ccrGrow = esccr(uu,vv,0)
|
forrest@0
|
931 |
; print (ccrGrow)
|
forrest@0
|
932 |
|
forrest@0
|
933 |
; new eq
|
forrest@0
|
934 |
bias = sum(abs(vv-uu)/(vv+uu))
|
forrest@0
|
935 |
Mgrow = (1.- (bias/dimsizes(uu)))*5.
|
forrest@0
|
936 |
|
forrest@0
|
937 |
print (Mgrow)
|
forrest@0
|
938 |
|
forrest@0
|
939 |
delete (u)
|
forrest@0
|
940 |
delete (v)
|
forrest@0
|
941 |
delete (uu)
|
forrest@0
|
942 |
delete (vv)
|
forrest@0
|
943 |
;--------------------------------------------------------------------
|
forrest@0
|
944 |
; histogram res
|
forrest@0
|
945 |
|
forrest@0
|
946 |
resm = True
|
forrest@0
|
947 |
resm@gsnMaximize = True
|
forrest@0
|
948 |
resm@gsnDraw = False
|
forrest@0
|
949 |
resm@gsnFrame = False
|
forrest@0
|
950 |
resm@xyMarkLineMode = "Markers"
|
forrest@0
|
951 |
resm@xyMarkerSizeF = 0.014
|
forrest@0
|
952 |
resm@xyMarker = 16
|
forrest@0
|
953 |
resm@xyMarkerColors = (/"Brown","Blue"/)
|
forrest@0
|
954 |
; resm@trYMinF = min(mn_yvalues) - 10.
|
forrest@0
|
955 |
; resm@trYMaxF = max(mx_yvalues) + 10.
|
forrest@0
|
956 |
resm@trYMinF = min(mn_yvalues) - 2
|
forrest@0
|
957 |
resm@trYMaxF = max(mx_yvalues) + 4
|
forrest@0
|
958 |
|
forrest@0
|
959 |
resm@tiYAxisString = "Days of Growing season"
|
forrest@0
|
960 |
resm@tiXAxisString = "Land Cover Type"
|
forrest@0
|
961 |
|
forrest@0
|
962 |
max_bar = new((/2,nx/),graphic)
|
forrest@0
|
963 |
min_bar = new((/2,nx/),graphic)
|
forrest@0
|
964 |
max_cap = new((/2,nx/),graphic)
|
forrest@0
|
965 |
min_cap = new((/2,nx/),graphic)
|
forrest@0
|
966 |
|
forrest@0
|
967 |
lnres = True
|
forrest@0
|
968 |
line_colors = (/"brown","blue"/)
|
forrest@0
|
969 |
;------------------------------------------------------------------
|
forrest@0
|
970 |
; Start the graphics.
|
forrest@0
|
971 |
|
forrest@0
|
972 |
plot_name = "histogram_grow"
|
forrest@0
|
973 |
title = model_name + " vs Observed"
|
forrest@0
|
974 |
resm@tiMainString = title
|
forrest@0
|
975 |
|
forrest@0
|
976 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
977 |
;-----------------------------
|
forrest@0
|
978 |
; Add a boxed legend using the more simple method
|
forrest@0
|
979 |
|
forrest@0
|
980 |
resm@pmLegendDisplayMode = "Always"
|
forrest@0
|
981 |
; resm@pmLegendWidthF = 0.1
|
forrest@0
|
982 |
resm@pmLegendWidthF = 0.08
|
forrest@0
|
983 |
resm@pmLegendHeightF = 0.05
|
forrest@0
|
984 |
resm@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
985 |
; resm@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
986 |
; resm@pmLegendParallelPosF = 0.18
|
forrest@0
|
987 |
resm@pmLegendParallelPosF = 0.88 ;(rightward)
|
forrest@0
|
988 |
|
forrest@0
|
989 |
; resm@lgPerimOn = False
|
forrest@0
|
990 |
resm@lgLabelFontHeightF = 0.015
|
forrest@0
|
991 |
resm@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
992 |
;-----------------------------
|
forrest@0
|
993 |
tRes = True
|
forrest@0
|
994 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
995 |
|
forrest@0
|
996 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrGrow)+")"
|
forrest@0
|
997 |
|
forrest@0
|
998 |
gsn_text_ndc(wks,correlation_text,0.56,0.85,tRes)
|
forrest@0
|
999 |
|
forrest@0
|
1000 |
xy = gsn_csm_xy(wks,xvalues,yvalues,resm)
|
forrest@0
|
1001 |
;-------------------------------
|
forrest@0
|
1002 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
1003 |
|
forrest@0
|
1004 |
do nd=0,1
|
forrest@0
|
1005 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
1006 |
do i=0,nx-1
|
forrest@0
|
1007 |
|
forrest@0
|
1008 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
1009 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
1010 |
|
forrest@0
|
1011 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
1012 |
|
forrest@0
|
1013 |
x1 = xvalues(nd,i)
|
forrest@0
|
1014 |
y1 = yvalues(nd,i)
|
forrest@0
|
1015 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
1016 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
1017 |
|
forrest@0
|
1018 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
1019 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
1020 |
|
forrest@0
|
1021 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
1022 |
|
forrest@0
|
1023 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
1024 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
1025 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
1026 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
1027 |
|
forrest@0
|
1028 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
1029 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
1030 |
end if
|
forrest@0
|
1031 |
end do
|
forrest@0
|
1032 |
end do
|
forrest@0
|
1033 |
|
forrest@0
|
1034 |
draw(xy)
|
forrest@0
|
1035 |
frame(wks)
|
forrest@0
|
1036 |
|
forrest@0
|
1037 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1038 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
1039 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
1040 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1041 |
|
forrest@0
|
1042 |
clear (wks)
|
forrest@0
|
1043 |
|
forrest@0
|
1044 |
delete (DATA11_1D)
|
forrest@0
|
1045 |
delete (DATA12_1D)
|
forrest@0
|
1046 |
delete (DATA22_1D)
|
forrest@0
|
1047 |
;delete (range)
|
forrest@0
|
1048 |
;delete (xvalues)
|
forrest@0
|
1049 |
delete (yvalues)
|
forrest@0
|
1050 |
delete (mn_yvalues)
|
forrest@0
|
1051 |
delete (mx_yvalues)
|
forrest@0
|
1052 |
delete (good)
|
forrest@0
|
1053 |
delete (max_bar)
|
forrest@0
|
1054 |
delete (min_bar)
|
forrest@0
|
1055 |
delete (max_cap)
|
forrest@0
|
1056 |
delete (min_cap)
|
forrest@0
|
1057 |
;-----------------------------------------------------------------
|
forrest@0
|
1058 |
;global res
|
forrest@0
|
1059 |
|
forrest@0
|
1060 |
resg = True ; Use plot options
|
forrest@0
|
1061 |
resg@cnFillOn = True ; Turn on color fill
|
forrest@0
|
1062 |
resg@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
1063 |
; resg@cnFillMode = "RasterFill" ; Turn on raster color
|
forrest@0
|
1064 |
; resg@lbLabelAutoStride = True
|
forrest@0
|
1065 |
resg@cnLinesOn = False ; Turn off contourn lines
|
forrest@0
|
1066 |
resg@mpFillOn = False ; Turn off map fill
|
forrest@0
|
1067 |
|
forrest@0
|
1068 |
resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
|
forrest@0
|
1069 |
resg@cnMinLevelValF = 0. ; Min level
|
forrest@0
|
1070 |
resg@cnMaxLevelValF = 360. ; Max level
|
forrest@0
|
1071 |
resg@cnLevelSpacingF = 30. ; interval
|
forrest@0
|
1072 |
|
forrest@0
|
1073 |
;global contour ob
|
forrest@0
|
1074 |
|
forrest@0
|
1075 |
delta = 0.00001
|
forrest@0
|
1076 |
laiob_grow = where(ismissing(laiob_grow).and.(ismissing(laimod_grow).or.(laimod_grow.lt.delta)),0.,laiob_grow)
|
forrest@0
|
1077 |
|
forrest@0
|
1078 |
plot_name = "global_grow_ob"
|
forrest@0
|
1079 |
title = ob_name
|
forrest@0
|
1080 |
resg@tiMainString = title
|
forrest@0
|
1081 |
|
forrest@0
|
1082 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
1083 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
1084 |
|
forrest@0
|
1085 |
plot = gsn_csm_contour_map_ce(wks,laiob_grow,resg)
|
forrest@0
|
1086 |
frame(wks)
|
forrest@0
|
1087 |
|
forrest@0
|
1088 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1089 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
1090 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
1091 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1092 |
|
forrest@0
|
1093 |
clear (wks)
|
forrest@0
|
1094 |
;------------------------------------------------------------------------
|
forrest@0
|
1095 |
;global contour model
|
forrest@0
|
1096 |
|
forrest@0
|
1097 |
plot_name = "global_grow_model"
|
forrest@0
|
1098 |
title = "Model " + model_name
|
forrest@0
|
1099 |
resg@tiMainString = title
|
forrest@0
|
1100 |
|
forrest@0
|
1101 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
1102 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
1103 |
|
forrest@0
|
1104 |
delete (plot)
|
forrest@0
|
1105 |
plot = gsn_csm_contour_map_ce(wks,laimod_grow,resg)
|
forrest@0
|
1106 |
frame(wks)
|
forrest@0
|
1107 |
|
forrest@0
|
1108 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1109 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
1110 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
1111 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1112 |
|
forrest@0
|
1113 |
clear (wks)
|
forrest@0
|
1114 |
;------------------------------------------------------------------------
|
forrest@0
|
1115 |
;global contour model vs ob
|
forrest@0
|
1116 |
|
forrest@0
|
1117 |
plot_name = "global_grow_model_vs_ob"
|
forrest@0
|
1118 |
|
forrest@0
|
1119 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
1120 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
1121 |
|
forrest@0
|
1122 |
delete (plot)
|
forrest@0
|
1123 |
plot=new(3,graphic) ; create graphic array
|
forrest@0
|
1124 |
|
forrest@0
|
1125 |
resg@gsnFrame = False ; Do not draw plot
|
forrest@0
|
1126 |
resg@gsnDraw = False ; Do not advance frame
|
forrest@0
|
1127 |
|
forrest@0
|
1128 |
; plot correlation coef
|
forrest@0
|
1129 |
|
forrest@0
|
1130 |
gRes = True
|
forrest@0
|
1131 |
gRes@txFontHeightF = 0.02
|
forrest@0
|
1132 |
gRes@txAngleF = 90
|
forrest@0
|
1133 |
|
forrest@0
|
1134 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrGrow)+")"
|
forrest@0
|
1135 |
|
forrest@0
|
1136 |
gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes)
|
forrest@0
|
1137 |
;--------------------------------------------------------------------
|
forrest@0
|
1138 |
|
forrest@0
|
1139 |
;(a) ob
|
forrest@0
|
1140 |
|
forrest@0
|
1141 |
title = ob_name
|
forrest@0
|
1142 |
resg@tiMainString = title
|
forrest@0
|
1143 |
|
forrest@0
|
1144 |
plot(0) = gsn_csm_contour_map_ce(wks,laiob_grow,resg)
|
forrest@0
|
1145 |
|
forrest@0
|
1146 |
;(b) model
|
forrest@0
|
1147 |
|
forrest@0
|
1148 |
title = "Model "+ model_name
|
forrest@0
|
1149 |
resg@tiMainString = title
|
forrest@0
|
1150 |
|
forrest@0
|
1151 |
plot(1) = gsn_csm_contour_map_ce(wks,laimod_grow,resg)
|
forrest@0
|
1152 |
|
forrest@0
|
1153 |
;(c) model-ob
|
forrest@0
|
1154 |
|
forrest@0
|
1155 |
delete (zz)
|
forrest@0
|
1156 |
zz = laimod_grow
|
forrest@0
|
1157 |
zz = laimod_grow - laiob_grow
|
forrest@0
|
1158 |
title = "Model_"+model_name+" - Observed"
|
forrest@0
|
1159 |
resg@tiMainString = title
|
forrest@0
|
1160 |
|
forrest@0
|
1161 |
resg@cnMinLevelValF = -120. ; Min level
|
forrest@0
|
1162 |
resg@cnMaxLevelValF = 120. ; Max level
|
forrest@0
|
1163 |
resg@cnLevelSpacingF = 20. ; interval
|
forrest@0
|
1164 |
|
forrest@0
|
1165 |
|
forrest@0
|
1166 |
plot(2) = gsn_csm_contour_map_ce(wks,zz,resg)
|
forrest@0
|
1167 |
|
forrest@0
|
1168 |
pres = True ; panel plot mods desired
|
forrest@0
|
1169 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
1170 |
; indiv. plots in panel
|
forrest@0
|
1171 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
1172 |
|
forrest@0
|
1173 |
gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
|
forrest@0
|
1174 |
|
forrest@0
|
1175 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1176 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
1177 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
1178 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
1179 |
|
forrest@0
|
1180 |
frame (wks)
|
forrest@0
|
1181 |
clear (wks)
|
forrest@0
|
1182 |
|
forrest@0
|
1183 |
delete (plot)
|
forrest@0
|
1184 |
end
|
forrest@0
|
1185 |
|