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