all/99.final.ncl
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/all/99.final.ncl	Mon Jan 26 22:08:20 2009 -0500
     1.3 @@ -0,0 +1,95 @@
     1.4 +;********************************************************
     1.5 +; landfrac applied to area only.
     1.6 +; using model biome class
     1.7 +;
     1.8 +; required command line input parameters:
     1.9 +;  ncl 'model_name="10cn" model_grid="T42" dirm="/.../ film="..."' 01.npp.ncl
    1.10 +;
    1.11 +; histogram normalized by rain and compute correleration
    1.12 +;**************************************************************
    1.13 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    1.14 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
    1.15 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
    1.16 +;**************************************************************
    1.17 +procedure set_line(lines:string,nline:integer,newlines:string) 
    1.18 +begin
    1.19 +; add line to ascci/html file
    1.20 +    
    1.21 +  nnewlines = dimsizes(newlines)
    1.22 +  if(nline+nnewlines-1.ge.dimsizes(lines))
    1.23 +    print("set_line: bad index, not setting anything.") 
    1.24 +    return
    1.25 +  end if 
    1.26 +  lines(nline:nline+nnewlines-1) = newlines
    1.27 +;  print ("lines = " + lines(nline:nline+nnewlines-1))
    1.28 +  nline = nline + nnewlines
    1.29 +  return 
    1.30 +end
    1.31 +;**************************************************************
    1.32 +; Main code.
    1.33 +begin
    1.34 +;--------------------------------------------------
    1.35 +; edit table.html of current model for movel1_vs_model2
    1.36 +
    1.37 + if (isvar("compare")) then
    1.38 +    html_name2 = compare+"/table.html"  
    1.39 +    html_new2  = html_name2 +".new"
    1.40 + end if
    1.41 +
    1.42 +;-------------------------------------
    1.43 +; edit table.html for current model
    1.44 +
    1.45 + html_name = model_name+"/table.html"  
    1.46 + html_new  = html_name +".new"
    1.47 +
    1.48 +;---------------------------------------------------
    1.49 +; add total score and update metric table
    1.50 +
    1.51 +  M_save = 0.
    1.52 +
    1.53 +  if (isfilepresent("M_save.npp")) then
    1.54 +     M_save = M_save + asciiread("M_save.npp",(/1/),"float")
    1.55 +  end if
    1.56 +
    1.57 +  if (isfilepresent("M_save.lai")) then
    1.58 +     M_save = M_save + asciiread("M_save.lai",(/1/),"float")
    1.59 +  end if 
    1.60 +
    1.61 +  if (film3 .ne. "") then
    1.62 +  if (isfilepresent("M_save.co2")) then
    1.63 +     M_save = M_save + asciiread("M_save.co2",(/1/),"float")
    1.64 +  end if
    1.65 +  end if
    1.66 +
    1.67 +  if (isfilepresent("M_save.biomass")) then
    1.68 +     M_save = M_save + asciiread("M_save.biomass",(/1/),"float")
    1.69 +  end if
    1.70 +
    1.71 +  if (isfilepresent("M_save.fluxnet")) then
    1.72 +     M_save = M_save + asciiread("M_save.fluxnet",(/1/),"float")
    1.73 +  end if
    1.74 +
    1.75 +  if (isfilepresent("M_save.beta")) then
    1.76 +     M_save = M_save + asciiread("M_save.beta",(/1/),"float")
    1.77 +  end if
    1.78 +
    1.79 +  if (isfilepresent("M_save.fire")) then
    1.80 +     M_save = M_save + asciiread("M_save.fire",(/1/),"float")
    1.81 +  end if
    1.82 +
    1.83 +  if (isfilepresent("M_save.ameriflux")) then
    1.84 +     M_save = M_save + asciiread("M_save.ameriflux",(/1/),"float")
    1.85 +  end if
    1.86 +
    1.87 +  M_total = sprintf("%.2f", M_save)
    1.88 +
    1.89 +  if (isvar("compare")) then
    1.90 +     system("sed -e '1,/M_total/s/M_total/"+M_total+"/' "+html_name2+" > "+html_new2+";"+ \
    1.91 +            "mv -f "+html_new2+" "+html_name2)
    1.92 +  end if
    1.93 +
    1.94 +  system("sed s#M_total#"+M_total+"# "+html_name+" > "+html_new+";"+ \
    1.95 +         "mv -f "+html_new+" "+html_name+";"+ \
    1.96 +         "rm M_save.*")
    1.97 +end
    1.98 +