|
1 ;************************************************************ |
|
2 ; add time series plot |
|
3 ; sort by latitude in decending order (N->S) |
|
4 ; find year_ob >= 4 |
|
5 ; add year_ob_i and year_ob_f |
|
6 ; change long_name |
|
7 ;************************************************************ |
|
8 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" |
|
9 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" |
|
10 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" |
|
11 ;************************************************************ |
|
12 procedure set_line(lines:string,nline:integer,newlines:string) |
|
13 begin |
|
14 ; add line to ascci/html file |
|
15 |
|
16 nnewlines = dimsizes(newlines) |
|
17 if(nline+nnewlines-1.ge.dimsizes(lines)) |
|
18 print("set_line: bad index, not setting anything.") |
|
19 return |
|
20 end if |
|
21 lines(nline:nline+nnewlines-1) = newlines |
|
22 ; print ("lines = " + lines(nline:nline+nnewlines-1)) |
|
23 nline = nline + nnewlines |
|
24 return |
|
25 end |
|
26 ;************************************************************* |
|
27 begin |
|
28 |
|
29 plot_type = "ps" |
|
30 plot_type_new = "png" |
|
31 |
|
32 ;************************************************ |
|
33 ; read model data |
|
34 ;************************************************ |
|
35 model = "cn" |
|
36 ; model = "casa" |
|
37 |
|
38 model_name = "i01.10" + model |
|
39 |
|
40 ; change to unit of observed (u mol/m2/s) |
|
41 ; Model_units [=] gC/m2/s |
|
42 ; 12. = molecular weight of C |
|
43 ; u mol = 1e-6 mol |
|
44 factor = 1e6 /12. |
|
45 |
|
46 ENERGY ="new" |
|
47 |
|
48 ;************************************************ |
|
49 ; read data: observed |
|
50 ;************************************************ |
|
51 |
|
52 station = (/"ARM_Oklahoma" \ |
|
53 ,"ARM_Oklahoma_burn" \ |
|
54 ,"ARM_Oklahoma_control" \ |
|
55 ,"Atqasuk" \ |
|
56 ,"Audubon" \ |
|
57 ,"AustinCary" \ |
|
58 ,"Bartlett" \ |
|
59 ,"Bondville" \ |
|
60 ,"Brookings" \ |
|
61 ,"Donaldson" \ |
|
62 ,"Duke_Forest_Hardwoods" \ |
|
63 ,"Duke_Forest_Open_Field" \ |
|
64 ,"Duke_Forest_Pine" \ |
|
65 ,"Fermi_Ag" \ |
|
66 ,"Fermi_Prairie" \ |
|
67 ,"Flagstaff_Managed" \ |
|
68 ,"Flagstaff_Unmanaged" \ |
|
69 ,"Flagstaff_Wildfire" \ |
|
70 ,"FortPeck" \ |
|
71 ,"FreemanRanch_mesquite" \ |
|
72 ,"Goodwin_Creek" \ |
|
73 ,"HarvardForest" \ |
|
74 ,"HarvardForestHemlock" \ |
|
75 ,"HowlandForestMain" \ |
|
76 ,"HowlandForestWest" \ |
|
77 ,"Ivotuk" \ |
|
78 ,"KendallGrasslands" \ |
|
79 ,"KennedySpaceCenterPine" \ |
|
80 ,"KennedySpaceCenterScrub" \ |
|
81 ,"LittleProspect" \ |
|
82 ,"LostCreek" \ |
|
83 ,"Mead-irrigated" \ |
|
84 ,"Mead-irrigated-rotation" \ |
|
85 ,"Mead-rainfed" \ |
|
86 ,"Metolius_2nd_YoungPonderosaPine" \ |
|
87 ,"MetoliusEyerly" \ |
|
88 ,"MetoliusIntermediatePine" \ |
|
89 ,"MetoliusOldPonderosaPine" \ |
|
90 ,"MissouriOzark" \ |
|
91 ,"Mize" \ |
|
92 ,"MorganMonroe" \ |
|
93 ,"NiwotRidge" \ |
|
94 ,"NorthCarolina_cc" \ |
|
95 ,"NorthCarolina_lp" \ |
|
96 ,"ParkFalls" \ |
|
97 ,"Rayonier" \ |
|
98 ,"SantaRita" \ |
|
99 ,"SkyOaks_Old" \ |
|
100 ,"SkyOaks_PostFire" \ |
|
101 ,"SkyOaks_Young" \ |
|
102 ,"SylvaniaWilderness" \ |
|
103 ,"Toledo" \ |
|
104 ,"Tonzi" \ |
|
105 ,"UCI_1850" \ |
|
106 ,"UCI_1930" \ |
|
107 ,"UCI_1964" \ |
|
108 ,"UCI_1964wet" \ |
|
109 ,"UCI_1981" \ |
|
110 ,"UCI_1989" \ |
|
111 ,"UCI_1998" \ |
|
112 ,"UMBS" \ |
|
113 ,"Vaira" \ |
|
114 ,"WalkerBranch" \ |
|
115 ,"WillowCreek" \ |
|
116 ,"WindRiver" \ |
|
117 ,"Wisconsin_ihw" \ |
|
118 ,"Wisconsin_irp" \ |
|
119 ,"Wisconsin_mrp" \ |
|
120 ,"Wisconsin_myjp" \ |
|
121 ,"Wisconsin_pb" \ |
|
122 ,"Wisconsin_rpcc" \ |
|
123 ,"Wisconsin_yhw" \ |
|
124 ,"Wisconsin_yjp" \ |
|
125 ,"Wisconsin_yrp" \ |
|
126 /) |
|
127 |
|
128 year_ob = (/"2003-2006" \ |
|
129 ,"2005-2006" \ |
|
130 ,"2005-2006" \ |
|
131 ,"1999-2006" \ |
|
132 ,"2002-2006" \ |
|
133 ,"2000-2005" \ |
|
134 ,"2004-2005" \ |
|
135 ,"1996-2006" \ |
|
136 ,"2004-2006" \ |
|
137 ,"1999-2004" \ |
|
138 ,"2003-2005" \ |
|
139 ,"2001-2005" \ |
|
140 ,"2001-2005" \ |
|
141 ,"2005-2006" \ |
|
142 ,"2004-2006" \ |
|
143 ,"2005-2006" \ |
|
144 ,"2005-2006" \ |
|
145 ,"2005-2006" \ |
|
146 ,"2000-2006" \ |
|
147 ,"2004-2006" \ |
|
148 ,"2002-2006" \ |
|
149 ,"1991-2004" \ |
|
150 ,"2004-2004" \ |
|
151 ,"1996-2004" \ |
|
152 ,"1999-2004" \ |
|
153 ,"2003-2006" \ |
|
154 ,"2004-2006" \ |
|
155 ,"2002-2002" \ |
|
156 ,"2000-2006" \ |
|
157 ,"2002-2005" \ |
|
158 ,"2001-2005" \ |
|
159 ,"2001-2005" \ |
|
160 ,"2001-2005" \ |
|
161 ,"2001-2005" \ |
|
162 ,"2004-2005" \ |
|
163 ,"2004-2005" \ |
|
164 ,"2003-2005" \ |
|
165 ,"1996-2000" \ |
|
166 ,"2004-2006" \ |
|
167 ,"1998-2004" \ |
|
168 ,"1999-2005" \ |
|
169 ,"1999-2003" \ |
|
170 ,"2005-2006" \ |
|
171 ,"2005-2006" \ |
|
172 ,"1996-2003" \ |
|
173 ,"1998-1998" \ |
|
174 ,"2004-2006" \ |
|
175 ,"1997-2006" \ |
|
176 ,"2004-2006" \ |
|
177 ,"1997-2006" \ |
|
178 ,"2002-2006" \ |
|
179 ,"2004-2005" \ |
|
180 ,"2001-2006" \ |
|
181 ,"2004-2005" \ |
|
182 ,"2001-2005" \ |
|
183 ,"2001-2005" \ |
|
184 ,"2002-2004" \ |
|
185 ,"2001-2005" \ |
|
186 ,"2001-2005" \ |
|
187 ,"2002-2005" \ |
|
188 ,"1999-2003" \ |
|
189 ,"2001-2006" \ |
|
190 ,"1995-1999" \ |
|
191 ,"1999-2005" \ |
|
192 ,"1999-2004" \ |
|
193 ,"2003-2003" \ |
|
194 ,"2003-2003" \ |
|
195 ,"2002-2005" \ |
|
196 ,"2004-2004" \ |
|
197 ,"2002-2002" \ |
|
198 ,"2005-2005" \ |
|
199 ,"2002-2002" \ |
|
200 ,"2004-2005" \ |
|
201 ,"2002-2002" \ |
|
202 /) |
|
203 |
|
204 year_ob_i = (/2003 \ |
|
205 ,2005 \ |
|
206 ,2005 \ |
|
207 ,1999 \ |
|
208 ,2002 \ |
|
209 ,2000 \ |
|
210 ,2004 \ |
|
211 ,1996 \ |
|
212 ,2004 \ |
|
213 ,1999 \ |
|
214 ,2003 \ |
|
215 ,2001 \ |
|
216 ,2001 \ |
|
217 ,2005 \ |
|
218 ,2004 \ |
|
219 ,2005 \ |
|
220 ,2005 \ |
|
221 ,2005 \ |
|
222 ,2000 \ |
|
223 ,2004 \ |
|
224 ,2002 \ |
|
225 ,1991 \ |
|
226 ,2004 \ |
|
227 ,1996 \ |
|
228 ,1999 \ |
|
229 ,2003 \ |
|
230 ,2004 \ |
|
231 ,2002 \ |
|
232 ,2000 \ |
|
233 ,2002 \ |
|
234 ,2001 \ |
|
235 ,2001 \ |
|
236 ,2001 \ |
|
237 ,2001 \ |
|
238 ,2004 \ |
|
239 ,2004 \ |
|
240 ,2003 \ |
|
241 ,1996 \ |
|
242 ,2004 \ |
|
243 ,1998 \ |
|
244 ,1999 \ |
|
245 ,1999 \ |
|
246 ,2005 \ |
|
247 ,2005 \ |
|
248 ,1996 \ |
|
249 ,1998 \ |
|
250 ,2004 \ |
|
251 ,1997 \ |
|
252 ,2004 \ |
|
253 ,1997 \ |
|
254 ,2002 \ |
|
255 ,2004 \ |
|
256 ,2001 \ |
|
257 ,2004 \ |
|
258 ,2001 \ |
|
259 ,2001 \ |
|
260 ,2002 \ |
|
261 ,2001 \ |
|
262 ,2001 \ |
|
263 ,2002 \ |
|
264 ,1999 \ |
|
265 ,2001 \ |
|
266 ,1995 \ |
|
267 ,1999 \ |
|
268 ,1999 \ |
|
269 ,2003 \ |
|
270 ,2003 \ |
|
271 ,2002 \ |
|
272 ,2004 \ |
|
273 ,2002 \ |
|
274 ,2005 \ |
|
275 ,2002 \ |
|
276 ,2004 \ |
|
277 ,2002 \ |
|
278 /) |
|
279 |
|
280 year_ob_f = (/2006 \ |
|
281 ,2006 \ |
|
282 ,2006 \ |
|
283 ,2006 \ |
|
284 ,2006 \ |
|
285 ,2005 \ |
|
286 ,2005 \ |
|
287 ,2006 \ |
|
288 ,2006 \ |
|
289 ,2004 \ |
|
290 ,2005 \ |
|
291 ,2005 \ |
|
292 ,2005 \ |
|
293 ,2006 \ |
|
294 ,2006 \ |
|
295 ,2006 \ |
|
296 ,2006 \ |
|
297 ,2006 \ |
|
298 ,2006 \ |
|
299 ,2006 \ |
|
300 ,2006 \ |
|
301 ,2004 \ |
|
302 ,2004 \ |
|
303 ,2004 \ |
|
304 ,2004 \ |
|
305 ,2006 \ |
|
306 ,2006 \ |
|
307 ,2002 \ |
|
308 ,2006 \ |
|
309 ,2005 \ |
|
310 ,2005 \ |
|
311 ,2005 \ |
|
312 ,2005 \ |
|
313 ,2005 \ |
|
314 ,2005 \ |
|
315 ,2005 \ |
|
316 ,2005 \ |
|
317 ,2000 \ |
|
318 ,2006 \ |
|
319 ,2004 \ |
|
320 ,2005 \ |
|
321 ,2003 \ |
|
322 ,2006 \ |
|
323 ,2006 \ |
|
324 ,2003 \ |
|
325 ,1998 \ |
|
326 ,2006 \ |
|
327 ,2006 \ |
|
328 ,2006 \ |
|
329 ,2006 \ |
|
330 ,2006 \ |
|
331 ,2005 \ |
|
332 ,2006 \ |
|
333 ,2005 \ |
|
334 ,2005 \ |
|
335 ,2005 \ |
|
336 ,2004 \ |
|
337 ,2005 \ |
|
338 ,2005 \ |
|
339 ,2005 \ |
|
340 ,2003 \ |
|
341 ,2006 \ |
|
342 ,1999 \ |
|
343 ,2005 \ |
|
344 ,2004 \ |
|
345 ,2003 \ |
|
346 ,2003 \ |
|
347 ,2005 \ |
|
348 ,2004 \ |
|
349 ,2002 \ |
|
350 ,2005 \ |
|
351 ,2002 \ |
|
352 ,2005 \ |
|
353 ,2002 \ |
|
354 /) |
|
355 |
|
356 field = (/"NEE Flux" \ |
|
357 ,"Net Radiation" \ |
|
358 ,"Latent Heat" \ |
|
359 ,"Sensible Heat" \ |
|
360 ,"GPP Flux" \ |
|
361 ,"Respiration" \ |
|
362 /) |
|
363 |
|
364 field_unit = (/"u mol/m2/s" \ |
|
365 ,"W/m2" \ |
|
366 ,"W/m2" \ |
|
367 ,"W/m2" \ |
|
368 ,"u mol/m2/s" \ |
|
369 ,"u mol/m2/s" \ |
|
370 /) |
|
371 |
|
372 nfield = dimsizes(field) |
|
373 |
|
374 ;======================================================================== |
|
375 ; find (# of year observed) >=4 and year_ob_i <= 2001 |
|
376 |
|
377 dir_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/data/" |
|
378 |
|
379 nstation = dimsizes(station) |
|
380 |
|
381 year_station = new ((/nstation/),integer) |
|
382 |
|
383 do n = 0,nstation-1 |
|
384 |
|
385 diro = dir_root + station(n)+"/" |
|
386 filo = year_ob_i(n)+"-"+year_ob_f(n)+"_L4_m.nc" |
|
387 fo = addfile (diro+filo,"r") |
|
388 |
|
389 year = fo->year |
|
390 year_station(n) = dimsizes(year) |
|
391 delete (year) |
|
392 |
|
393 end do |
|
394 |
|
395 delete (fo) |
|
396 |
|
397 i_long_ob = ind(year_station .ge. 4 .and. year_ob_i .le. 2001) |
|
398 |
|
399 station_long = station(i_long_ob) |
|
400 year_ob_long = year_ob(i_long_ob) |
|
401 year_ob_i_long = year_ob_i(i_long_ob) |
|
402 year_ob_f_long = year_ob_f(i_long_ob) |
|
403 year_station_long = year_station(i_long_ob) |
|
404 |
|
405 nstation = dimsizes(station_long) |
|
406 ; print (nstation) |
|
407 ; print (i_long_ob) |
|
408 ; print (year_ob_i(i_long_ob)) |
|
409 ; print (station_long) |
|
410 |
|
411 ;======================================================================== |
|
412 ; get observed lat and lon |
|
413 |
|
414 dir_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/data/" |
|
415 |
|
416 lat_ob = new ((/nstation/),float) |
|
417 lon_ob = new ((/nstation/),float) |
|
418 |
|
419 do n = 0,nstation-1 |
|
420 |
|
421 diro = dir_root + station_long(n)+"/" |
|
422 filo = year_ob_i_long(n)+"-"+year_ob_f_long(n)+"_L4_m.nc" |
|
423 fo = addfile (diro+filo,"r") |
|
424 |
|
425 ; print (diro) |
|
426 ; print (filo) |
|
427 |
|
428 lon_ob(n) = fo->lon |
|
429 lat_ob(n) = fo->lat |
|
430 |
|
431 delete (fo) |
|
432 |
|
433 end do |
|
434 |
|
435 ;========================================================= |
|
436 ; get model data at observed lat-lon |
|
437 |
|
438 dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/" |
|
439 film = model_name+"_ameriflux_1990-2004_monthly.nc" |
|
440 fm = addfile (dirm+film,"r") |
|
441 |
|
442 xm = fm->lon |
|
443 ym = fm->lat |
|
444 date = fm->date |
|
445 |
|
446 date_dim = dimsizes(date) |
|
447 nyear = date_dim(0) |
|
448 |
|
449 nmonth =12 |
|
450 |
|
451 data_mod = new ((/nfield,nyear,nmonth,nstation/),float) |
|
452 |
|
453 ;************************************************************ |
|
454 ; interpolate model data into observed station |
|
455 ; note: model is 0-360E, 90S-90N |
|
456 ;************************************************************ |
|
457 |
|
458 ; to be able to handle observation at (-89.98,-24.80) |
|
459 ym(0) = -90. |
|
460 |
|
461 if (ENERGY .eq. "old") then |
|
462 |
|
463 data = fm->NEE |
|
464 data_mod(0,:,:,:) = data(:,:,:) * factor |
|
465 |
|
466 ; data = fm->LATENT |
|
467 data1 = fm->FCEV |
|
468 data2 = fm->FCTR |
|
469 data3 = fm->FGEV |
|
470 data_mod(2,:,:,:) = data1(:,:,:)+data2(:,:,:)+data3(:,:,:) |
|
471 delete (data1) |
|
472 delete (data2) |
|
473 delete (data3) |
|
474 |
|
475 ; data = fm->SENSIBLE |
|
476 data = fm->FSH |
|
477 data_mod(3,:,:,:) = data(:,:,:) |
|
478 |
|
479 ; data = fm->NETRAD |
|
480 data1 = fm->FSA |
|
481 data2 = fm->FIRA |
|
482 data_mod(1,:,:,:) = data1(:,:,:)-data2(:,:,:) |
|
483 delete (data1) |
|
484 delete (data2) |
|
485 |
|
486 else |
|
487 |
|
488 data = fm->NEE |
|
489 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
490 data_mod(0,:,:,:) = yy(:,:,:) * factor |
|
491 |
|
492 data = fm->NETRAD |
|
493 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
494 data_mod(1,:,:,:) = yy(:,:,:) |
|
495 |
|
496 data = fm->LATENT |
|
497 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
498 data_mod(2,:,:,:) = yy(:,:,:) |
|
499 |
|
500 ; data = fm->SENSIBLE |
|
501 data = fm->FSH |
|
502 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
503 data_mod(3,:,:,:) = yy(:,:,:) |
|
504 |
|
505 end if |
|
506 |
|
507 data = fm->GPP |
|
508 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
509 data_mod(4,:,:,:) = yy(:,:,:) * factor |
|
510 |
|
511 if (model .eq. "cn") then |
|
512 data = fm->ER |
|
513 else |
|
514 data1 = fm->AR |
|
515 data2 = fm->HR |
|
516 data = data1 + data2 |
|
517 |
|
518 delete (data1) |
|
519 delete (data2) |
|
520 end if |
|
521 |
|
522 yy = linint2_points_Wrap(xm,ym,data,True,lon_ob,lat_ob,0) |
|
523 data_mod(5,:,:,:) = yy(:,:,:) * factor |
|
524 |
|
525 delete (fm) |
|
526 delete (data) |
|
527 |
|
528 ;******************************************************************* |
|
529 ; for station line plot |
|
530 ;******************************************************************* |
|
531 |
|
532 ; for x-axis in xyplot |
|
533 mon = ispan(1,12,1) |
|
534 mon@long_name = "month" |
|
535 |
|
536 res = True ; plot mods desired |
|
537 res@xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker |
|
538 res@xyLineColors = (/"blue","red"/) ; line color (ob,model) |
|
539 |
|
540 res@tmXBFormat = "f" ; not to add trailing zeros |
|
541 |
|
542 ;------------------------------------------------------------------------- |
|
543 ; Add a boxed legend using the more simple method |
|
544 |
|
545 res@pmLegendDisplayMode = "Always" |
|
546 ; res@pmLegendWidthF = 0.1 |
|
547 res@pmLegendWidthF = 0.08 |
|
548 res@pmLegendHeightF = 0.06 |
|
549 ; res@pmLegendOrthogonalPosF = -1.17 |
|
550 ; res@pmLegendOrthogonalPosF = -1.00 ;(downward) |
|
551 res@pmLegendOrthogonalPosF = -0.30 ;(downward) |
|
552 |
|
553 ; res@pmLegendParallelPosF = 0.18 |
|
554 res@pmLegendParallelPosF = 0.23 ;(rightward) |
|
555 |
|
556 ; res@lgPerimOn = False |
|
557 res@lgLabelFontHeightF = 0.015 |
|
558 res@xyExplicitLegendLabels = (/"observed",model_name/) |
|
559 ;------------------------------------------------------------------- |
|
560 ; for panel plot |
|
561 res@gsnFrame = False ; Do not draw plot |
|
562 res@gsnDraw = False ; Do not advance frame |
|
563 |
|
564 pres = True ; panel plot mods desired |
|
565 pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around |
|
566 ; indiv. plots in panel |
|
567 pres@gsnMaximize = True ; fill the page |
|
568 ;------------------------------------------------------------------- |
|
569 |
|
570 ;============================================================== |
|
571 ; get ob data at each site |
|
572 |
|
573 dir_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/data/" |
|
574 |
|
575 do n = 0,nstation-1 |
|
576 ; do n = 2,6 |
|
577 |
|
578 year_setback = 0 |
|
579 |
|
580 nyear = year_station_long(n) |
|
581 |
|
582 if (year_ob_f_long(n).eq. 2006) then |
|
583 year_setback = 2006 -2004 |
|
584 end if |
|
585 if (year_ob_f_long(n).eq. 2005) then |
|
586 year_setback = 2005 -2004 |
|
587 end if |
|
588 |
|
589 ntime = (nyear - year_setback) * nmonth |
|
590 print (nyear) |
|
591 |
|
592 data_ob = new ((/nfield, nyear, nmonth/),float) |
|
593 |
|
594 diro = dir_root + station_long(n)+"/" |
|
595 filo = year_ob_i_long(n)+"-"+year_ob_f_long(n)+"_L4_m.nc" |
|
596 fo = addfile (diro+filo,"r") |
|
597 |
|
598 print (diro) |
|
599 print (filo) |
|
600 |
|
601 lon_ob(n) = fo->lon |
|
602 lat_ob(n) = fo->lat |
|
603 |
|
604 data = fo->NEE_or_fMDS |
|
605 data_ob(0,:,:) = data(:,:) |
|
606 delete (data) |
|
607 |
|
608 data = fo->Rg_f |
|
609 data_ob(1,:,:) = data(:,:) |
|
610 delete (data) |
|
611 |
|
612 data = fo->LE_f |
|
613 data_ob(2,:,:) = data(:,:) |
|
614 delete (data) |
|
615 |
|
616 data = fo->H_f |
|
617 data_ob(3,:,:) = data(:,:) |
|
618 delete (data) |
|
619 |
|
620 data = fo->GPP_or_MDS |
|
621 data_ob(4,:,:) = data(:,:) |
|
622 delete (data) |
|
623 |
|
624 data = fo->Reco_or |
|
625 data_ob(5,:,:) = data(:,:) |
|
626 delete (data) |
|
627 |
|
628 delete (fo) |
|
629 |
|
630 timeI = new((/ntime/),integer) |
|
631 timeF = new((/ntime/),float) |
|
632 timeI = ispan(1,ntime,1) |
|
633 timeF = year_ob_i_long(n) + (timeI-1)/12. |
|
634 timeF@long_name = "year" |
|
635 |
|
636 plot_data = new((/2,ntime/),float) |
|
637 |
|
638 ;---------------------------- |
|
639 ; for model_vs_ob |
|
640 |
|
641 plot_name = station_long(n)+"_model_vs_ob" |
|
642 title = station_long(n)+"("+sprintf("%5.2f",lat_ob(n))+","+sprintf("%5.2f",lon_ob(n))+")" |
|
643 res@tiMainString = title |
|
644 |
|
645 wks = gsn_open_wks (plot_type,plot_name) |
|
646 plot=new(nfield,graphic) ; create graphic array |
|
647 |
|
648 i_year_mod_i = year_ob_i_long(n) - 1990 |
|
649 i_year_mod_f = i_year_mod_i + nyear - 1 - year_setback |
|
650 |
|
651 i_year_ob_f = nyear - year_setback - 1 |
|
652 |
|
653 print (nyear) |
|
654 print (i_year_ob_f) |
|
655 print (i_year_mod_i) |
|
656 print (i_year_mod_f) |
|
657 |
|
658 do i = 0,nfield-1 |
|
659 plot_data(0,:) = ndtooned(data_ob (i,0:i_year_ob_f,:)) |
|
660 plot_data(1,:) = ndtooned(data_mod(i,i_year_mod_i:i_year_mod_f,:,n)) |
|
661 plot_data@long_name = field(i)+" ("+field_unit(i)+")" |
|
662 plot(i)=gsn_csm_xy(wks,timeF,plot_data,res) ; create plot |
|
663 end do |
|
664 |
|
665 gsn_panel(wks,plot,(/3,2/),pres) ; create panel plot |
|
666 |
|
667 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \ |
|
668 "rm "+plot_name+"."+plot_type) |
|
669 |
|
670 clear (wks) |
|
671 delete (plot) |
|
672 |
|
673 delete (data_ob) |
|
674 delete (timeI) |
|
675 delete (timeF) |
|
676 delete (plot_data) |
|
677 |
|
678 end do |
|
679 exit |
|
680 ;################################################################### |
|
681 ; for the following tables, |
|
682 ; sort by latitude in decending order (N->S) |
|
683 |
|
684 isort = dim_pqsort(lat_ob,-1) |
|
685 |
|
686 station_sort = station_long(isort) |
|
687 year_ob_sort = year_ob_long(isort) |
|
688 lat_ob_sort = lat_ob(isort) |
|
689 lon_ob_sort = lon_ob(isort) |
|
690 M_score_sort = M_score(isort,:) |
|
691 |
|
692 print(isort) |
|
693 print(lat_ob_sort) |
|
694 |
|
695 ;******************************************************************* |
|
696 ; html table of site: observed |
|
697 ;******************************************************************* |
|
698 output_html = "line_ob.html" |
|
699 |
|
700 header = (/"<HTML>" \ |
|
701 ,"<HEAD>" \ |
|
702 ,"<TITLE>CLAMP metrics</TITLE>" \ |
|
703 ,"</HEAD>" \ |
|
704 ,"<H1>Energy at Site: Observation</H1>" \ |
|
705 /) |
|
706 footer = "</HTML>" |
|
707 |
|
708 table_header = (/ \ |
|
709 "<table border=1 cellspacing=0 cellpadding=3 width=60%>" \ |
|
710 ,"<tr>" \ |
|
711 ," <th bgcolor=DDDDDD >Site Name</th>" \ |
|
712 ," <th bgcolor=DDDDDD >Latitude</th>" \ |
|
713 ," <th bgcolor=DDDDDD >Longitude</th>" \ |
|
714 ," <th bgcolor=DDDDDD >Observed</th>" \ |
|
715 ,"</tr>" \ |
|
716 /) |
|
717 table_footer = "</table>" |
|
718 row_header = "<tr>" |
|
719 row_footer = "</tr>" |
|
720 |
|
721 lines = new(50000,string) |
|
722 nline = 0 |
|
723 |
|
724 set_line(lines,nline,header) |
|
725 set_line(lines,nline,table_header) |
|
726 ;----------------------------------------------- |
|
727 ; row of table |
|
728 |
|
729 do n = 0,nstation-1 |
|
730 |
|
731 set_line(lines,nline,row_header) |
|
732 |
|
733 txt0 = station_sort(n) |
|
734 txt1 = sprintf("%5.2f", lat_ob_sort(n)) |
|
735 txt2 = sprintf("%5.2f", lon_ob_sort(n)) |
|
736 txt3 = year_ob_sort(n) |
|
737 |
|
738 set_line(lines,nline,"<th><a href="+txt0+"_ob.png>"+txt0+"</a></th>") |
|
739 set_line(lines,nline,"<th>"+txt1+"</th>") |
|
740 set_line(lines,nline,"<th>"+txt2+"</th>") |
|
741 set_line(lines,nline,"<th>"+txt3+"</th>") |
|
742 |
|
743 set_line(lines,nline,row_footer) |
|
744 end do |
|
745 ;----------------------------------------------- |
|
746 set_line(lines,nline,table_footer) |
|
747 set_line(lines,nline,footer) |
|
748 |
|
749 ; Now write to an HTML file. |
|
750 idx = ind(.not.ismissing(lines)) |
|
751 if(.not.any(ismissing(idx))) then |
|
752 asciiwrite(output_html,lines(idx)) |
|
753 else |
|
754 print ("error?") |
|
755 end if |
|
756 delete (idx) |
|
757 |
|
758 ;******************************************************************* |
|
759 ; score and line table : model vs observed |
|
760 ;******************************************************************* |
|
761 output_html = "score+line_vs_ob.html" |
|
762 |
|
763 header = (/"<HTML>" \ |
|
764 ,"<HEAD>" \ |
|
765 ,"<TITLE>CLAMP metrics</TITLE>" \ |
|
766 ,"</HEAD>" \ |
|
767 ,"<H1>Energy at Site: Model "+model_name+"</H1>" \ |
|
768 /) |
|
769 footer = "</HTML>" |
|
770 |
|
771 delete (table_header) |
|
772 table_header = (/ \ |
|
773 "<table border=1 cellspacing=0 cellpadding=3 width=100%>" \ |
|
774 ,"<tr>" \ |
|
775 ," <th bgcolor=DDDDDD >Site Name</th>" \ |
|
776 ," <th bgcolor=DDDDDD >Latitude</th>" \ |
|
777 ," <th bgcolor=DDDDDD >Longitude</th>" \ |
|
778 ," <th bgcolor=DDDDDD >Observed</th>" \ |
|
779 ," <th bgcolor=DDDDDD >CO2 Flux</th>" \ |
|
780 ," <th bgcolor=DDDDDD >Net Radiation</th>" \ |
|
781 ," <th bgcolor=DDDDDD >Latent Heat</th>" \ |
|
782 ," <th bgcolor=DDDDDD >Sensible Heat</th>" \ |
|
783 ," <th bgcolor=DDDDDD >GPP Glux</th>" \ |
|
784 ," <th bgcolor=DDDDDD >Respiration</th>" \ |
|
785 ," <th bgcolor=DDDDDD >Average</th>" \ |
|
786 ,"</tr>" \ |
|
787 /) |
|
788 table_footer = "</table>" |
|
789 row_header = "<tr>" |
|
790 row_footer = "</tr>" |
|
791 |
|
792 lines = new(50000,string) |
|
793 nline = 0 |
|
794 |
|
795 set_line(lines,nline,header) |
|
796 set_line(lines,nline,table_header) |
|
797 ;----------------------------------------------- |
|
798 ; row of table |
|
799 |
|
800 do n = 0,nstation-1 |
|
801 |
|
802 set_line(lines,nline,row_header) |
|
803 |
|
804 txt0 = station_sort(n) |
|
805 txt1 = sprintf("%5.2f", lat_ob_sort(n)) |
|
806 txt2 = sprintf("%5.2f", lon_ob_sort(n)) |
|
807 txt3 = year_ob_sort(n) |
|
808 txt4 = sprintf("%5.2f", M_score_sort(n,0)) |
|
809 txt5 = sprintf("%5.2f", M_score_sort(n,1)) |
|
810 txt6 = sprintf("%5.2f", M_score_sort(n,2)) |
|
811 txt7 = sprintf("%5.2f", M_score_sort(n,3)) |
|
812 txt8 = sprintf("%5.2f", M_score_sort(n,4)) |
|
813 txt9 = sprintf("%5.2f", M_score_sort(n,5)) |
|
814 txt10 = sprintf("%5.2f", avg(M_score_sort(n,:))) |
|
815 |
|
816 set_line(lines,nline,"<th><a href="+txt0+"_model_vs_ob.png>"+txt0+"</a></th>") |
|
817 set_line(lines,nline,"<th>"+txt1+"</th>") |
|
818 set_line(lines,nline,"<th>"+txt2+"</th>") |
|
819 set_line(lines,nline,"<th>"+txt3+"</th>") |
|
820 set_line(lines,nline,"<th>"+txt4+"</th>") |
|
821 set_line(lines,nline,"<th>"+txt5+"</th>") |
|
822 set_line(lines,nline,"<th>"+txt6+"</th>") |
|
823 set_line(lines,nline,"<th>"+txt7+"</th>") |
|
824 set_line(lines,nline,"<th>"+txt8+"</th>") |
|
825 set_line(lines,nline,"<th>"+txt9+"</th>") |
|
826 set_line(lines,nline,"<th>"+txt10+"</th>") |
|
827 |
|
828 set_line(lines,nline,row_footer) |
|
829 end do |
|
830 |
|
831 ; last row, summary |
|
832 set_line(lines,nline,row_header) |
|
833 |
|
834 txt0 = "All_"+sprintf("%.0f", nstation) |
|
835 txt1 = "-" |
|
836 txt2 = "-" |
|
837 txt3 = "-" |
|
838 txt4 = M_energy_co2 |
|
839 txt5 = M_energy_rad |
|
840 txt6 = M_energy_lh |
|
841 txt7 = M_energy_sh |
|
842 txt8 = M_energy_gpp |
|
843 txt9 = M_energy_er |
|
844 txt10 = M_energy_all |
|
845 |
|
846 set_line(lines,nline,"<th>"+txt0+"</th>") |
|
847 set_line(lines,nline,"<th>"+txt1+"</th>") |
|
848 set_line(lines,nline,"<th>"+txt2+"</th>") |
|
849 set_line(lines,nline,"<th>"+txt3+"</th>") |
|
850 set_line(lines,nline,"<th>"+txt4+"</th>") |
|
851 set_line(lines,nline,"<th>"+txt5+"</th>") |
|
852 set_line(lines,nline,"<th>"+txt6+"</th>") |
|
853 set_line(lines,nline,"<th>"+txt7+"</th>") |
|
854 set_line(lines,nline,"<th>"+txt8+"</th>") |
|
855 set_line(lines,nline,"<th>"+txt9+"</th>") |
|
856 set_line(lines,nline,"<th>"+txt10+"</th>") |
|
857 |
|
858 set_line(lines,nline,row_footer) |
|
859 ;----------------------------------------------- |
|
860 set_line(lines,nline,table_footer) |
|
861 set_line(lines,nline,footer) |
|
862 |
|
863 ; Now write to an HTML file. |
|
864 idx = ind(.not.ismissing(lines)) |
|
865 if(.not.any(ismissing(idx))) then |
|
866 asciiwrite(output_html,lines(idx)) |
|
867 else |
|
868 print ("error?") |
|
869 end if |
|
870 delete (idx) |
|
871 |
|
872 ;*************************************************************************** |
|
873 ; output plots |
|
874 ;*************************************************************************** |
|
875 output_dir = model_name+"/ameriflux" |
|
876 |
|
877 system("mv *.png *.html " + output_dir) |
|
878 ;*************************************************************************** |
|
879 end |