forrest@0: ;******************************************************** forrest@0: ; landfrac applied to area only. forrest@0: ; using model biome class forrest@0: ; forrest@0: ; required command line input parameters: forrest@0: ; ncl 'model_name="10cn" model_grid="T42" dirm="/.../ film="..."' 01.npp.ncl forrest@0: ; forrest@0: ; histogram normalized by rain and compute correleration forrest@0: ;************************************************************** forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" forrest@0: ;************************************************************** forrest@0: procedure set_line(lines:string,nline:integer,newlines:string) forrest@0: begin forrest@0: ; add line to ascci/html file forrest@0: forrest@0: nnewlines = dimsizes(newlines) forrest@0: if(nline+nnewlines-1.ge.dimsizes(lines)) forrest@0: print("set_line: bad index, not setting anything.") forrest@0: return forrest@0: end if forrest@0: lines(nline:nline+nnewlines-1) = newlines forrest@0: ; print ("lines = " + lines(nline:nline+nnewlines-1)) forrest@0: nline = nline + nnewlines forrest@0: return forrest@0: end forrest@0: ;************************************************************** forrest@0: ; Main code. forrest@0: begin forrest@0: ;-------------------------------------------------- forrest@0: ; edit table.html of current model for movel1_vs_model2 forrest@0: forrest@0: if (isvar("compare")) then forrest@0: html_name2 = compare+"/table.html" forrest@0: html_new2 = html_name2 +".new" forrest@0: end if forrest@0: forrest@0: ;------------------------------------- forrest@0: ; edit table.html for current model forrest@0: forrest@0: html_name = model_name+"/table.html" forrest@0: html_new = html_name +".new" forrest@0: forrest@0: ;--------------------------------------------------- forrest@0: ; add total score and update metric table forrest@0: forrest@0: M_save = 0. forrest@0: forrest@0: if (isfilepresent("M_save.npp")) then forrest@0: M_save = M_save + asciiread("M_save.npp",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.lai")) then forrest@0: M_save = M_save + asciiread("M_save.lai",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (film3 .ne. "") then forrest@0: if (isfilepresent("M_save.co2")) then forrest@0: M_save = M_save + asciiread("M_save.co2",(/1/),"float") forrest@0: end if forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.biomass")) then forrest@0: M_save = M_save + asciiread("M_save.biomass",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.fluxnet")) then forrest@0: M_save = M_save + asciiread("M_save.fluxnet",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.beta")) then forrest@0: M_save = M_save + asciiread("M_save.beta",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.fire")) then forrest@0: M_save = M_save + asciiread("M_save.fire",(/1/),"float") forrest@0: end if forrest@0: forrest@0: if (isfilepresent("M_save.ameriflux")) then forrest@0: M_save = M_save + asciiread("M_save.ameriflux",(/1/),"float") forrest@0: end if forrest@0: forrest@0: M_total = sprintf("%.2f", M_save) forrest@0: forrest@0: if (isvar("compare")) then forrest@0: system("sed -e '1,/M_total/s/M_total/"+M_total+"/' "+html_name2+" > "+html_new2+";"+ \ forrest@0: "mv -f "+html_new2+" "+html_name2) forrest@0: end if forrest@0: forrest@0: system("sed s#M_total#"+M_total+"# "+html_name+" > "+html_new+";"+ \ forrest@0: "mv -f "+html_new+" "+html_name+";"+ \ forrest@0: "rm M_save.*") forrest@0: end forrest@0: