1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/ameriflux/10.plot.ncl Mon Jan 26 22:08:20 2009 -0500
1.3 @@ -0,0 +1,575 @@
1.4 +;************************************************************
1.5 +; required command line input parameters:
1.6 +; ncl 'model_name="10cn" model_grid="T42" dirm="/.../ film="..."' 01.npp.ncl
1.7 +;
1.8 +; using gsn_table for all
1.9 +; output: line plot for each site (4 fields)
1.10 +; table for M_score
1.11 +;************************************************************
1.12 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
1.13 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
1.14 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
1.15 +;************************************************************
1.16 +procedure set_line(lines:string,nline:integer,newlines:string)
1.17 +begin
1.18 +; add line to ascci/html file
1.19 +
1.20 + nnewlines = dimsizes(newlines)
1.21 + if(nline+nnewlines-1.ge.dimsizes(lines))
1.22 + print("set_line: bad index, not setting anything.")
1.23 + return
1.24 + end if
1.25 + lines(nline:nline+nnewlines-1) = newlines
1.26 +; print ("lines = " + lines(nline:nline+nnewlines-1))
1.27 + nline = nline + nnewlines
1.28 + return
1.29 +end
1.30 +;*************************************************************
1.31 +begin
1.32 +
1.33 + plot_type = "ps"
1.34 + plot_type_new = "png"
1.35 +
1.36 +; for 6 fields, 12-monthly
1.37 + nmon = 12
1.38 + nfield = 6
1.39 +
1.40 +;************************************************
1.41 +; read model data
1.42 +;************************************************
1.43 +; model = "cn"
1.44 + model = "casa"
1.45 +
1.46 + model_name = "i01.10" + model
1.47 +
1.48 + dirm = "/fis/cgd/cseg/people/jeff/surface_data/"
1.49 + film = "lnd_T42.nc"
1.50 + fm = addfile(dirm+film,"r")
1.51 +
1.52 + xm = fm->lon
1.53 + ym = fm->lat
1.54 +;------------------------------------------------
1.55 + nlat = dimsizes(ym)
1.56 + nlon = dimsizes(xm)
1.57 +
1.58 + data_mod0 = new ((/nfield,nmon,nlat,nlon/),float)
1.59 +
1.60 +; change to unit of observed (u mol/m2/s)
1.61 +; Model_units [=] gC/m2/s
1.62 +; 12. = molecular weight of C
1.63 +; u mol = 1e-6 mol
1.64 + factor = 1e6 /12.
1.65 +
1.66 + ENERGY ="new"
1.67 +
1.68 +;************************************************
1.69 +; read data: observed
1.70 +;************************************************
1.71 +
1.72 + station = (/"HarvardForest" \
1.73 + /)
1.74 +
1.75 + year_ob = (/"1991-2004" \
1.76 + /)
1.77 +
1.78 + field = (/"CO2 Flux" \
1.79 + ,"Net Radiation" \
1.80 + ,"Latent Heat" \
1.81 + ,"Sensible Heat" \
1.82 + ,"GPP Flux" \
1.83 + ,"Respiration" \
1.84 + /)
1.85 +
1.86 + nstation = dimsizes(station)
1.87 +
1.88 + data_mod = new ((/nstation, nfield, nmon/),float)
1.89 + data_ob = new ((/nstation, nfield, nmon/),float)
1.90 + lat_ob = new ((/nstation/),float)
1.91 + lon_ob = new ((/nstation/),float)
1.92 +
1.93 + diro_root = "/fis/cgd/cseg/people/jeff/clamp/ameriflux/"
1.94 + dirm_root = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
1.95 +
1.96 + do n = 0,nstation-1
1.97 +
1.98 +;-------------------------------------------------
1.99 +; get ob data
1.100 +
1.101 + diro = diro_root + station(n)+"/"
1.102 + filo = station(n)+"_"+year_ob(n)+"_monthly.nc"
1.103 + fo = addfile (diro+filo,"r")
1.104 +
1.105 + print (filo)
1.106 +
1.107 + lon_ob(n) = fo->lon
1.108 + lat_ob(n) = fo->lat
1.109 +
1.110 + data = fo->NEE_or_fMDS
1.111 + data_ob(n,0,:) = dim_avg(data(month|:,year|:))
1.112 + delete (data)
1.113 +
1.114 + data = fo->Rg_f
1.115 + data_ob(n,1,:) = dim_avg(data(month|:,year|:))
1.116 + delete (data)
1.117 +
1.118 + data = fo->LE_f
1.119 + data_ob(n,2,:) = dim_avg(data(month|:,year|:))
1.120 + delete (data)
1.121 +
1.122 + data = fo->H_f
1.123 + data_ob(n,3,:) = dim_avg(data(month|:,year|:))
1.124 + delete (data)
1.125 +
1.126 + data = fo->GPP_or_MDS
1.127 + data_ob(n,4,:) = dim_avg(data(month|:,year|:))
1.128 + delete (data)
1.129 +
1.130 + data = fo->Reco_or
1.131 + data_ob(n,5,:) = dim_avg(data(month|:,year|:))
1.132 + delete (data)
1.133 +
1.134 + delete (fo)
1.135 +;---------------------------------------------------
1.136 +; get model data
1.137 +
1.138 + film = model_name+"_"+year_ob(n)+"_MONS_climo.nc"
1.139 + fm = addfile (dirm_root+film,"r")
1.140 +
1.141 + print (film)
1.142 +
1.143 +if (ENERGY .eq. "old") then
1.144 +
1.145 + data = fm->NEE
1.146 + data_mod0(0,:,:,:) = data(:,:,:) * factor
1.147 + delete (data)
1.148 +
1.149 +; data = fm->LATENT
1.150 + data1 = fm->FCEV
1.151 + data2 = fm->FCTR
1.152 + data3 = fm->FGEV
1.153 + data_mod0(2,:,:,:) = data1(:,:,:)+data2(:,:,:)+data3(:,:,:)
1.154 + delete (data1)
1.155 + delete (data2)
1.156 + delete (data3)
1.157 +
1.158 +; data = fm->SENSIBLE
1.159 + data = fm->FSH
1.160 + data_mod0(3,:,:,:) = data(:,:,:)
1.161 + delete (data)
1.162 +
1.163 +; data = fm->NETRAD
1.164 + data1 = fm->FSA
1.165 + data2 = fm->FIRA
1.166 + data_mod0(1,:,:,:) = data1(:,:,:)-data2(:,:,:)-data_mod0(2,:,:,:)-data_mod0(3,:,:,:)
1.167 + delete (data1)
1.168 + delete (data2)
1.169 +
1.170 +else
1.171 +
1.172 + data = fm->NEE
1.173 + data_mod0(0,:,:,:) = data(:,:,:) * factor
1.174 + delete (data)
1.175 +
1.176 + data = fm->NETRAD
1.177 + data_mod0(1,:,:,:) = data(:,:,:)
1.178 + delete (data)
1.179 +
1.180 + data = fm->LATENT
1.181 + data_mod0(2,:,:,:) = data(:,:,:)
1.182 + delete (data)
1.183 +
1.184 +; data = fm->SENSIBLE
1.185 + data = fm->FSH
1.186 + data_mod0(3,:,:,:) = data(:,:,:)
1.187 + delete (data)
1.188 +end if
1.189 +
1.190 + data = fm->GPP
1.191 + data_mod0(4,:,:,:) = data(:,:,:) * factor
1.192 + delete (data)
1.193 +
1.194 + if (model .eq. "cn") then
1.195 + data = fm->ER
1.196 + else
1.197 + data1 = fm->AR
1.198 + data2 = fm->HR
1.199 + data = data1 + data2
1.200 +
1.201 + delete (data1)
1.202 + delete (data2)
1.203 + end if
1.204 +
1.205 + data_mod0(5,:,:,:) = data(:,:,:) * factor
1.206 + delete (data)
1.207 +
1.208 + delete (fm)
1.209 +
1.210 +;************************************************************
1.211 +; interpolate model data into observed station
1.212 +; note: model is 0-360E, 90S-90N
1.213 +;************************************************************
1.214 +
1.215 +; to be able to handle observation at (-89.98,-24.80)
1.216 + ym(0) = -90.
1.217 +
1.218 + yy = linint2_points_Wrap(xm,ym,data_mod0,True,lon_ob(n),lat_ob(n),0)
1.219 +
1.220 +; print (yy)
1.221 +
1.222 + data_mod(n,:,:) = yy(:,:,0)
1.223 +
1.224 + delete (yy)
1.225 +
1.226 + end do
1.227 +;************************************************************
1.228 +; compute correlation coef and M score
1.229 +;************************************************************
1.230 +
1.231 + score_max = 5.
1.232 +
1.233 + ccr = new ((/nstation, nfield/),float)
1.234 + M_score = new ((/nstation, nfield/),float)
1.235 +
1.236 + do n=0,nstation-1
1.237 + do m=0,nfield-1
1.238 + ccr(n,m) = esccr(data_ob(n,m,:),data_mod(n,m,:),0)
1.239 + bias = sum(abs(data_mod(n,m,:)-data_ob(n,m,:))/(abs(data_mod(n,m,:))+abs(data_ob(n,m,:))))
1.240 + M_score(n,m) = (1. -(bias/nmon)) * score_max
1.241 + end do
1.242 + end do
1.243 +
1.244 + M_co2 = avg(M_score(:,0))
1.245 + M_rad = avg(M_score(:,1))
1.246 + M_lh = avg(M_score(:,2))
1.247 + M_sh = avg(M_score(:,3))
1.248 + M_gpp = avg(M_score(:,4))
1.249 + M_er = avg(M_score(:,5))
1.250 + M_all = M_co2+ M_rad +M_lh + M_sh + M_gpp + M_er
1.251 +
1.252 + M_energy_co2 = sprintf("%.2f", M_co2)
1.253 + M_energy_rad = sprintf("%.2f", M_rad)
1.254 + M_energy_lh = sprintf("%.2f", M_lh )
1.255 + M_energy_sh = sprintf("%.2f", M_sh )
1.256 + M_energy_gpp = sprintf("%.2f", M_gpp)
1.257 + M_energy_er = sprintf("%.2f", M_er )
1.258 + M_energy_all = sprintf("%.2f", M_all)
1.259 +
1.260 +;*******************************************************************
1.261 +; for station line plot
1.262 +;*******************************************************************
1.263 +
1.264 +; for x-axis in xyplot
1.265 + mon = ispan(1,12,1)
1.266 + mon@long_name = "month"
1.267 +
1.268 + res = True ; plot mods desired
1.269 + res@xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker
1.270 + res@xyLineColors = (/"blue","red"/) ; line color (ob,model)
1.271 +;-------------------------------------------------------------------------
1.272 +; Add a boxed legend using the more simple method
1.273 +
1.274 + res@pmLegendDisplayMode = "Always"
1.275 +; res@pmLegendWidthF = 0.1
1.276 + res@pmLegendWidthF = 0.08
1.277 + res@pmLegendHeightF = 0.06
1.278 +; res@pmLegendOrthogonalPosF = -1.17
1.279 +; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
1.280 + res@pmLegendOrthogonalPosF = -0.30 ;(downward)
1.281 +
1.282 +; res@pmLegendParallelPosF = 0.18
1.283 + res@pmLegendParallelPosF = 0.23 ;(rightward)
1.284 +
1.285 +; res@lgPerimOn = False
1.286 + res@lgLabelFontHeightF = 0.015
1.287 + res@xyExplicitLegendLabels = (/"observed",model_name/)
1.288 +;-------------------------------------------------------------------
1.289 +; for panel plot
1.290 + res@gsnFrame = False ; Do not draw plot
1.291 + res@gsnDraw = False ; Do not advance frame
1.292 +
1.293 + pres = True ; panel plot mods desired
1.294 + pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
1.295 + ; indiv. plots in panel
1.296 + pres@gsnMaximize = True ; fill the page
1.297 +;-------------------------------------------------------------------
1.298 +
1.299 + plot_data = new((/2,12/),float)
1.300 + plot_data!0 = "case"
1.301 + plot_data!1 = "month"
1.302 +
1.303 + do n = 0,nstation-1
1.304 +;----------------------------
1.305 +; for observed
1.306 +
1.307 + plot_name = station(n)+"_ob"
1.308 + title = station(n)+"("+sprintf("%5.2f",lat_ob(n))+","+sprintf("%5.2f",lon_ob(n))+")"
1.309 + res@tiMainString = title
1.310 +
1.311 + wks = gsn_open_wks (plot_type,plot_name)
1.312 + plot=new(nfield,graphic) ; create graphic array
1.313 +
1.314 + plot_data(0,:) = (/data_ob (n,0,:)/)
1.315 + plot_data@long_name = field(0)
1.316 + plot(0)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 1
1.317 +
1.318 + plot_data(0,:) = (/data_ob (n,1,:)/)
1.319 + plot_data@long_name = field(1)
1.320 + plot(1)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 2
1.321 +
1.322 + plot_data(0,:) = (/data_ob (n,2,:)/)
1.323 + plot_data@long_name = field(2)
1.324 + plot(2)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 3
1.325 +
1.326 + plot_data(0,:) = (/data_ob (n,3,:)/)
1.327 + plot_data@long_name = field(3)
1.328 + plot(3)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 4
1.329 +
1.330 + plot_data(0,:) = (/data_ob (n,4,:)/)
1.331 + plot_data@long_name = field(4)
1.332 + plot(4)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 5
1.333 +
1.334 + plot_data(0,:) = (/data_ob (n,5,:)/)
1.335 + plot_data@long_name = field(5)
1.336 + plot(5)=gsn_csm_xy(wks,mon,plot_data(0,:),res) ; create plot 6
1.337 +
1.338 + gsn_panel(wks,plot,(/3,2/),pres) ; create panel plot
1.339 +
1.340 + system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
1.341 + "rm "+plot_name+"."+plot_type)
1.342 +
1.343 + clear (wks)
1.344 + delete (plot)
1.345 +;----------------------------
1.346 +; for model_vs_ob
1.347 +
1.348 + plot_name = station(n)+"_model_vs_ob"
1.349 + title = station(n)+"("+sprintf("%5.2f",lat_ob(n))+","+sprintf("%5.2f",lon_ob(n))+")"
1.350 + res@tiMainString = title
1.351 +
1.352 + wks = gsn_open_wks (plot_type,plot_name)
1.353 + plot=new(nfield,graphic) ; create graphic array
1.354 +
1.355 + plot_data(0,:) = (/data_ob (n,0,:)/)
1.356 + plot_data(1,:) = (/data_mod(n,0,:)/)
1.357 + plot_data@long_name = field(0)
1.358 + plot(0)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 1
1.359 +
1.360 + plot_data(0,:) = (/data_ob (n,1,:)/)
1.361 + plot_data(1,:) = (/data_mod(n,1,:)/)
1.362 + plot_data@long_name = field(1)
1.363 + plot(1)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 2
1.364 +
1.365 + plot_data(0,:) = (/data_ob (n,2,:)/)
1.366 + plot_data(1,:) = (/data_mod(n,2,:)/)
1.367 + plot_data@long_name = field(2)
1.368 + plot(2)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 3
1.369 +
1.370 + plot_data(0,:) = (/data_ob (n,3,:)/)
1.371 + plot_data(1,:) = (/data_mod(n,3,:)/)
1.372 + plot_data@long_name = field(3)
1.373 + plot(3)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 4
1.374 +
1.375 +
1.376 + plot_data(0,:) = (/data_ob (n,4,:)/)
1.377 + plot_data(1,:) = (/data_mod(n,4,:)/)
1.378 + plot_data@long_name = field(4)
1.379 + plot(4)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 5
1.380 +
1.381 +
1.382 + plot_data(0,:) = (/data_ob (n,5,:)/)
1.383 + plot_data(1,:) = (/data_mod(n,5,:)/)
1.384 + plot_data@long_name = field(5)
1.385 + plot(5)=gsn_csm_xy(wks,mon,plot_data,res) ; create plot 6
1.386 +
1.387 + gsn_panel(wks,plot,(/3,2/),pres) ; create panel plot
1.388 +
1.389 + system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new+";"+ \
1.390 + "rm "+plot_name+"."+plot_type)
1.391 +
1.392 + clear (wks)
1.393 + delete (plot)
1.394 + end do
1.395 +
1.396 +;*******************************************************************
1.397 +; html table of site: observed
1.398 +;*******************************************************************
1.399 + output_html = "line_ob.html"
1.400 +
1.401 + header = (/"<HTML>" \
1.402 + ,"<HEAD>" \
1.403 + ,"<TITLE>CLAMP metrics</TITLE>" \
1.404 + ,"</HEAD>" \
1.405 + ,"<H1>Energy at Site: Observation</H1>" \
1.406 + /)
1.407 + footer = "</HTML>"
1.408 +
1.409 + table_header = (/ \
1.410 + "<table border=1 cellspacing=0 cellpadding=3 width=60%>" \
1.411 + ,"<tr>" \
1.412 + ," <th bgcolor=DDDDDD >Site Name</th>" \
1.413 + ," <th bgcolor=DDDDDD >Latitude</th>" \
1.414 + ," <th bgcolor=DDDDDD >Longitude</th>" \
1.415 + ," <th bgcolor=DDDDDD >Observed</th>" \
1.416 + ,"</tr>" \
1.417 + /)
1.418 + table_footer = "</table>"
1.419 + row_header = "<tr>"
1.420 + row_footer = "</tr>"
1.421 +
1.422 + lines = new(50000,string)
1.423 + nline = 0
1.424 +
1.425 + set_line(lines,nline,header)
1.426 + set_line(lines,nline,table_header)
1.427 +;-----------------------------------------------
1.428 +; row of table
1.429 +
1.430 + do n = 0,nstation-1
1.431 + set_line(lines,nline,row_header)
1.432 +
1.433 + txt0 = station(n)
1.434 + txt1 = sprintf("%5.2f", lat_ob(n))
1.435 + txt2 = sprintf("%5.2f", lon_ob(n))
1.436 + txt3 = year_ob(n)
1.437 +
1.438 + set_line(lines,nline,"<th><a href="+txt0+"_ob.png>"+txt0+"</a></th>")
1.439 + set_line(lines,nline,"<th>"+txt1+"</th>")
1.440 + set_line(lines,nline,"<th>"+txt2+"</th>")
1.441 + set_line(lines,nline,"<th>"+txt3+"</th>")
1.442 +
1.443 + set_line(lines,nline,row_footer)
1.444 + end do
1.445 +;-----------------------------------------------
1.446 + set_line(lines,nline,table_footer)
1.447 + set_line(lines,nline,footer)
1.448 +
1.449 +; Now write to an HTML file.
1.450 + idx = ind(.not.ismissing(lines))
1.451 + if(.not.any(ismissing(idx))) then
1.452 + asciiwrite(output_html,lines(idx))
1.453 + else
1.454 + print ("error?")
1.455 + end if
1.456 + delete (idx)
1.457 +
1.458 +;*******************************************************************
1.459 +; score and line table : model vs observed
1.460 +;*******************************************************************
1.461 + output_html = "score+line_vs_ob.html"
1.462 +
1.463 + header = (/"<HTML>" \
1.464 + ,"<HEAD>" \
1.465 + ,"<TITLE>CLAMP metrics</TITLE>" \
1.466 + ,"</HEAD>" \
1.467 + ,"<H1>Energy at Site: Model "+model_name+"</H1>" \
1.468 + /)
1.469 + footer = "</HTML>"
1.470 +
1.471 + delete (table_header)
1.472 + table_header = (/ \
1.473 + "<table border=1 cellspacing=0 cellpadding=3 width=100%>" \
1.474 + ,"<tr>" \
1.475 + ," <th bgcolor=DDDDDD >Site Name</th>" \
1.476 + ," <th bgcolor=DDDDDD >Latitude</th>" \
1.477 + ," <th bgcolor=DDDDDD >Longitude</th>" \
1.478 + ," <th bgcolor=DDDDDD >Observed</th>" \
1.479 + ," <th bgcolor=DDDDDD >CO2 Flux</th>" \
1.480 + ," <th bgcolor=DDDDDD >Net Radiation</th>" \
1.481 + ," <th bgcolor=DDDDDD >Latent Heat</th>" \
1.482 + ," <th bgcolor=DDDDDD >Sensible Heat</th>" \
1.483 + ," <th bgcolor=DDDDDD >GPP Glux</th>" \
1.484 + ," <th bgcolor=DDDDDD >Respiration</th>" \
1.485 + ," <th bgcolor=DDDDDD >Average</th>" \
1.486 + ,"</tr>" \
1.487 + /)
1.488 + table_footer = "</table>"
1.489 + row_header = "<tr>"
1.490 + row_footer = "</tr>"
1.491 +
1.492 + lines = new(50000,string)
1.493 + nline = 0
1.494 +
1.495 + set_line(lines,nline,header)
1.496 + set_line(lines,nline,table_header)
1.497 +;-----------------------------------------------
1.498 +; row of table
1.499 +
1.500 + do n = 0,nstation-1
1.501 + set_line(lines,nline,row_header)
1.502 +
1.503 + txt0 = station(n)
1.504 + txt1 = sprintf("%5.2f", lat_ob(n))
1.505 + txt2 = sprintf("%5.2f", lon_ob(n))
1.506 + txt3 = year_ob(n)
1.507 + txt4 = sprintf("%5.2f", M_score(n,0))
1.508 + txt5 = sprintf("%5.2f", M_score(n,1))
1.509 + txt6 = sprintf("%5.2f", M_score(n,2))
1.510 + txt7 = sprintf("%5.2f", M_score(n,3))
1.511 + txt8 = sprintf("%5.2f", M_score(n,4))
1.512 + txt9 = sprintf("%5.2f", M_score(n,5))
1.513 + txt10 = sprintf("%5.2f", avg(M_score(n,:)))
1.514 +
1.515 + set_line(lines,nline,"<th><a href="+txt0+"_model_vs_ob.png>"+txt0+"</a></th>")
1.516 + set_line(lines,nline,"<th>"+txt1+"</th>")
1.517 + set_line(lines,nline,"<th>"+txt2+"</th>")
1.518 + set_line(lines,nline,"<th>"+txt3+"</th>")
1.519 + set_line(lines,nline,"<th>"+txt4+"</th>")
1.520 + set_line(lines,nline,"<th>"+txt5+"</th>")
1.521 + set_line(lines,nline,"<th>"+txt6+"</th>")
1.522 + set_line(lines,nline,"<th>"+txt7+"</th>")
1.523 + set_line(lines,nline,"<th>"+txt8+"</th>")
1.524 + set_line(lines,nline,"<th>"+txt9+"</th>")
1.525 + set_line(lines,nline,"<th>"+txt10+"</th>")
1.526 +
1.527 + set_line(lines,nline,row_footer)
1.528 + end do
1.529 +
1.530 +; last row, summary
1.531 + set_line(lines,nline,row_header)
1.532 +
1.533 + txt0 = "All_"+sprintf("%.0f", nstation)
1.534 + txt1 = "-"
1.535 + txt2 = "-"
1.536 + txt3 = "-"
1.537 + txt4 = M_energy_co2
1.538 + txt5 = M_energy_rad
1.539 + txt6 = M_energy_lh
1.540 + txt7 = M_energy_sh
1.541 + txt8 = M_energy_gpp
1.542 + txt9 = M_energy_er
1.543 + txt10 = M_energy_all
1.544 +
1.545 + set_line(lines,nline,"<th>"+txt0+"</th>")
1.546 + set_line(lines,nline,"<th>"+txt1+"</th>")
1.547 + set_line(lines,nline,"<th>"+txt2+"</th>")
1.548 + set_line(lines,nline,"<th>"+txt3+"</th>")
1.549 + set_line(lines,nline,"<th>"+txt4+"</th>")
1.550 + set_line(lines,nline,"<th>"+txt5+"</th>")
1.551 + set_line(lines,nline,"<th>"+txt6+"</th>")
1.552 + set_line(lines,nline,"<th>"+txt7+"</th>")
1.553 + set_line(lines,nline,"<th>"+txt8+"</th>")
1.554 + set_line(lines,nline,"<th>"+txt9+"</th>")
1.555 + set_line(lines,nline,"<th>"+txt10+"</th>")
1.556 +
1.557 + set_line(lines,nline,row_footer)
1.558 +;-----------------------------------------------
1.559 + set_line(lines,nline,table_footer)
1.560 + set_line(lines,nline,footer)
1.561 +
1.562 +; Now write to an HTML file.
1.563 + idx = ind(.not.ismissing(lines))
1.564 + if(.not.any(ismissing(idx))) then
1.565 + asciiwrite(output_html,lines(idx))
1.566 + else
1.567 + print ("error?")
1.568 + end if
1.569 + delete (idx)
1.570 +
1.571 +;***************************************************************************
1.572 +; output plots
1.573 +;***************************************************************************
1.574 + output_dir = model_name+"/ameriflux"
1.575 +
1.576 + system("mv *.png *.html " + output_dir)
1.577 +;***************************************************************************
1.578 +end