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