forrest@0
|
1 |
; ***********************************************
|
forrest@0
|
2 |
; combine all scatter and all histogram
|
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 |
plot_type = "ps"
|
forrest@0
|
20 |
plot_type_new = "png"
|
forrest@0
|
21 |
|
forrest@0
|
22 |
;************************************************
|
forrest@0
|
23 |
; read in ob data
|
forrest@0
|
24 |
;************************************************
|
forrest@0
|
25 |
;(1)
|
forrest@0
|
26 |
dir81 = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
|
forrest@0
|
27 |
fil81 = "data.81.nc"
|
forrest@0
|
28 |
f81 = addfile (dir81+fil81,"r")
|
forrest@0
|
29 |
|
forrest@0
|
30 |
id81 = f81->SITE_ID
|
forrest@0
|
31 |
npp81 = f81->TNPP_C
|
forrest@0
|
32 |
rain81 = tofloat(f81->PREC_ANN)
|
forrest@0
|
33 |
x81 = f81->LONG_DD
|
forrest@0
|
34 |
y81 = f81->LAT_DD
|
forrest@0
|
35 |
|
forrest@0
|
36 |
id81@long_name = "SITE_ID"
|
forrest@0
|
37 |
|
forrest@0
|
38 |
;change longitude from (-180,180) to (0,360)
|
forrest@0
|
39 |
;for model data interpolation
|
forrest@0
|
40 |
|
forrest@0
|
41 |
do i= 0,dimsizes(x81)-1
|
forrest@0
|
42 |
if (x81(i) .lt. 0.) then
|
forrest@0
|
43 |
x81(i) = x81(i)+ 360.
|
forrest@0
|
44 |
end if
|
forrest@0
|
45 |
end do
|
forrest@0
|
46 |
;print (x81)
|
forrest@0
|
47 |
;-------------------------------------
|
forrest@0
|
48 |
;(2)
|
forrest@0
|
49 |
dir933 = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
|
forrest@0
|
50 |
fil933 = "data.933.nc"
|
forrest@0
|
51 |
f933 = addfile (dir933+fil933,"r")
|
forrest@0
|
52 |
|
forrest@0
|
53 |
id933 = f933->SITE_ID
|
forrest@0
|
54 |
npp933 = f933->TNPP_C
|
forrest@0
|
55 |
rain933 = f933->PREC
|
forrest@0
|
56 |
x933 = f933->LONG_DD
|
forrest@0
|
57 |
y933 = f933->LAT_DD
|
forrest@0
|
58 |
|
forrest@0
|
59 |
id933@long_name = "SITE_ID"
|
forrest@0
|
60 |
|
forrest@0
|
61 |
;change longitude from (-180,180) to (0,360)
|
forrest@0
|
62 |
;for model data interpolation
|
forrest@0
|
63 |
|
forrest@0
|
64 |
do i= 0,dimsizes(x933)-1
|
forrest@0
|
65 |
if (x933(i) .lt. 0.) then
|
forrest@0
|
66 |
x933(i) = x933(i)+ 360.
|
forrest@0
|
67 |
end if
|
forrest@0
|
68 |
end do
|
forrest@0
|
69 |
;print (x933)
|
forrest@0
|
70 |
;----------------------------------------
|
forrest@0
|
71 |
;(3)
|
forrest@0
|
72 |
dirglobe = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
|
forrest@0
|
73 |
filglobe = "Npp_T31_mean.nc"
|
forrest@0
|
74 |
fglobe = addfile (dirglobe+filglobe,"r")
|
forrest@0
|
75 |
|
forrest@0
|
76 |
nppglobe = fglobe->NPP
|
forrest@0
|
77 |
|
forrest@0
|
78 |
;************************************************
|
forrest@0
|
79 |
; read in model data
|
forrest@0
|
80 |
;************************************************
|
forrest@0
|
81 |
model_name = "b30.061n"
|
forrest@0
|
82 |
|
forrest@0
|
83 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
84 |
film = "b30.061n_1995-2004_ANN_climo_lnd.nc"
|
forrest@0
|
85 |
fm = addfile (dirm+film,"r")
|
forrest@0
|
86 |
|
forrest@0
|
87 |
nppmod0 = fm->NPP
|
forrest@0
|
88 |
rainmod0 = fm->RAIN
|
forrest@0
|
89 |
xm = fm->lon
|
forrest@0
|
90 |
ym = fm->lat
|
forrest@0
|
91 |
|
forrest@0
|
92 |
nppmod = nppmod0(0,:,:)
|
forrest@0
|
93 |
rainmod = rainmod0(0,:,:)
|
forrest@0
|
94 |
delete (nppmod0)
|
forrest@0
|
95 |
delete (rainmod0)
|
forrest@0
|
96 |
|
forrest@0
|
97 |
nppmod81 =linint2_points(xm,ym,nppmod,True,x81,y81,0)
|
forrest@0
|
98 |
|
forrest@0
|
99 |
nppmod933 =linint2_points(xm,ym,nppmod,True,x933,y933,0)
|
forrest@0
|
100 |
|
forrest@0
|
101 |
rainmod81 =linint2_points(xm,ym,rainmod,True,x81,y81,0)
|
forrest@0
|
102 |
|
forrest@0
|
103 |
rainmod933=linint2_points(xm,ym,rainmod,True,x933,y933,0)
|
forrest@0
|
104 |
|
forrest@0
|
105 |
;************************************************
|
forrest@0
|
106 |
; Units for these variables are:
|
forrest@0
|
107 |
;
|
forrest@0
|
108 |
; rain81 : mm/year
|
forrest@0
|
109 |
; rainmod : mm/s
|
forrest@0
|
110 |
; npp81 : g C/m^2/year
|
forrest@0
|
111 |
; nppmod81: g C/m^2/s
|
forrest@0
|
112 |
; nppglobe: g C/m^2/year
|
forrest@0
|
113 |
;
|
forrest@0
|
114 |
; We want to convert these to "m/year" and "g C/m^2/year".
|
forrest@0
|
115 |
;
|
forrest@0
|
116 |
nsec_per_year = 60*60*24*365
|
forrest@0
|
117 |
|
forrest@0
|
118 |
rain81 = rain81 / 1000.
|
forrest@0
|
119 |
rainmod81 = (rainmod81/ 1000.) * nsec_per_year
|
forrest@0
|
120 |
nppmod81 = nppmod81 * nsec_per_year
|
forrest@0
|
121 |
|
forrest@0
|
122 |
rain933 = rain933 / 1000.
|
forrest@0
|
123 |
rainmod933 = (rainmod933/ 1000.) * nsec_per_year
|
forrest@0
|
124 |
nppmod933 = nppmod933 * nsec_per_year
|
forrest@0
|
125 |
|
forrest@0
|
126 |
nppmod = nppmod * nsec_per_year
|
forrest@0
|
127 |
|
forrest@0
|
128 |
npp81@units = "gC/m^2/yr"
|
forrest@0
|
129 |
nppmod81@units = "gC/m^2/yr"
|
forrest@0
|
130 |
npp933@units = "gC/m^2/yr"
|
forrest@0
|
131 |
nppmod933@units = "gC/m^2/yr"
|
forrest@0
|
132 |
nppmod@units = "gC/m^2/yr"
|
forrest@0
|
133 |
nppglobe@units = "gC/m^2/yr"
|
forrest@0
|
134 |
rain81@units = "m/yr"
|
forrest@0
|
135 |
rainmod81@units = "m/yr"
|
forrest@0
|
136 |
rain933@units = "m/yr"
|
forrest@0
|
137 |
rainmod933@units = "m/yr"
|
forrest@0
|
138 |
|
forrest@0
|
139 |
npp81@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
140 |
npp933@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
141 |
nppmod81@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
142 |
nppmod933@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
143 |
nppmod@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
144 |
nppglobe@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
145 |
rain81@long_name = "PREC (m/year)"
|
forrest@0
|
146 |
rain933@long_name = "PREC (m/year)"
|
forrest@0
|
147 |
rainmod81@long_name = "PREC (m/year)"
|
forrest@0
|
148 |
rainmod933@long_name = "PREC (m/year)"
|
forrest@0
|
149 |
|
forrest@0
|
150 |
;(A) plot scatter ob 81
|
forrest@0
|
151 |
|
forrest@0
|
152 |
plot_name = "scatter_ob_81"
|
forrest@0
|
153 |
title = "Observed 81 sites"
|
forrest@0
|
154 |
|
forrest@0
|
155 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
156 |
res = True ; plot mods desired
|
forrest@0
|
157 |
res@tiMainString = title ; add title
|
forrest@0
|
158 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
159 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
160 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
161 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
162 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
163 |
|
forrest@0
|
164 |
plot = gsn_csm_xy (wks,id81,npp81,res) ; create plot
|
forrest@0
|
165 |
frame(wks)
|
forrest@0
|
166 |
|
forrest@0
|
167 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
168 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
169 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
170 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
171 |
|
forrest@0
|
172 |
clear (wks)
|
forrest@0
|
173 |
|
forrest@0
|
174 |
;(B) plot scatter ob 933
|
forrest@0
|
175 |
|
forrest@0
|
176 |
plot_name = "scatter_ob_933"
|
forrest@0
|
177 |
title = "Observed 933 sites"
|
forrest@0
|
178 |
|
forrest@0
|
179 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
180 |
res = True ; plot mods desired
|
forrest@0
|
181 |
res@tiMainString = title ; add title
|
forrest@0
|
182 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
183 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
184 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
185 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
186 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
187 |
|
forrest@0
|
188 |
plot = gsn_csm_xy (wks,id933,npp933,res) ; create plot
|
forrest@0
|
189 |
frame(wks)
|
forrest@0
|
190 |
|
forrest@0
|
191 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
192 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
193 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
194 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
195 |
|
forrest@0
|
196 |
clear (wks)
|
forrest@0
|
197 |
|
forrest@0
|
198 |
;(C) plot scatter model 81
|
forrest@0
|
199 |
|
forrest@0
|
200 |
plot_name = "scatter_model_81"
|
forrest@0
|
201 |
title = "Model "+ model_name +" 81 sites"
|
forrest@0
|
202 |
|
forrest@0
|
203 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
204 |
res = True ; plot mods desired
|
forrest@0
|
205 |
res@tiMainString = title ; add title
|
forrest@0
|
206 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
207 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
208 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
209 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
210 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
211 |
|
forrest@0
|
212 |
plot = gsn_csm_xy (wks,id81,nppmod81,res) ; create plot
|
forrest@0
|
213 |
frame(wks)
|
forrest@0
|
214 |
|
forrest@0
|
215 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
216 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
217 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
218 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
219 |
|
forrest@0
|
220 |
clear (wks)
|
forrest@0
|
221 |
|
forrest@0
|
222 |
;(D) plot scatter model 933
|
forrest@0
|
223 |
|
forrest@0
|
224 |
plot_name = "scatter_model_933"
|
forrest@0
|
225 |
title = "Model "+ model_name +" 933 sites"
|
forrest@0
|
226 |
|
forrest@0
|
227 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
228 |
res = True ; plot mods desired
|
forrest@0
|
229 |
res@tiMainString = title ; add title
|
forrest@0
|
230 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
231 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
232 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
233 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
234 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
235 |
|
forrest@0
|
236 |
plot = gsn_csm_xy (wks,id933,nppmod933,res) ; create plot
|
forrest@0
|
237 |
frame(wks)
|
forrest@0
|
238 |
|
forrest@0
|
239 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
240 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
241 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
242 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
243 |
|
forrest@0
|
244 |
clear (wks)
|
forrest@0
|
245 |
|
forrest@0
|
246 |
;(E) scatter model vs ob 81
|
forrest@0
|
247 |
|
forrest@0
|
248 |
plot_name = "scatter_model_vs_ob_81"
|
forrest@0
|
249 |
title = model_name +" vs ob 81 sites"
|
forrest@0
|
250 |
|
forrest@0
|
251 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
252 |
res = True ; plot mods desired
|
forrest@0
|
253 |
res@tiMainString = title ; add title
|
forrest@0
|
254 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
255 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
256 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
257 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
258 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
259 |
;-------------------------------
|
forrest@0
|
260 |
;compute correlation coef. and M
|
forrest@0
|
261 |
ccr81 = esccr(nppmod81,npp81,0)
|
forrest@0
|
262 |
print (ccr81)
|
forrest@0
|
263 |
|
forrest@0
|
264 |
;new eq
|
forrest@0
|
265 |
bias = sum(abs(nppmod81-npp81)/(nppmod81+npp81))
|
forrest@0
|
266 |
M81 = (1. - (bias/dimsizes(y81)))*5.
|
forrest@0
|
267 |
print (M81)
|
forrest@0
|
268 |
|
forrest@0
|
269 |
tRes = True
|
forrest@0
|
270 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
271 |
|
forrest@0
|
272 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr81)+")"
|
forrest@0
|
273 |
|
forrest@0
|
274 |
gsn_text_ndc(wks,correlation_text,0.5,0.95,tRes)
|
forrest@0
|
275 |
;--------------------------------
|
forrest@0
|
276 |
plot = gsn_csm_xy (wks,npp81,nppmod81,res) ; create plot
|
forrest@0
|
277 |
frame(wks)
|
forrest@0
|
278 |
|
forrest@0
|
279 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
280 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
281 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
282 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
283 |
|
forrest@0
|
284 |
clear (wks)
|
forrest@0
|
285 |
|
forrest@0
|
286 |
;(F) scatter model vs ob 933
|
forrest@0
|
287 |
|
forrest@0
|
288 |
plot_name = "scatter_model_vs_ob_933"
|
forrest@0
|
289 |
title = model_name +" vs ob 933 sites"
|
forrest@0
|
290 |
|
forrest@0
|
291 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
292 |
res = True ; plot mods desired
|
forrest@0
|
293 |
res@tiMainString = title ; add title
|
forrest@0
|
294 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
295 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
296 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
297 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
298 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
299 |
;-------------------------------
|
forrest@0
|
300 |
;compute correlation coef. and M
|
forrest@0
|
301 |
ccr933 = esccr(nppmod933,npp933,0)
|
forrest@0
|
302 |
print (ccr933)
|
forrest@0
|
303 |
|
forrest@0
|
304 |
;new eq
|
forrest@0
|
305 |
bias = sum(abs(nppmod933-npp933)/(nppmod933+npp933))
|
forrest@0
|
306 |
M933 = (1. - (bias/dimsizes(y933)))*5.
|
forrest@0
|
307 |
print (M933)
|
forrest@0
|
308 |
|
forrest@0
|
309 |
tRes = True
|
forrest@0
|
310 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
311 |
|
forrest@0
|
312 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr933)+")"
|
forrest@0
|
313 |
|
forrest@0
|
314 |
gsn_text_ndc(wks,correlation_text,0.5,0.95,tRes)
|
forrest@0
|
315 |
;--------------------------------
|
forrest@0
|
316 |
plot = gsn_csm_xy (wks,npp933,nppmod933,res) ; create plot
|
forrest@0
|
317 |
frame(wks)
|
forrest@0
|
318 |
|
forrest@0
|
319 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
320 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
321 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
322 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
323 |
|
forrest@0
|
324 |
clear (wks)
|
forrest@0
|
325 |
;**************************************************************************
|
forrest@0
|
326 |
;(G) histogram 81
|
forrest@0
|
327 |
|
forrest@0
|
328 |
;--------------------------------------------------------------------
|
forrest@0
|
329 |
;get data
|
forrest@0
|
330 |
|
forrest@0
|
331 |
RAIN1_1D = ndtooned(rain81)
|
forrest@0
|
332 |
RAIN2_1D = ndtooned(rainmod81)
|
forrest@0
|
333 |
NPP1_1D = ndtooned(npp81)
|
forrest@0
|
334 |
NPP2_1D = ndtooned(nppmod81)
|
forrest@0
|
335 |
;
|
forrest@0
|
336 |
; Calculate some "nice" bins for binning the data in equally spaced
|
forrest@0
|
337 |
; ranges.
|
forrest@0
|
338 |
;
|
forrest@0
|
339 |
nbins = 15 ; Number of bins to use.
|
forrest@0
|
340 |
|
forrest@0
|
341 |
nicevals = nice_mnmxintvl(min(RAIN1_1D),max(RAIN1_1D),nbins,True)
|
forrest@0
|
342 |
nvals = floattoint((nicevals(1) - nicevals(0))/nicevals(2) + 1)
|
forrest@0
|
343 |
range = fspan(nicevals(0),nicevals(1),nvals)
|
forrest@0
|
344 |
;
|
forrest@0
|
345 |
; Use this range information to grab all the values in a
|
forrest@0
|
346 |
; particular range, and then take an average.
|
forrest@0
|
347 |
;
|
forrest@0
|
348 |
nr = dimsizes(range)
|
forrest@0
|
349 |
nx = nr-1
|
forrest@0
|
350 |
xvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
351 |
xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
|
forrest@0
|
352 |
dx = xvalues(0,1) - xvalues(0,0) ; range width
|
forrest@0
|
353 |
dx4 = dx/4 ; 1/4 of the range
|
forrest@0
|
354 |
xvalues(1,:) = xvalues(0,:) - dx/5.
|
forrest@0
|
355 |
yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
356 |
mn_yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
357 |
mx_yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
358 |
|
forrest@0
|
359 |
do nd=0,1
|
forrest@0
|
360 |
;
|
forrest@0
|
361 |
; See if we are doing model or observational data.
|
forrest@0
|
362 |
;
|
forrest@0
|
363 |
if(nd.eq.0) then
|
forrest@0
|
364 |
data = RAIN1_1D
|
forrest@0
|
365 |
npp_data = NPP1_1D
|
forrest@0
|
366 |
else
|
forrest@0
|
367 |
data = RAIN2_1D
|
forrest@0
|
368 |
npp_data = NPP2_1D
|
forrest@0
|
369 |
end if
|
forrest@0
|
370 |
;
|
forrest@0
|
371 |
; Loop through each range and check for values.
|
forrest@0
|
372 |
;
|
forrest@0
|
373 |
do i=0,nr-2
|
forrest@0
|
374 |
if (i.ne.(nr-2)) then
|
forrest@0
|
375 |
; print("")
|
forrest@0
|
376 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
377 |
idx = ind((range(i).le.data).and.(data.lt.range(i+1)))
|
forrest@0
|
378 |
else
|
forrest@0
|
379 |
; print("")
|
forrest@0
|
380 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
381 |
idx = ind(range(i).le.data)
|
forrest@0
|
382 |
end if
|
forrest@0
|
383 |
;
|
forrest@0
|
384 |
; Calculate average, and get min and max.
|
forrest@0
|
385 |
;
|
forrest@0
|
386 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
387 |
yvalues(nd,i) = avg(npp_data(idx))
|
forrest@0
|
388 |
mn_yvalues(nd,i) = min(npp_data(idx))
|
forrest@0
|
389 |
mx_yvalues(nd,i) = max(npp_data(idx))
|
forrest@0
|
390 |
count = dimsizes(idx)
|
forrest@0
|
391 |
else
|
forrest@0
|
392 |
count = 0
|
forrest@0
|
393 |
yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
394 |
mn_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
395 |
mx_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
396 |
end if
|
forrest@0
|
397 |
;
|
forrest@0
|
398 |
; Print out information.
|
forrest@0
|
399 |
;
|
forrest@0
|
400 |
; print(data_types(nd) + ": " + count + " points, avg = " + yvalues(nd,i))
|
forrest@0
|
401 |
; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
|
forrest@0
|
402 |
|
forrest@0
|
403 |
;
|
forrest@0
|
404 |
; Clean up for next time in loop.
|
forrest@0
|
405 |
;
|
forrest@0
|
406 |
delete(idx)
|
forrest@0
|
407 |
end do
|
forrest@0
|
408 |
delete(data)
|
forrest@0
|
409 |
delete(npp_data)
|
forrest@0
|
410 |
end do
|
forrest@0
|
411 |
;----------------------------------------
|
forrest@0
|
412 |
;compute correlation coeff and M score
|
forrest@0
|
413 |
u = yvalues(0,:)
|
forrest@0
|
414 |
v = yvalues(1,:)
|
forrest@0
|
415 |
|
forrest@0
|
416 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
417 |
uu = u(good)
|
forrest@0
|
418 |
vv = v(good)
|
forrest@0
|
419 |
|
forrest@0
|
420 |
ccr81h = esccr(uu,vv,0)
|
forrest@0
|
421 |
print (ccr81h)
|
forrest@0
|
422 |
|
forrest@0
|
423 |
;new eq
|
forrest@0
|
424 |
bias = sum(abs(vv-uu)/(vv+uu))
|
forrest@0
|
425 |
M81h = (1.- (bias/dimsizes(uu)))*5.
|
forrest@0
|
426 |
print (M81h)
|
forrest@0
|
427 |
|
forrest@0
|
428 |
delete (u)
|
forrest@0
|
429 |
delete (v)
|
forrest@0
|
430 |
delete (uu)
|
forrest@0
|
431 |
delete (vv)
|
forrest@0
|
432 |
;----------------------------------------------------------------------
|
forrest@0
|
433 |
; histogram res
|
forrest@0
|
434 |
|
forrest@0
|
435 |
res = True
|
forrest@0
|
436 |
res@gsnMaximize = True
|
forrest@0
|
437 |
res@gsnDraw = False
|
forrest@0
|
438 |
res@gsnFrame = False
|
forrest@0
|
439 |
res@xyMarkLineMode = "Markers"
|
forrest@0
|
440 |
res@xyMarkerSizeF = 0.014
|
forrest@0
|
441 |
res@xyMarker = 16
|
forrest@0
|
442 |
res@xyMarkerColors = (/"Brown","Blue"/)
|
forrest@0
|
443 |
res@trYMinF = min(mn_yvalues) - 10.
|
forrest@0
|
444 |
res@trYMaxF = max(mx_yvalues) + 10.
|
forrest@0
|
445 |
|
forrest@0
|
446 |
res@tiYAxisString = "NPP (g C/m2/year)"
|
forrest@0
|
447 |
res@tiXAxisString = "Precipitation (m/year)"
|
forrest@0
|
448 |
|
forrest@0
|
449 |
max_bar = new((/2,nx/),graphic)
|
forrest@0
|
450 |
min_bar = new((/2,nx/),graphic)
|
forrest@0
|
451 |
max_cap = new((/2,nx/),graphic)
|
forrest@0
|
452 |
min_cap = new((/2,nx/),graphic)
|
forrest@0
|
453 |
|
forrest@0
|
454 |
lnres = True
|
forrest@0
|
455 |
line_colors = (/"brown","blue"/)
|
forrest@0
|
456 |
;=================================================================
|
forrest@0
|
457 |
; histogram ob 81 site only
|
forrest@0
|
458 |
;
|
forrest@0
|
459 |
plot_name = "histogram_ob_81"
|
forrest@0
|
460 |
title = "Observed 81 site"
|
forrest@0
|
461 |
res@tiMainString = title
|
forrest@0
|
462 |
|
forrest@0
|
463 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
464 |
|
forrest@0
|
465 |
xy = gsn_csm_xy(wks,xvalues(0,:),yvalues(0,:),res)
|
forrest@0
|
466 |
|
forrest@0
|
467 |
;-------------------------------
|
forrest@0
|
468 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
469 |
|
forrest@0
|
470 |
do nd=0,0
|
forrest@0
|
471 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
472 |
do i=0,nx-1
|
forrest@0
|
473 |
|
forrest@0
|
474 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
475 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
476 |
;
|
forrest@0
|
477 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
478 |
;
|
forrest@0
|
479 |
x1 = xvalues(nd,i)
|
forrest@0
|
480 |
y1 = yvalues(nd,i)
|
forrest@0
|
481 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
482 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
483 |
|
forrest@0
|
484 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
485 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
486 |
;
|
forrest@0
|
487 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
488 |
;
|
forrest@0
|
489 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
490 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
491 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
492 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
493 |
|
forrest@0
|
494 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
495 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
496 |
end if
|
forrest@0
|
497 |
end do
|
forrest@0
|
498 |
end do
|
forrest@0
|
499 |
|
forrest@0
|
500 |
draw(xy)
|
forrest@0
|
501 |
frame(wks)
|
forrest@0
|
502 |
|
forrest@0
|
503 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
504 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
505 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
506 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
507 |
|
forrest@0
|
508 |
clear (wks)
|
forrest@0
|
509 |
;===========================================================================
|
forrest@0
|
510 |
; histogram model vs ob 81 site
|
forrest@0
|
511 |
|
forrest@0
|
512 |
plot_name = "histogram_mod-ob_81"
|
forrest@0
|
513 |
title = model_name+ " vs Observed 81 site"
|
forrest@0
|
514 |
res@tiMainString = title
|
forrest@0
|
515 |
|
forrest@0
|
516 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
517 |
|
forrest@0
|
518 |
;-----------------------------
|
forrest@0
|
519 |
; Add a boxed legend using the more simple method, which won't have
|
forrest@0
|
520 |
; vertical lines going through the markers.
|
forrest@0
|
521 |
|
forrest@0
|
522 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
523 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
524 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
525 |
res@pmLegendHeightF = 0.05
|
forrest@0
|
526 |
res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
527 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
528 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
529 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
530 |
|
forrest@0
|
531 |
; res@lgPerimOn = False
|
forrest@0
|
532 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
533 |
res@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
534 |
;-----------------------------
|
forrest@0
|
535 |
tRes = True
|
forrest@0
|
536 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
537 |
|
forrest@0
|
538 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr81h)+")"
|
forrest@0
|
539 |
|
forrest@0
|
540 |
gsn_text_ndc(wks,correlation_text,0.5,0.8,tRes)
|
forrest@0
|
541 |
|
forrest@0
|
542 |
xy = gsn_csm_xy(wks,xvalues,yvalues,res)
|
forrest@0
|
543 |
;-------------------------------
|
forrest@0
|
544 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
545 |
|
forrest@0
|
546 |
do nd=0,1
|
forrest@0
|
547 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
548 |
do i=0,nx-1
|
forrest@0
|
549 |
|
forrest@0
|
550 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
551 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
552 |
;
|
forrest@0
|
553 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
554 |
;
|
forrest@0
|
555 |
x1 = xvalues(nd,i)
|
forrest@0
|
556 |
y1 = yvalues(nd,i)
|
forrest@0
|
557 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
558 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
559 |
|
forrest@0
|
560 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
561 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
562 |
;
|
forrest@0
|
563 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
564 |
;
|
forrest@0
|
565 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
566 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
567 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
568 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
569 |
|
forrest@0
|
570 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
571 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
572 |
end if
|
forrest@0
|
573 |
end do
|
forrest@0
|
574 |
end do
|
forrest@0
|
575 |
draw(xy)
|
forrest@0
|
576 |
frame(wks)
|
forrest@0
|
577 |
|
forrest@0
|
578 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
579 |
;system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
580 |
;system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
581 |
;system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
582 |
|
forrest@0
|
583 |
clear (wks)
|
forrest@0
|
584 |
|
forrest@0
|
585 |
delete (RAIN1_1D)
|
forrest@0
|
586 |
delete (RAIN2_1D)
|
forrest@0
|
587 |
delete (NPP1_1D)
|
forrest@0
|
588 |
delete (NPP2_1D)
|
forrest@0
|
589 |
delete (range)
|
forrest@0
|
590 |
delete (xvalues)
|
forrest@0
|
591 |
delete (yvalues)
|
forrest@0
|
592 |
delete (mn_yvalues)
|
forrest@0
|
593 |
delete (mx_yvalues)
|
forrest@0
|
594 |
delete (good)
|
forrest@0
|
595 |
delete (max_bar)
|
forrest@0
|
596 |
delete (min_bar)
|
forrest@0
|
597 |
delete (max_cap)
|
forrest@0
|
598 |
delete (min_cap)
|
forrest@0
|
599 |
;**************************************************************************
|
forrest@0
|
600 |
;(H) histogram 933
|
forrest@0
|
601 |
|
forrest@0
|
602 |
;--------------------------------------------------------------------
|
forrest@0
|
603 |
;get data
|
forrest@0
|
604 |
|
forrest@0
|
605 |
RAIN1_1D = ndtooned(rain933)
|
forrest@0
|
606 |
RAIN2_1D = ndtooned(rainmod933)
|
forrest@0
|
607 |
NPP1_1D = ndtooned(npp933)
|
forrest@0
|
608 |
NPP2_1D = ndtooned(nppmod933)
|
forrest@0
|
609 |
;
|
forrest@0
|
610 |
; Calculate some "nice" bins for binning the data in equally spaced
|
forrest@0
|
611 |
; ranges.
|
forrest@0
|
612 |
;
|
forrest@0
|
613 |
nbins = 15 ; Number of bins to use.
|
forrest@0
|
614 |
|
forrest@0
|
615 |
nicevals = nice_mnmxintvl(min(RAIN1_1D),max(RAIN1_1D),nbins,True)
|
forrest@0
|
616 |
nvals = floattoint((nicevals(1) - nicevals(0))/nicevals(2) + 1)
|
forrest@0
|
617 |
range = fspan(nicevals(0),nicevals(1),nvals)
|
forrest@0
|
618 |
;
|
forrest@0
|
619 |
; Use this range information to grab all the values in a
|
forrest@0
|
620 |
; particular range, and then take an average.
|
forrest@0
|
621 |
;
|
forrest@0
|
622 |
nr = dimsizes(range)
|
forrest@0
|
623 |
nx = nr-1
|
forrest@0
|
624 |
xvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
625 |
xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
|
forrest@0
|
626 |
dx = xvalues(0,1) - xvalues(0,0) ; range width
|
forrest@0
|
627 |
dx4 = dx/4 ; 1/4 of the range
|
forrest@0
|
628 |
xvalues(1,:) = xvalues(0,:) - dx/5.
|
forrest@0
|
629 |
yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
630 |
mn_yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
631 |
mx_yvalues = new((/2,nx/),typeof(RAIN1_1D))
|
forrest@0
|
632 |
|
forrest@0
|
633 |
do nd=0,1
|
forrest@0
|
634 |
;
|
forrest@0
|
635 |
; See if we are doing model or observational data.
|
forrest@0
|
636 |
;
|
forrest@0
|
637 |
if(nd.eq.0) then
|
forrest@0
|
638 |
data = RAIN1_1D
|
forrest@0
|
639 |
npp_data = NPP1_1D
|
forrest@0
|
640 |
else
|
forrest@0
|
641 |
data = RAIN2_1D
|
forrest@0
|
642 |
npp_data = NPP2_1D
|
forrest@0
|
643 |
end if
|
forrest@0
|
644 |
;
|
forrest@0
|
645 |
; Loop through each range and check for values.
|
forrest@0
|
646 |
;
|
forrest@0
|
647 |
do i=0,nr-2
|
forrest@0
|
648 |
if (i.ne.(nr-2)) then
|
forrest@0
|
649 |
; print("")
|
forrest@0
|
650 |
; print("In range ["+range(i)+","+range(i+1)+")")
|
forrest@0
|
651 |
idx = ind((range(i).le.data).and.(data.lt.range(i+1)))
|
forrest@0
|
652 |
else
|
forrest@0
|
653 |
; print("")
|
forrest@0
|
654 |
; print("In range ["+range(i)+",)")
|
forrest@0
|
655 |
idx = ind(range(i).le.data)
|
forrest@0
|
656 |
end if
|
forrest@0
|
657 |
;
|
forrest@0
|
658 |
; Calculate average, and get min and max.
|
forrest@0
|
659 |
;
|
forrest@0
|
660 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
661 |
yvalues(nd,i) = avg(npp_data(idx))
|
forrest@0
|
662 |
mn_yvalues(nd,i) = min(npp_data(idx))
|
forrest@0
|
663 |
mx_yvalues(nd,i) = max(npp_data(idx))
|
forrest@0
|
664 |
count = dimsizes(idx)
|
forrest@0
|
665 |
else
|
forrest@0
|
666 |
count = 0
|
forrest@0
|
667 |
yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
668 |
mn_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
669 |
mx_yvalues(nd,i) = yvalues@_FillValue
|
forrest@0
|
670 |
end if
|
forrest@0
|
671 |
;
|
forrest@0
|
672 |
; Print out information.
|
forrest@0
|
673 |
;
|
forrest@0
|
674 |
; print(data_types(nd) + ": " + count + " points, avg = " + yvalues(nd,i))
|
forrest@0
|
675 |
; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
|
forrest@0
|
676 |
|
forrest@0
|
677 |
;
|
forrest@0
|
678 |
; Clean up for next time in loop.
|
forrest@0
|
679 |
;
|
forrest@0
|
680 |
delete(idx)
|
forrest@0
|
681 |
end do
|
forrest@0
|
682 |
delete(data)
|
forrest@0
|
683 |
delete(npp_data)
|
forrest@0
|
684 |
end do
|
forrest@0
|
685 |
;----------------------------------------
|
forrest@0
|
686 |
;compute correlation coeff and M score
|
forrest@0
|
687 |
u = yvalues(0,:)
|
forrest@0
|
688 |
v = yvalues(1,:)
|
forrest@0
|
689 |
|
forrest@0
|
690 |
good = ind(.not.ismissing(u) .and. .not.ismissing(v))
|
forrest@0
|
691 |
uu = u(good)
|
forrest@0
|
692 |
vv = v(good)
|
forrest@0
|
693 |
|
forrest@0
|
694 |
ccr933h = esccr(uu,vv,0)
|
forrest@0
|
695 |
print (ccr933h)
|
forrest@0
|
696 |
|
forrest@0
|
697 |
;new eq
|
forrest@0
|
698 |
bias = sum(abs(vv-uu)/(vv+uu))
|
forrest@0
|
699 |
M933h = (1.- (bias/dimsizes(uu)))*5.
|
forrest@0
|
700 |
print (M933h)
|
forrest@0
|
701 |
|
forrest@0
|
702 |
delete (u)
|
forrest@0
|
703 |
delete (v)
|
forrest@0
|
704 |
delete (uu)
|
forrest@0
|
705 |
delete (vv)
|
forrest@0
|
706 |
;----------------------------------------------------------------------
|
forrest@0
|
707 |
; histogram res
|
forrest@0
|
708 |
|
forrest@0
|
709 |
res = True
|
forrest@0
|
710 |
res@gsnMaximize = True
|
forrest@0
|
711 |
res@gsnDraw = False
|
forrest@0
|
712 |
res@gsnFrame = False
|
forrest@0
|
713 |
res@xyMarkLineMode = "Markers"
|
forrest@0
|
714 |
res@xyMarkerSizeF = 0.014
|
forrest@0
|
715 |
res@xyMarker = 16
|
forrest@0
|
716 |
res@xyMarkerColors = (/"Brown","Blue"/)
|
forrest@0
|
717 |
res@trYMinF = min(mn_yvalues) - 10.
|
forrest@0
|
718 |
res@trYMaxF = max(mx_yvalues) + 10.
|
forrest@0
|
719 |
|
forrest@0
|
720 |
res@tiYAxisString = "NPP (g C/m2/year)"
|
forrest@0
|
721 |
res@tiXAxisString = "Precipitation (m/year)"
|
forrest@0
|
722 |
|
forrest@0
|
723 |
max_bar = new((/2,nx/),graphic)
|
forrest@0
|
724 |
min_bar = new((/2,nx/),graphic)
|
forrest@0
|
725 |
max_cap = new((/2,nx/),graphic)
|
forrest@0
|
726 |
min_cap = new((/2,nx/),graphic)
|
forrest@0
|
727 |
|
forrest@0
|
728 |
lnres = True
|
forrest@0
|
729 |
line_colors = (/"brown","blue"/)
|
forrest@0
|
730 |
;=================================================================
|
forrest@0
|
731 |
; histogram ob 933 site only
|
forrest@0
|
732 |
;
|
forrest@0
|
733 |
plot_name = "histogram_ob_933"
|
forrest@0
|
734 |
title = "Observed 933 site"
|
forrest@0
|
735 |
res@tiMainString = title
|
forrest@0
|
736 |
|
forrest@0
|
737 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
738 |
|
forrest@0
|
739 |
xy = gsn_csm_xy(wks,xvalues(0,:),yvalues(0,:),res)
|
forrest@0
|
740 |
|
forrest@0
|
741 |
;-------------------------------
|
forrest@0
|
742 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
743 |
|
forrest@0
|
744 |
do nd=0,0
|
forrest@0
|
745 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
746 |
do i=0,nx-1
|
forrest@0
|
747 |
|
forrest@0
|
748 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
749 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
750 |
;
|
forrest@0
|
751 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
752 |
;
|
forrest@0
|
753 |
x1 = xvalues(nd,i)
|
forrest@0
|
754 |
y1 = yvalues(nd,i)
|
forrest@0
|
755 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
756 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
757 |
|
forrest@0
|
758 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
759 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
760 |
;
|
forrest@0
|
761 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
762 |
;
|
forrest@0
|
763 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
764 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
765 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
766 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
767 |
|
forrest@0
|
768 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
769 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
770 |
end if
|
forrest@0
|
771 |
end do
|
forrest@0
|
772 |
end do
|
forrest@0
|
773 |
|
forrest@0
|
774 |
draw(xy)
|
forrest@0
|
775 |
frame(wks)
|
forrest@0
|
776 |
|
forrest@0
|
777 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
778 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
779 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
780 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
781 |
|
forrest@0
|
782 |
clear (wks)
|
forrest@0
|
783 |
;===========================================================================
|
forrest@0
|
784 |
; histogram model vs ob 933 site
|
forrest@0
|
785 |
|
forrest@0
|
786 |
plot_name = "histogram_mod-ob_933"
|
forrest@0
|
787 |
title = model_name+ " vs Observed 933 site"
|
forrest@0
|
788 |
res@tiMainString = title
|
forrest@0
|
789 |
|
forrest@0
|
790 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
791 |
|
forrest@0
|
792 |
;-----------------------------
|
forrest@0
|
793 |
; Add a boxed legend using the more simple method, which won't have
|
forrest@0
|
794 |
; vertical lines going through the markers.
|
forrest@0
|
795 |
|
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.05
|
forrest@0
|
800 |
res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
801 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
802 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
803 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
804 |
|
forrest@0
|
805 |
; res@lgPerimOn = False
|
forrest@0
|
806 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
807 |
res@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
808 |
;-----------------------------
|
forrest@0
|
809 |
tRes = True
|
forrest@0
|
810 |
tRes@txFontHeightF = 0.025
|
forrest@0
|
811 |
|
forrest@0
|
812 |
correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr933h)+")"
|
forrest@0
|
813 |
|
forrest@0
|
814 |
gsn_text_ndc(wks,correlation_text,0.5,0.8,tRes)
|
forrest@0
|
815 |
|
forrest@0
|
816 |
xy = gsn_csm_xy(wks,xvalues,yvalues,res)
|
forrest@0
|
817 |
;-------------------------------
|
forrest@0
|
818 |
;Attach the vertical bar and the horizontal cap line
|
forrest@0
|
819 |
|
forrest@0
|
820 |
do nd=0,1
|
forrest@0
|
821 |
lnres@gsLineColor = line_colors(nd)
|
forrest@0
|
822 |
do i=0,nx-1
|
forrest@0
|
823 |
|
forrest@0
|
824 |
if(.not.ismissing(mn_yvalues(nd,i)).and. \
|
forrest@0
|
825 |
.not.ismissing(mx_yvalues(nd,i))) then
|
forrest@0
|
826 |
;
|
forrest@0
|
827 |
; Attach the vertical bar, both above and below the marker.
|
forrest@0
|
828 |
;
|
forrest@0
|
829 |
x1 = xvalues(nd,i)
|
forrest@0
|
830 |
y1 = yvalues(nd,i)
|
forrest@0
|
831 |
y2 = mn_yvalues(nd,i)
|
forrest@0
|
832 |
min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
833 |
|
forrest@0
|
834 |
y2 = mx_yvalues(nd,i)
|
forrest@0
|
835 |
max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
|
forrest@0
|
836 |
;
|
forrest@0
|
837 |
; Attach the horizontal cap line, both above and below the marker.
|
forrest@0
|
838 |
;
|
forrest@0
|
839 |
x1 = xvalues(nd,i) - dx4
|
forrest@0
|
840 |
x2 = xvalues(nd,i) + dx4
|
forrest@0
|
841 |
y1 = mn_yvalues(nd,i)
|
forrest@0
|
842 |
min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
843 |
|
forrest@0
|
844 |
y1 = mx_yvalues(nd,i)
|
forrest@0
|
845 |
max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
|
forrest@0
|
846 |
end if
|
forrest@0
|
847 |
end do
|
forrest@0
|
848 |
end do
|
forrest@0
|
849 |
draw(xy)
|
forrest@0
|
850 |
frame(wks)
|
forrest@0
|
851 |
|
forrest@0
|
852 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
853 |
; system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
854 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
855 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
856 |
|
forrest@0
|
857 |
clear (wks)
|
forrest@0
|
858 |
;------------------------------------------------------------------------
|
forrest@0
|
859 |
;global contour
|
forrest@0
|
860 |
|
forrest@0
|
861 |
;res
|
forrest@0
|
862 |
resw = True ; Use plot options
|
forrest@0
|
863 |
resw@cnFillOn = True ; Turn on color fill
|
forrest@0
|
864 |
resw@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
865 |
; resw@cnFillMode = "RasterFill" ; Turn on raster color
|
forrest@0
|
866 |
; resw@lbLabelAutoStride = True
|
forrest@0
|
867 |
resw@cnLinesOn = False ; Turn off contourn lines
|
forrest@0
|
868 |
resw@mpFillOn = False ; Turn off map fill
|
forrest@0
|
869 |
|
forrest@0
|
870 |
resw@gsnSpreadColors = True ; use full colormap
|
forrest@0
|
871 |
resw@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
|
forrest@0
|
872 |
resw@cnMinLevelValF = 0. ; Min level
|
forrest@0
|
873 |
resw@cnMaxLevelValF = 2200. ; Max level
|
forrest@0
|
874 |
resw@cnLevelSpacingF = 200. ; interval
|
forrest@0
|
875 |
;------------------------------------------------------------------------
|
forrest@0
|
876 |
;global contour ob
|
forrest@0
|
877 |
|
forrest@0
|
878 |
delta = 0.00000000001
|
forrest@0
|
879 |
nppglobe = where(ismissing(nppglobe).and.(ismissing(nppmod).or.(nppmod.lt.delta)),0.,nppglobe)
|
forrest@0
|
880 |
|
forrest@0
|
881 |
plot_name = "global_ob"
|
forrest@0
|
882 |
title = "Observed MODIS MOD 17"
|
forrest@0
|
883 |
resw@tiMainString = title
|
forrest@0
|
884 |
|
forrest@0
|
885 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
886 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
887 |
|
forrest@0
|
888 |
|
forrest@0
|
889 |
plot = gsn_csm_contour_map_ce(wks,nppglobe,resw)
|
forrest@0
|
890 |
frame(wks)
|
forrest@0
|
891 |
|
forrest@0
|
892 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
893 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
894 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
895 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
896 |
|
forrest@0
|
897 |
clear (wks)
|
forrest@0
|
898 |
;------------------------------------------------------------------------
|
forrest@0
|
899 |
;global contour model
|
forrest@0
|
900 |
|
forrest@0
|
901 |
plot_name = "global_model"
|
forrest@0
|
902 |
title = "Model "+ model_name
|
forrest@0
|
903 |
resw@tiMainString = title
|
forrest@0
|
904 |
|
forrest@0
|
905 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
906 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
907 |
|
forrest@0
|
908 |
plot = gsn_csm_contour_map_ce(wks,nppmod,resw)
|
forrest@0
|
909 |
frame(wks)
|
forrest@0
|
910 |
|
forrest@0
|
911 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
912 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
913 |
system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
914 |
system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
915 |
|
forrest@0
|
916 |
clear (wks)
|
forrest@0
|
917 |
;------------------------------------------------------------------------
|
forrest@0
|
918 |
;global contour model vs ob
|
forrest@0
|
919 |
|
forrest@0
|
920 |
plot_name = "global_model_vs_ob"
|
forrest@0
|
921 |
|
forrest@0
|
922 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
923 |
gsn_define_colormap(wks,"gui_default") ; choose colormap
|
forrest@0
|
924 |
|
forrest@0
|
925 |
delete (plot)
|
forrest@0
|
926 |
plot=new(3,graphic) ; create graphic array
|
forrest@0
|
927 |
|
forrest@0
|
928 |
resw@gsnFrame = False ; Do not draw plot
|
forrest@0
|
929 |
resw@gsnDraw = False ; Do not advance frame
|
forrest@0
|
930 |
|
forrest@0
|
931 |
;(a) ob
|
forrest@0
|
932 |
|
forrest@0
|
933 |
title = "Observed MODIS MOD 17"
|
forrest@0
|
934 |
resw@tiMainString = title
|
forrest@0
|
935 |
|
forrest@0
|
936 |
plot(0) = gsn_csm_contour_map_ce(wks,nppglobe,resw) ; for observed
|
forrest@0
|
937 |
|
forrest@0
|
938 |
;(b) model
|
forrest@0
|
939 |
|
forrest@0
|
940 |
title = "Model "+ model_name
|
forrest@0
|
941 |
resw@tiMainString = title
|
forrest@0
|
942 |
|
forrest@0
|
943 |
plot(1) = gsn_csm_contour_map_ce(wks,nppmod,resw) ; for model
|
forrest@0
|
944 |
|
forrest@0
|
945 |
;(c) model-ob
|
forrest@0
|
946 |
|
forrest@0
|
947 |
zz = nppmod
|
forrest@0
|
948 |
zz = nppmod - nppglobe
|
forrest@0
|
949 |
title = "Model_"+model_name+" - Observed"
|
forrest@0
|
950 |
|
forrest@0
|
951 |
resw@cnMinLevelValF = -500 ; Min level
|
forrest@0
|
952 |
resw@cnMaxLevelValF = 500. ; Max level
|
forrest@0
|
953 |
resw@cnLevelSpacingF = 50. ; interval
|
forrest@0
|
954 |
resw@tiMainString = title
|
forrest@0
|
955 |
|
forrest@0
|
956 |
plot(2) = gsn_csm_contour_map_ce(wks,zz,resw)
|
forrest@0
|
957 |
|
forrest@0
|
958 |
pres = True ; panel plot mods desired
|
forrest@0
|
959 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
960 |
; indiv. plots in panel
|
forrest@0
|
961 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
962 |
|
forrest@0
|
963 |
gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
|
forrest@0
|
964 |
|
forrest@0
|
965 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
966 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
967 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
968 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
969 |
|
forrest@0
|
970 |
frame (wks)
|
forrest@0
|
971 |
clear (wks)
|
forrest@0
|
972 |
end
|