forrest@0
|
1 |
;************************************************************
|
forrest@0
|
2 |
; add table
|
forrest@0
|
3 |
; add time series plot
|
forrest@0
|
4 |
; sort by latitude in decending order (N->S)
|
forrest@0
|
5 |
; find year_ob >= 4
|
forrest@0
|
6 |
; add year_ob_i and year_ob_f
|
forrest@0
|
7 |
; change long_name
|
forrest@0
|
8 |
;************************************************************
|
forrest@0
|
9 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
10 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
11 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
12 |
;************************************************************
|
forrest@0
|
13 |
procedure set_line(lines:string,nline:integer,newlines:string)
|
forrest@0
|
14 |
begin
|
forrest@0
|
15 |
; add line to ascci/html file
|
forrest@0
|
16 |
|
forrest@0
|
17 |
nnewlines = dimsizes(newlines)
|
forrest@0
|
18 |
if(nline+nnewlines-1.ge.dimsizes(lines))
|
forrest@0
|
19 |
print("set_line: bad index, not setting anything.")
|
forrest@0
|
20 |
return
|
forrest@0
|
21 |
end if
|
forrest@0
|
22 |
lines(nline:nline+nnewlines-1) = newlines
|
forrest@0
|
23 |
; print ("lines = " + lines(nline:nline+nnewlines-1))
|
forrest@0
|
24 |
nline = nline + nnewlines
|
forrest@0
|
25 |
return
|
forrest@0
|
26 |
end
|
forrest@0
|
27 |
;*************************************************************
|
forrest@0
|
28 |
begin
|
forrest@0
|
29 |
|
forrest@0
|
30 |
plot_type = "ps"
|
forrest@0
|
31 |
plot_type_new = "png"
|
forrest@0
|
32 |
|
forrest@0
|
33 |
;************************************************
|
forrest@0
|
34 |
; model data info
|
forrest@0
|
35 |
;************************************************
|
forrest@0
|
36 |
model = "cn"
|
forrest@0
|
37 |
; model = "casa"
|
forrest@0
|
38 |
|
forrest@0
|
39 |
model_name = "i01.10" + model
|
forrest@0
|
40 |
|
forrest@0
|
41 |
ENERGY ="new"
|
forrest@0
|
42 |
|
forrest@0
|
43 |
;************************************************
|
forrest@0
|
44 |
; observed data info
|
forrest@0
|
45 |
;************************************************
|
forrest@0
|
46 |
|
forrest@0
|
47 |
station = (/"ARM_Oklahoma" \
|
forrest@0
|
48 |
,"ARM_Oklahoma_burn" \
|
forrest@0
|
49 |
,"ARM_Oklahoma_control" \
|
forrest@0
|
50 |
,"Atqasuk" \
|
forrest@0
|
51 |
,"Audubon" \
|
forrest@0
|
52 |
,"AustinCary" \
|
forrest@0
|
53 |
,"Bartlett" \
|
forrest@0
|
54 |
,"Bondville" \
|
forrest@0
|
55 |
,"Brookings" \
|
forrest@0
|
56 |
,"Donaldson" \
|
forrest@0
|
57 |
,"Duke_Forest_Hardwoods" \
|
forrest@0
|
58 |
,"Duke_Forest_Open_Field" \
|
forrest@0
|
59 |
,"Duke_Forest_Pine" \
|
forrest@0
|
60 |
,"Fermi_Ag" \
|
forrest@0
|
61 |
,"Fermi_Prairie" \
|
forrest@0
|
62 |
,"Flagstaff_Managed" \
|
forrest@0
|
63 |
,"Flagstaff_Unmanaged" \
|
forrest@0
|
64 |
,"Flagstaff_Wildfire" \
|
forrest@0
|
65 |
,"FortPeck" \
|
forrest@0
|
66 |
,"FreemanRanch_mesquite" \
|
forrest@0
|
67 |
,"Goodwin_Creek" \
|
forrest@0
|
68 |
,"HarvardForest" \
|
forrest@0
|
69 |
,"HarvardForestHemlock" \
|
forrest@0
|
70 |
,"HowlandForestMain" \
|
forrest@0
|
71 |
,"HowlandForestWest" \
|
forrest@0
|
72 |
,"Ivotuk" \
|
forrest@0
|
73 |
,"KendallGrasslands" \
|
forrest@0
|
74 |
,"KennedySpaceCenterPine" \
|
forrest@0
|
75 |
,"KennedySpaceCenterScrub" \
|
forrest@0
|
76 |
,"LittleProspect" \
|
forrest@0
|
77 |
,"LostCreek" \
|
forrest@0
|
78 |
,"Mead-irrigated" \
|
forrest@0
|
79 |
,"Mead-irrigated-rotation" \
|
forrest@0
|
80 |
,"Mead-rainfed" \
|
forrest@0
|
81 |
,"Metolius_2nd_YoungPonderosaPine" \
|
forrest@0
|
82 |
,"MetoliusEyerly" \
|
forrest@0
|
83 |
,"MetoliusIntermediatePine" \
|
forrest@0
|
84 |
,"MetoliusOldPonderosaPine" \
|
forrest@0
|
85 |
,"MissouriOzark" \
|
forrest@0
|
86 |
,"Mize" \
|
forrest@0
|
87 |
,"MorganMonroe" \
|
forrest@0
|
88 |
,"NiwotRidge" \
|
forrest@0
|
89 |
,"NorthCarolina_cc" \
|
forrest@0
|
90 |
,"NorthCarolina_lp" \
|
forrest@0
|
91 |
,"ParkFalls" \
|
forrest@0
|
92 |
,"Rayonier" \
|
forrest@0
|
93 |
,"SantaRita" \
|
forrest@0
|
94 |
,"SkyOaks_Old" \
|
forrest@0
|
95 |
,"SkyOaks_PostFire" \
|
forrest@0
|
96 |
,"SkyOaks_Young" \
|
forrest@0
|
97 |
,"SylvaniaWilderness" \
|
forrest@0
|
98 |
,"Toledo" \
|
forrest@0
|
99 |
,"Tonzi" \
|
forrest@0
|
100 |
,"UCI_1850" \
|
forrest@0
|
101 |
,"UCI_1930" \
|
forrest@0
|
102 |
,"UCI_1964" \
|
forrest@0
|
103 |
,"UCI_1964wet" \
|
forrest@0
|
104 |
,"UCI_1981" \
|
forrest@0
|
105 |
,"UCI_1989" \
|
forrest@0
|
106 |
,"UCI_1998" \
|
forrest@0
|
107 |
,"UMBS" \
|
forrest@0
|
108 |
,"Vaira" \
|
forrest@0
|
109 |
,"WalkerBranch" \
|
forrest@0
|
110 |
,"WillowCreek" \
|
forrest@0
|
111 |
,"WindRiver" \
|
forrest@0
|
112 |
,"Wisconsin_ihw" \
|
forrest@0
|
113 |
,"Wisconsin_irp" \
|
forrest@0
|
114 |
,"Wisconsin_mrp" \
|
forrest@0
|
115 |
,"Wisconsin_myjp" \
|
forrest@0
|
116 |
,"Wisconsin_pb" \
|
forrest@0
|
117 |
,"Wisconsin_rpcc" \
|
forrest@0
|
118 |
,"Wisconsin_yhw" \
|
forrest@0
|
119 |
,"Wisconsin_yjp" \
|
forrest@0
|
120 |
,"Wisconsin_yrp" \
|
forrest@0
|
121 |
/)
|
forrest@0
|
122 |
|
forrest@0
|
123 |
year_ob = (/"2003-2006" \
|
forrest@0
|
124 |
,"2005-2006" \
|
forrest@0
|
125 |
,"2005-2006" \
|
forrest@0
|
126 |
,"1999-2006" \
|
forrest@0
|
127 |
,"2002-2006" \
|
forrest@0
|
128 |
,"2000-2005" \
|
forrest@0
|
129 |
,"2004-2005" \
|
forrest@0
|
130 |
,"1996-2006" \
|
forrest@0
|
131 |
,"2004-2006" \
|
forrest@0
|
132 |
,"1999-2004" \
|
forrest@0
|
133 |
,"2003-2005" \
|
forrest@0
|
134 |
,"2001-2005" \
|
forrest@0
|
135 |
,"2001-2005" \
|
forrest@0
|
136 |
,"2005-2006" \
|
forrest@0
|
137 |
,"2004-2006" \
|
forrest@0
|
138 |
,"2005-2006" \
|
forrest@0
|
139 |
,"2005-2006" \
|
forrest@0
|
140 |
,"2005-2006" \
|
forrest@0
|
141 |
,"2000-2006" \
|
forrest@0
|
142 |
,"2004-2006" \
|
forrest@0
|
143 |
,"2002-2006" \
|
forrest@0
|
144 |
,"1991-2004" \
|
forrest@0
|
145 |
,"2004-2004" \
|
forrest@0
|
146 |
,"1996-2004" \
|
forrest@0
|
147 |
,"1999-2004" \
|
forrest@0
|
148 |
,"2003-2006" \
|
forrest@0
|
149 |
,"2004-2006" \
|
forrest@0
|
150 |
,"2002-2002" \
|
forrest@0
|
151 |
,"2000-2006" \
|
forrest@0
|
152 |
,"2002-2005" \
|
forrest@0
|
153 |
,"2001-2005" \
|
forrest@0
|
154 |
,"2001-2005" \
|
forrest@0
|
155 |
,"2001-2005" \
|
forrest@0
|
156 |
,"2001-2005" \
|
forrest@0
|
157 |
,"2004-2005" \
|
forrest@0
|
158 |
,"2004-2005" \
|
forrest@0
|
159 |
,"2003-2005" \
|
forrest@0
|
160 |
,"1996-2000" \
|
forrest@0
|
161 |
,"2004-2006" \
|
forrest@0
|
162 |
,"1998-2004" \
|
forrest@0
|
163 |
,"1999-2005" \
|
forrest@0
|
164 |
,"1999-2003" \
|
forrest@0
|
165 |
,"2005-2006" \
|
forrest@0
|
166 |
,"2005-2006" \
|
forrest@0
|
167 |
,"1996-2003" \
|
forrest@0
|
168 |
,"1998-1998" \
|
forrest@0
|
169 |
,"2004-2006" \
|
forrest@0
|
170 |
,"1997-2006" \
|
forrest@0
|
171 |
,"2004-2006" \
|
forrest@0
|
172 |
,"1997-2006" \
|
forrest@0
|
173 |
,"2002-2006" \
|
forrest@0
|
174 |
,"2004-2005" \
|
forrest@0
|
175 |
,"2001-2006" \
|
forrest@0
|
176 |
,"2004-2005" \
|
forrest@0
|
177 |
,"2001-2005" \
|
forrest@0
|
178 |
,"2001-2005" \
|
forrest@0
|
179 |
,"2002-2004" \
|
forrest@0
|
180 |
,"2001-2005" \
|
forrest@0
|
181 |
,"2001-2005" \
|
forrest@0
|
182 |
,"2002-2005" \
|
forrest@0
|
183 |
,"1999-2003" \
|
forrest@0
|
184 |
,"2001-2006" \
|
forrest@0
|
185 |
,"1995-1999" \
|
forrest@0
|
186 |
,"1999-2005" \
|
forrest@0
|
187 |
,"1999-2004" \
|
forrest@0
|
188 |
,"2003-2003" \
|
forrest@0
|
189 |
,"2003-2003" \
|
forrest@0
|
190 |
,"2002-2005" \
|
forrest@0
|
191 |
,"2004-2004" \
|
forrest@0
|
192 |
,"2002-2002" \
|
forrest@0
|
193 |
,"2005-2005" \
|
forrest@0
|
194 |
,"2002-2002" \
|
forrest@0
|
195 |
,"2004-2005" \
|
forrest@0
|
196 |
,"2002-2002" \
|
forrest@0
|
197 |
/)
|
forrest@0
|
198 |
|
forrest@0
|
199 |
field = (/"NEE Flux" \
|
forrest@0
|
200 |
,"Net Radiation" \
|
forrest@0
|
201 |
,"Latent Heat" \
|
forrest@0
|
202 |
,"Sensible Heat" \
|
forrest@0
|
203 |
,"GPP Flux" \
|
forrest@0
|
204 |
,"Respiration" \
|
forrest@0
|
205 |
/)
|
forrest@0
|
206 |
|
forrest@0
|
207 |
field_unit = (/"u mol/m2/s" \
|
forrest@0
|
208 |
,"W/m2" \
|
forrest@0
|
209 |
,"W/m2" \
|
forrest@0
|
210 |
,"W/m2" \
|
forrest@0
|
211 |
,"u mol/m2/s" \
|
forrest@0
|
212 |
,"u mol/m2/s" \
|
forrest@0
|
213 |
/)
|
forrest@0
|
214 |
|
forrest@0
|
215 |
nstation = dimsizes(station)
|
forrest@0
|
216 |
nfield = dimsizes(field)
|
forrest@0
|
217 |
|
forrest@0
|
218 |
;========================================================================
|
forrest@0
|
219 |
; get observed info: number of year, first/last year, lat, lon
|
forrest@0
|
220 |
|
forrest@0
|
221 |
dir_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/data/"
|
forrest@0
|
222 |
|
forrest@0
|
223 |
year_station = new ((/nstation/),integer) ; number of year
|
forrest@0
|
224 |
year_ob_i = new ((/nstation/),integer) ; first year
|
forrest@0
|
225 |
year_ob_f = new ((/nstation/),integer) ; last year
|
forrest@0
|
226 |
lat_ob = new ((/nstation/),float) ; latitude
|
forrest@0
|
227 |
lon_ob = new ((/nstation/),float) ; longitude
|
forrest@0
|
228 |
|
forrest@0
|
229 |
do n = 0, nstation-1
|
forrest@0
|
230 |
|
forrest@0
|
231 |
diro = dir_root + station(n)+"/"
|
forrest@0
|
232 |
filo = year_ob(n)+"_L4_m.nc"
|
forrest@0
|
233 |
fo = addfile (diro+filo,"r")
|
forrest@0
|
234 |
|
forrest@0
|
235 |
lat_ob(n) = fo->lat
|
forrest@0
|
236 |
lon_ob(n) = fo->lon
|
forrest@0
|
237 |
|
forrest@0
|
238 |
year = fo->year
|
forrest@0
|
239 |
|
forrest@0
|
240 |
year_station(n) = dimsizes(year)
|
forrest@0
|
241 |
year_ob_i(n) = year(0)
|
forrest@0
|
242 |
year_ob_f(n) = year(year_station(n)-1)
|
forrest@0
|
243 |
|
forrest@0
|
244 |
delete (year)
|
forrest@0
|
245 |
|
forrest@0
|
246 |
end do
|
forrest@0
|
247 |
|
forrest@0
|
248 |
delete (fo)
|
forrest@0
|
249 |
;print (year_ob_i)
|
forrest@0
|
250 |
;print (year_ob_f)
|
forrest@0
|
251 |
|
forrest@0
|
252 |
;--------------------------------------------------------------
|
forrest@0
|
253 |
; find (# of year observed) >=4 and year_ob_i <= 2001
|
forrest@0
|
254 |
|
forrest@0
|
255 |
i_long_ob = ind(year_station .ge. 4 .and. year_ob_i .le. 2001)
|
forrest@0
|
256 |
|
forrest@0
|
257 |
station_long = station(i_long_ob)
|
forrest@0
|
258 |
lat_ob_long = lat_ob(i_long_ob)
|
forrest@0
|
259 |
lon_ob_long = lat_ob(i_long_ob)
|
forrest@0
|
260 |
year_ob_long = year_ob(i_long_ob)
|
forrest@0
|
261 |
year_ob_i_long = year_ob_i(i_long_ob)
|
forrest@0
|
262 |
year_ob_f_long = year_ob_f(i_long_ob)
|
forrest@0
|
263 |
year_station_long = year_station(i_long_ob)
|
forrest@0
|
264 |
|
forrest@0
|
265 |
nstation_long = dimsizes(station_long)
|
forrest@0
|
266 |
|
forrest@0
|
267 |
; print (i_long_ob)
|
forrest@0
|
268 |
; print (nstation_long)
|
forrest@0
|
269 |
; print (station_long)
|
forrest@0
|
270 |
; print (year_ob_i(i_long_ob))
|
forrest@0
|
271 |
|
forrest@0
|
272 |
;=========================================================
|
forrest@0
|
273 |
; get model data at observed lat-lon
|
forrest@0
|
274 |
|
forrest@0
|
275 |
dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
276 |
film = model_name+"_ameriflux_1990-2004_monthly.nc"
|
forrest@0
|
277 |
fm = addfile (dirm+film,"r")
|
forrest@0
|
278 |
|
forrest@0
|
279 |
xm = fm->lon
|
forrest@0
|
280 |
ym = fm->lat
|
forrest@0
|
281 |
date = fm->date
|
forrest@0
|
282 |
|
forrest@0
|
283 |
date_dim = dimsizes(date)
|
forrest@0
|
284 |
nyear = date_dim(0)
|
forrest@0
|
285 |
|
forrest@0
|
286 |
nmonth =12
|
forrest@0
|
287 |
|
forrest@0
|
288 |
data_mod = new ((/nfield,nyear,nmonth,nstation/),float)
|
forrest@0
|
289 |
data_mod_ann = new ((/nfield,nmonth,nstation/),float)
|
forrest@0
|
290 |
data_mod_long = new ((/nfield,nyear,nmonth,nstation_long/),float)
|
forrest@0
|
291 |
|
forrest@0
|
292 |
; change to unit of observed (u mol/m2/s)
|
forrest@0
|
293 |
; Model_units [=] gC/m2/s
|
forrest@0
|
294 |
; 12. = molecular weight of C
|
forrest@0
|
295 |
; u mol = 1e-6 mol
|
forrest@0
|
296 |
|
forrest@0
|
297 |
factor = 1.e6 /12.
|
forrest@0
|
298 |
|
forrest@0
|
299 |
;------------------------------------------------------------
|
forrest@0
|
300 |
; interpolate model data into observed station
|
forrest@0
|
301 |
; note: model is 0-360E, 90S-90N
|
forrest@0
|
302 |
|
forrest@0
|
303 |
; to be able to handle observation at (-89.98,-24.80)
|
forrest@0
|
304 |
ym(0) = -90.
|
forrest@0
|
305 |
;------------------------------------------------------------
|
forrest@0
|
306 |
|
forrest@0
|
307 |
if (ENERGY .eq. "old") then
|
forrest@0
|
308 |
|
forrest@0
|
309 |
data = fm->NEE
|
forrest@0
|
310 |
data_mod(0,:,:,:) = data(:,:,:) * factor
|
forrest@0
|
311 |
|
forrest@0
|
312 |
; data = fm->LATENT
|
forrest@0
|
313 |
data1 = fm->FCEV
|
forrest@0
|
314 |
data2 = fm->FCTR
|
forrest@0
|
315 |
data3 = fm->FGEV
|
forrest@0
|
316 |
data_mod(2,:,:,:) = data1(:,:,:)+data2(:,:,:)+data3(:,:,:)
|
forrest@0
|
317 |
delete (data1)
|
forrest@0
|
318 |
delete (data2)
|
forrest@0
|
319 |
delete (data3)
|
forrest@0
|
320 |
|
forrest@0
|
321 |
; data = fm->SENSIBLE
|
forrest@0
|
322 |
data = fm->FSH
|
forrest@0
|
323 |
data_mod(3,:,:,:) = data(:,:,:)
|
forrest@0
|
324 |
|
forrest@0
|
325 |
; data = fm->NETRAD
|
forrest@0
|
326 |
data1 = fm->FSA
|
forrest@0
|
327 |
data2 = fm->FIRA
|
forrest@0
|
328 |
data_mod(1,:,:,:) = data1(:,:,:)-data2(:,:,:)
|
forrest@0
|
329 |
delete (data1)
|
forrest@0
|
330 |
delete (data2)
|
forrest@0
|
331 |
|
forrest@0
|
332 |
else
|
forrest@0
|
333 |
|
forrest@0
|
334 |
data = fm->NEE
|
forrest@0
|
335 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
336 |
data_mod_ann(0,:,:)= dim_avg(yy(month|:,pts|:,year|:)) * factor
|
forrest@0
|
337 |
data_mod(0,:,:,:) = yy(:,:,:) * factor
|
forrest@0
|
338 |
|
forrest@0
|
339 |
; printVarSummary(yy)
|
forrest@0
|
340 |
|
forrest@0
|
341 |
data = fm->NETRAD
|
forrest@0
|
342 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
343 |
data_mod_ann(1,:,:)= dim_avg(yy(month|:,pts|:,year|:))
|
forrest@0
|
344 |
data_mod(1,:,:,:) = yy(:,:,:)
|
forrest@0
|
345 |
|
forrest@0
|
346 |
data = fm->LATENT
|
forrest@0
|
347 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
348 |
data_mod_ann(2,:,:)= dim_avg(yy(month|:,pts|:,year|:))
|
forrest@0
|
349 |
data_mod(2,:,:,:) = yy(:,:,:)
|
forrest@0
|
350 |
|
forrest@0
|
351 |
; data = fm->SENSIBLE
|
forrest@0
|
352 |
data = fm->FSH
|
forrest@0
|
353 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
354 |
data_mod_ann(3,:,:)= dim_avg(yy(month|:,pts|:,year|:))
|
forrest@0
|
355 |
data_mod(3,:,:,:) = yy(:,:,:)
|
forrest@0
|
356 |
|
forrest@0
|
357 |
end if
|
forrest@0
|
358 |
|
forrest@0
|
359 |
data = fm->GPP
|
forrest@0
|
360 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
361 |
data_mod_ann(4,:,:)= dim_avg(yy(month|:,pts|:,year|:)) * factor
|
forrest@0
|
362 |
data_mod(4,:,:,:) = yy(:,:,:) * factor
|
forrest@0
|
363 |
|
forrest@0
|
364 |
if (model .eq. "cn") then
|
forrest@0
|
365 |
data = fm->ER
|
forrest@0
|
366 |
else
|
forrest@0
|
367 |
data1 = fm->AR
|
forrest@0
|
368 |
data2 = fm->HR
|
forrest@0
|
369 |
data = data1 + data2
|
forrest@0
|
370 |
|
forrest@0
|
371 |
delete (data1)
|
forrest@0
|
372 |
delete (data2)
|
forrest@0
|
373 |
end if
|
forrest@0
|
374 |
|
forrest@0
|
375 |
yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0)
|
forrest@0
|
376 |
data_mod_ann(5,:,:)= dim_avg(yy(month|:,pts|:,year|:)) * factor
|
forrest@0
|
377 |
data_mod(5,:,:,:) = yy(:,:,:) * factor
|
forrest@0
|
378 |
|
forrest@0
|
379 |
data_mod_long(:,:,:,:) = data_mod(:,:,:,i_long_ob)
|
forrest@0
|
380 |
|
forrest@0
|
381 |
delete (data_mod)
|
forrest@0
|
382 |
delete (fm)
|
forrest@0
|
383 |
delete (data)
|
forrest@0
|
384 |
delete (yy)
|
forrest@0
|
385 |
|
forrest@0
|
386 |
;*******************************************************************
|
forrest@0
|
387 |
; for station line plot
|
forrest@0
|
388 |
;*******************************************************************
|
forrest@0
|
389 |
|
forrest@0
|
390 |
; for x-axis in xyplot
|
forrest@0
|
391 |
mon = ispan(1,12,1)
|
forrest@0
|
392 |
mon@long_name = "month"
|
forrest@0
|
393 |
|
forrest@0
|
394 |
res = True ; plot mods desired
|
forrest@0
|
395 |
res@xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker
|
forrest@0
|
396 |
res@xyLineColors = (/"blue","red"/) ; line color (ob,model)
|
forrest@0
|
397 |
|
forrest@0
|
398 |
res@tmXBFormat = "f" ; not to add trailing zeros
|
forrest@0
|
399 |
|
forrest@0
|
400 |
;-------------------------------------------------------------------------
|
forrest@0
|
401 |
; Add a boxed legend using the more simple method
|
forrest@0
|
402 |
|
forrest@0
|
403 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
404 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
405 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
406 |
res@pmLegendHeightF = 0.06
|
forrest@0
|
407 |
; res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
408 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
409 |
res@pmLegendOrthogonalPosF = -0.30 ;(downward)
|
forrest@0
|
410 |
|
forrest@0
|
411 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
412 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
413 |
|
forrest@0
|
414 |
; res@lgPerimOn = False
|
forrest@0
|
415 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
416 |
res@xyExplicitLegendLabels = (/"observed",model_name/)
|
forrest@0
|
417 |
;-------------------------------------------------------------------
|
forrest@0
|
418 |
; for panel plot
|
forrest@0
|
419 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
420 |
res@gsnDraw = False ; Do not advance frame
|
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 |
|
forrest@0
|
428 |
;==============================================================
|
forrest@0
|
429 |
; get ob data at each site with long observation
|
forrest@0
|
430 |
|
forrest@0
|
431 |
dir_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/data/"
|
forrest@0
|
432 |
|
forrest@0
|
433 |
do n = 0,nstation_long-1
|
forrest@0
|
434 |
; do n = 0,0
|
forrest@0
|
435 |
|
forrest@0
|
436 |
year_setback = 0
|
forrest@0
|
437 |
|
forrest@0
|
438 |
nyear = year_station_long(n)
|
forrest@0
|
439 |
|
forrest@0
|
440 |
if (year_ob_f_long(n).eq. 2006) then
|
forrest@0
|
441 |
year_setback = 2006 -2004
|
forrest@0
|
442 |
end if
|
forrest@0
|
443 |
if (year_ob_f_long(n).eq. 2005) then
|
forrest@0
|
444 |
year_setback = 2005 -2004
|
forrest@0
|
445 |
end if
|
forrest@0
|
446 |
|
forrest@0
|
447 |
ntime = (nyear - year_setback) * nmonth
|
forrest@0
|
448 |
print (nyear)
|
forrest@0
|
449 |
|
forrest@0
|
450 |
data_ob = new ((/nfield, nyear, nmonth/),float)
|
forrest@0
|
451 |
|
forrest@0
|
452 |
diro = dir_root + station_long(n)+"/"
|
forrest@0
|
453 |
filo = year_ob_long(n)+"_L4_m.nc"
|
forrest@0
|
454 |
fo = addfile (diro+filo,"r")
|
forrest@0
|
455 |
|
forrest@0
|
456 |
; print (diro)
|
forrest@0
|
457 |
; print (filo)
|
forrest@0
|
458 |
|
forrest@0
|
459 |
data_ob(0,:,:) = fo->NEE_or_fMDS
|
forrest@0
|
460 |
data_ob(1,:,:) = fo->Rg_f
|
forrest@0
|
461 |
data_ob(2,:,:) = fo->LE_f
|
forrest@0
|
462 |
data_ob(3,:,:) = fo->H_f
|
forrest@0
|
463 |
data_ob(4,:,:) = fo->GPP_or_MDS
|
forrest@0
|
464 |
data_ob(5,:,:) = fo->Reco_or
|
forrest@0
|
465 |
|
forrest@0
|
466 |
delete (fo)
|
forrest@0
|
467 |
|
forrest@0
|
468 |
timeI = new((/ntime/),integer)
|
forrest@0
|
469 |
timeF = new((/ntime/),float)
|
forrest@0
|
470 |
timeI = ispan(1,ntime,1)
|
forrest@0
|
471 |
timeF = year_ob_i_long(n) + (timeI-1)/12.
|
forrest@0
|
472 |
timeF@long_name = "year"
|
forrest@0
|
473 |
|
forrest@0
|
474 |
plot_data = new((/2,ntime/),float)
|
forrest@0
|
475 |
|
forrest@0
|
476 |
;----------------------------
|
forrest@0
|
477 |
; for model_vs_ob
|
forrest@0
|
478 |
|
forrest@0
|
479 |
plot_name = station_long(n)+"_tseries_vs_ob"
|
forrest@0
|
480 |
title = station_long(n)+"("+sprintf("%5.2f",lat_ob_long(n))+","+sprintf("%5.2f",lon_ob_long(n))+")"
|
forrest@0
|
481 |
res@tiMainString = title
|
forrest@0
|
482 |
|
forrest@0
|
483 |
wks = gsn_open_wks (plot_type,plot_name)
|
forrest@0
|
484 |
plot=new(nfield,graphic) ; create graphic array
|
forrest@0
|
485 |
|
forrest@0
|
486 |
i_year_mod_i = year_ob_i_long(n) - 1990
|
forrest@0
|
487 |
i_year_mod_f = i_year_mod_i + nyear - 1 - year_setback
|
forrest@0
|
488 |
|
forrest@0
|
489 |
i_year_ob_f = nyear - year_setback - 1
|
forrest@0
|
490 |
|
forrest@0
|
491 |
; print (nyear)
|
forrest@0
|
492 |
; print (i_year_ob_f)
|
forrest@0
|
493 |
; print (i_year_mod_i)
|
forrest@0
|
494 |
; print (i_year_mod_f)
|
forrest@0
|
495 |
|
forrest@0
|
496 |
do i = 0,nfield-1
|
forrest@0
|
497 |
plot_data(0,:) = ndtooned(data_ob (i,0:i_year_ob_f,:))
|
forrest@0
|
498 |
plot_data(1,:) = ndtooned(data_mod_long(i,i_year_mod_i:i_year_mod_f,:,n))
|
forrest@0
|
499 |
plot_data@long_name = field(i)+" ("+field_unit(i)+")"
|
forrest@0
|
500 |
plot(i)=gsn_csm_xy(wks,timeF,plot_data,res) ; create plot
|
forrest@0
|
501 |
end do
|
forrest@0
|
502 |
|
forrest@0
|
503 |
gsn_panel(wks,plot,(/3,2/),pres) ; create panel plot
|
forrest@0
|
504 |
|
forrest@0
|
505 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
|
forrest@0
|
506 |
"rm "+plot_name+"."+plot_type)
|
forrest@0
|
507 |
|
forrest@0
|
508 |
clear (wks)
|
forrest@0
|
509 |
delete (plot)
|
forrest@0
|
510 |
|
forrest@0
|
511 |
delete (data_ob)
|
forrest@0
|
512 |
delete (timeI)
|
forrest@0
|
513 |
delete (timeF)
|
forrest@0
|
514 |
delete (plot_data)
|
forrest@0
|
515 |
|
forrest@0
|
516 |
end do
|
forrest@0
|
517 |
|
forrest@0
|
518 |
;###################################################################
|
forrest@0
|
519 |
; for the following tables,
|
forrest@0
|
520 |
; sort by latitude in decending order (N->S)
|
forrest@0
|
521 |
|
forrest@0
|
522 |
isort = dim_pqsort(lat_ob_long,-1)
|
forrest@0
|
523 |
|
forrest@0
|
524 |
station_sort = station_long(isort)
|
forrest@0
|
525 |
year_ob_sort = year_ob_long(isort)
|
forrest@0
|
526 |
lat_ob_sort = lat_ob_long(isort)
|
forrest@0
|
527 |
lon_ob_sort = lon_ob_long(isort)
|
forrest@0
|
528 |
|
forrest@0
|
529 |
; print(isort)
|
forrest@0
|
530 |
; print(lat_ob_sort)
|
forrest@0
|
531 |
|
forrest@0
|
532 |
;*******************************************************************
|
forrest@0
|
533 |
; html table of site: observed
|
forrest@0
|
534 |
;*******************************************************************
|
forrest@0
|
535 |
output_html = "tseries_vs_ob.html"
|
forrest@0
|
536 |
|
forrest@0
|
537 |
header = (/"<HTML>" \
|
forrest@0
|
538 |
,"<HEAD>" \
|
forrest@0
|
539 |
,"<TITLE>CLAMP metrics</TITLE>" \
|
forrest@0
|
540 |
,"</HEAD>" \
|
forrest@0
|
541 |
,"<H1>Timeseries at Site: "+model_name+" vs Observation</H1>" \
|
forrest@0
|
542 |
/)
|
forrest@0
|
543 |
footer = "</HTML>"
|
forrest@0
|
544 |
|
forrest@0
|
545 |
table_header = (/ \
|
forrest@0
|
546 |
"<table border=1 cellspacing=0 cellpadding=3 width=60%>" \
|
forrest@0
|
547 |
,"<tr>" \
|
forrest@0
|
548 |
," <th bgcolor=DDDDDD >Site Name</th>" \
|
forrest@0
|
549 |
," <th bgcolor=DDDDDD >Latitude</th>" \
|
forrest@0
|
550 |
," <th bgcolor=DDDDDD >Longitude</th>" \
|
forrest@0
|
551 |
," <th bgcolor=DDDDDD >Observed</th>" \
|
forrest@0
|
552 |
,"</tr>" \
|
forrest@0
|
553 |
/)
|
forrest@0
|
554 |
table_footer = "</table>"
|
forrest@0
|
555 |
row_header = "<tr>"
|
forrest@0
|
556 |
row_footer = "</tr>"
|
forrest@0
|
557 |
|
forrest@0
|
558 |
lines = new(50000,string)
|
forrest@0
|
559 |
nline = 0
|
forrest@0
|
560 |
|
forrest@0
|
561 |
set_line(lines,nline,header)
|
forrest@0
|
562 |
set_line(lines,nline,table_header)
|
forrest@0
|
563 |
;-----------------------------------------------
|
forrest@0
|
564 |
; row of table
|
forrest@0
|
565 |
|
forrest@0
|
566 |
do n = 0,nstation_long-1
|
forrest@0
|
567 |
|
forrest@0
|
568 |
set_line(lines,nline,row_header)
|
forrest@0
|
569 |
|
forrest@0
|
570 |
txt0 = station_sort(n)
|
forrest@0
|
571 |
txt1 = sprintf("%5.2f", lat_ob_sort(n))
|
forrest@0
|
572 |
txt2 = sprintf("%5.2f", lon_ob_sort(n))
|
forrest@0
|
573 |
txt3 = year_ob_sort(n)
|
forrest@0
|
574 |
|
forrest@0
|
575 |
set_line(lines,nline,"<th><a href="+txt0+"_tseries_vs_ob.png>"+txt0+"</a></th>")
|
forrest@0
|
576 |
set_line(lines,nline,"<th>"+txt1+"</th>")
|
forrest@0
|
577 |
set_line(lines,nline,"<th>"+txt2+"</th>")
|
forrest@0
|
578 |
set_line(lines,nline,"<th>"+txt3+"</th>")
|
forrest@0
|
579 |
|
forrest@0
|
580 |
set_line(lines,nline,row_footer)
|
forrest@0
|
581 |
end do
|
forrest@0
|
582 |
;-----------------------------------------------
|
forrest@0
|
583 |
set_line(lines,nline,table_footer)
|
forrest@0
|
584 |
set_line(lines,nline,footer)
|
forrest@0
|
585 |
|
forrest@0
|
586 |
; Now write to an HTML file.
|
forrest@0
|
587 |
idx = ind(.not.ismissing(lines))
|
forrest@0
|
588 |
if(.not.any(ismissing(idx))) then
|
forrest@0
|
589 |
asciiwrite(output_html,lines(idx))
|
forrest@0
|
590 |
else
|
forrest@0
|
591 |
print ("error?")
|
forrest@0
|
592 |
end if
|
forrest@0
|
593 |
delete (idx)
|
forrest@0
|
594 |
|
forrest@0
|
595 |
;***************************************************************************
|
forrest@0
|
596 |
; output plots
|
forrest@0
|
597 |
;***************************************************************************
|
forrest@0
|
598 |
output_dir = model_name+"/ameriflux"
|
forrest@0
|
599 |
|
forrest@0
|
600 |
system("mv *.png *.html " + output_dir)
|
forrest@0
|
601 |
;***************************************************************************
|
forrest@0
|
602 |
end
|