forrest@0: ;************************************************************* forrest@0: ; remove histogram plots. 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.test" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test" 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: plot_type = "ps" forrest@0: plot_type_new = "png" forrest@0: forrest@0: ;************************************************ forrest@0: ; read data: model forrest@0: ;************************************************ forrest@0: forrest@0: ;film = "b30.061n_1995-2004_MONS_climo_lnd.nc" forrest@0: ;model_name = "b30.061n" forrest@0: ;model_grid = "T31" forrest@0: forrest@0: ;film = "newcn05_ncep_1i_MONS_climo_lnd.nc" forrest@0: ;model_name = "newcn" forrest@0: ;model_grid = "1.9" forrest@0: forrest@0: ;film = "i01.06cn_1798-2004_MONS_climo.nc" forrest@0: ;model_name = "06cn" forrest@0: ;model_grid = "T42" forrest@0: forrest@0: ;film = "i01.06casa_1798-2004_MONS_climo.nc" forrest@0: ;model_name = "06casa" forrest@0: ;model_grid = "T42" forrest@0: forrest@0: film = "i01.10cn_1948-2004_MONS_climo.nc" forrest@0: model_name = "10cn" forrest@0: model_grid = "T42" forrest@0: forrest@0: ;film = "i01.10casa_1948-2004_MONS_climo.nc" forrest@0: ;model_name = "10casa" forrest@0: ;model_grid = "T42" forrest@0: forrest@0: dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/" forrest@0: fm = addfile(dirm+film,"r") forrest@0: forrest@0: laimod = fm->TLAI forrest@0: forrest@0: ;************************************************ forrest@0: ; read data: observed forrest@0: ;************************************************ forrest@0: forrest@0: ob_name = "MODIS MOD 15A2 2000-2005" forrest@0: forrest@0: diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/ob/" forrest@0: filo1 = "land_class_"+model_grid+".nc" forrest@0: filo2 = "LAI_2000-2005_MONS_"+model_grid+".nc" forrest@0: forrest@0: fo1 = addfile(diro+filo1,"r") forrest@0: fo2 = addfile(diro+filo2,"r") forrest@0: forrest@0: classob = tofloat(fo1->LAND_CLASS) forrest@0: laiob = fo2->LAI forrest@0: forrest@0: ; input observed data has 20 land-type classes forrest@0: nclass = 20 forrest@0: forrest@0: ;************************************************ forrest@0: ; global res forrest@0: ;************************************************ forrest@0: resg = True ; Use plot options forrest@0: resg@cnFillOn = True ; Turn on color fill forrest@0: resg@gsnSpreadColors = True ; use full colormap forrest@0: resg@cnLinesOn = False ; Turn off contourn lines forrest@0: resg@mpFillOn = False ; Turn off map fill forrest@0: resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals forrest@0: forrest@0: ;************************************************ forrest@0: ; plot global land class: observed forrest@0: ;************************************************ forrest@0: forrest@0: resg@cnMinLevelValF = 1. ; Min level forrest@0: resg@cnMaxLevelValF = 19. ; Max level forrest@0: resg@cnLevelSpacingF = 1. ; interval forrest@0: forrest@0: ; global contour ob forrest@0: classob@_FillValue = 1.e+36 forrest@0: classob = where(classob.eq.0,classob@_FillValue,classob) forrest@0: forrest@0: plot_name = "global_class_ob" forrest@0: title = ob_name forrest@0: resg@tiMainString = title forrest@0: forrest@0: wks = gsn_open_wks (plot_type,plot_name) ; open workstation forrest@0: gsn_define_colormap(wks,"gui_default") ; choose colormap forrest@0: forrest@0: plot = gsn_csm_contour_map_ce(wks,classob,resg) forrest@0: frame(wks) forrest@0: forrest@0: clear (wks) forrest@0: forrest@0: ;******************************************************************* forrest@0: ; for html table : all 4 components (Mean, Max, Phase, Growth) forrest@0: ;******************************************************************* forrest@0: forrest@0: ; column (not including header column) forrest@0: forrest@0: component = (/"Mean","Max","Phase","Growth"/) forrest@0: col_head2 = (/"observed",model_name,"M_score" \ forrest@0: ,"observed",model_name,"M_score" \ forrest@0: ,"observed",model_name,"M_score" \ forrest@0: ,"observed",model_name,"M_score" \ forrest@0: /) forrest@0: forrest@0: n_comp = dimsizes(component) forrest@0: ncol = dimsizes(col_head2) forrest@0: forrest@0: ; row (not including header row) forrest@0: row_head = (/"Evergreen Needleleaf Forests" \ forrest@0: ,"Evergreen Broadleaf Forests" \ forrest@0: ,"Deciduous Needleleaf Forest" \ forrest@0: ,"Deciduous Broadleaf Forests" \ forrest@0: ,"Mixed Forests" \ forrest@0: ,"Closed Bushlands" \ forrest@0: ,"Open Bushlands" \ forrest@0: ,"Woody Savannas (S. Hem.)" \ forrest@0: ,"Savannas (S. Hem.)" \ forrest@0: ,"Grasslands" \ forrest@0: ,"Permanent Wetlands" \ forrest@0: ,"Croplands" \ forrest@0: ,"Cropland/Natural Vegetation Mosaic" \ forrest@0: ,"Barren or Sparsely Vegetated" \ forrest@0: ,"Woody Savannas (N. Hem.)" \ forrest@0: ,"Savannas (N. Hem.)" \ forrest@0: ,"All Biome" \ forrest@0: /) forrest@0: nrow = dimsizes(row_head) forrest@0: forrest@0: ; arrays to be passed to table. forrest@0: text4 = new ((/nrow, ncol/),string ) forrest@0: forrest@0: ; M_comp forrest@0: M_comp = (/"M_lai_mean","M_lai_max","M_lai_phase","M_lai_grow"/) forrest@0: forrest@0: ; total M_score forrest@0: M_total = 0. forrest@0: forrest@0: ;******************************************************************** forrest@0: ; use land-type class to bin the data in equally spaced ranges forrest@0: ;******************************************************************** forrest@0: forrest@0: nclassn = nclass + 1 forrest@0: range = fspan(0,nclassn-1,nclassn) forrest@0: ; print (range) forrest@0: forrest@0: ; Use this range information to grab all the values in a forrest@0: ; particular range, and then take an average. forrest@0: forrest@0: nr = dimsizes(range) forrest@0: nx = nr-1 forrest@0: xvalues = new((/2,nx/),float) forrest@0: xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2. forrest@0: dx = xvalues(0,1) - xvalues(0,0) ; range width forrest@0: dx4 = dx/4 ; 1/4 of the range forrest@0: xvalues(1,:) = xvalues(0,:) - dx/5. forrest@0: forrest@0: ;************************************************************************ forrest@0: ; go through all components forrest@0: ;************************************************************************ forrest@0: forrest@0: do n = 0,n_comp-1 forrest@0: forrest@0: ;=================== forrest@0: ; get data: forrest@0: ;=================== forrest@0: ; (A) Mean forrest@0: forrest@0: if (n .eq. 0) then forrest@0: data_ob = dim_avg_Wrap(laiob (lat|:,lon|:,time|:)) forrest@0: data_mod = dim_avg_Wrap(laimod(lat|:,lon|:,time|:)) forrest@0: end if forrest@0: forrest@0: ; (B) Max forrest@0: forrest@0: if (n .eq. 1) then forrest@0: forrest@0: ; observed forrest@0: data_ob = laiob(0,:,:) forrest@0: s = laiob(:,0,0) forrest@0: data_ob@long_name = "Leaf Area Index Max" forrest@0: forrest@0: dsizes_z = dimsizes(laiob) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: s = laiob(:,j,i) forrest@0: data_ob(j,i) = max(s) forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (s) forrest@0: delete (dsizes_z) forrest@0: forrest@0: ; model forrest@0: data_mod = laimod(0,:,:) forrest@0: s = laimod(:,0,0) forrest@0: data_mod@long_name = "Leaf Area Index Max" forrest@0: forrest@0: dsizes_z = dimsizes(laimod) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: s = laimod(:,j,i) forrest@0: data_mod(j,i) = max(s) forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (s) forrest@0: delete (dsizes_z) forrest@0: end if forrest@0: forrest@0: ; (C) phase forrest@0: forrest@0: if (n .eq. 2) then forrest@0: forrest@0: ; observed forrest@0: data_ob = laiob(0,:,:) forrest@0: s = laiob(:,0,0) forrest@0: data_ob@long_name = "Leaf Area Index Max Month" forrest@0: forrest@0: dsizes_z = dimsizes(laiob) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: s = laiob(:,j,i) forrest@0: data_ob(j,i) = maxind(s) + 1 forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (s) forrest@0: delete (dsizes_z) forrest@0: forrest@0: ; model forrest@0: data_mod = laimod(0,:,:) forrest@0: s = laimod(:,0,0) forrest@0: data_mod@long_name = "Leaf Area Index Max Month" forrest@0: forrest@0: dsizes_z = dimsizes(laimod) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: s = laimod(:,j,i) forrest@0: data_mod(j,i) = maxind(s) + 1 forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (s) forrest@0: delete (dsizes_z) forrest@0: end if forrest@0: forrest@0: ; (D) grow day forrest@0: forrest@0: if (n .eq. 3) then forrest@0: forrest@0: day_of_data = (/31,28,31,30,31,30,31,31,30,31,30,31/) forrest@0: forrest@0: ; observed forrest@0: data_ob = laiob(0,:,:) forrest@0: data_ob@long_name = "Days of Growing Season" forrest@0: forrest@0: dsizes_z = dimsizes(laiob) forrest@0: ntime = dsizes_z(0) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: nday = 0. forrest@0: do k = 0,ntime-1 forrest@0: if (.not. ismissing(laiob(k,j,i)) .and. laiob(k,j,i) .gt. 1.0) then forrest@0: nday = nday + day_of_data(k) forrest@0: end if forrest@0: end do forrest@0: forrest@0: data_ob(j,i) = nday forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (dsizes_z) forrest@0: forrest@0: ; model forrest@0: data_mod = laimod(0,:,:) forrest@0: data_mod@long_name = "Days of Growing Season" forrest@0: forrest@0: dsizes_z = dimsizes(laimod) forrest@0: ntime = dsizes_z(0) forrest@0: nlat = dsizes_z(1) forrest@0: nlon = dsizes_z(2) forrest@0: forrest@0: do j = 0,nlat-1 forrest@0: do i = 0,nlon-1 forrest@0: nday = 0. forrest@0: do k = 0,ntime-1 forrest@0: if (.not. ismissing(laimod(k,j,i)) .and. laimod(k,j,i) .gt. 1.0) then forrest@0: nday = nday + day_of_data(k) forrest@0: end if forrest@0: end do forrest@0: forrest@0: data_mod(j,i) = nday forrest@0: end do forrest@0: end do forrest@0: forrest@0: delete (dsizes_z) forrest@0: end if forrest@0: forrest@0: ;============================== forrest@0: ; put data into bins forrest@0: ;============================== forrest@0: forrest@0: base_1D = ndtooned(classob) forrest@0: data1_1D = ndtooned(data_ob) forrest@0: data2_1D = ndtooned(data_mod) forrest@0: forrest@0: ; output for data in bins forrest@0: forrest@0: yvalues = new((/2,nx/),float) forrest@0: count = new((/2,nx/),float) forrest@0: forrest@0: ; put data into bins forrest@0: forrest@0: do nd=0,1 forrest@0: forrest@0: ; See if we are doing data1 (nd=0) or data2 (nd=1). forrest@0: forrest@0: base = base_1D forrest@0: forrest@0: if(nd.eq.0) then forrest@0: data = data1_1D forrest@0: else forrest@0: data = data2_1D forrest@0: end if forrest@0: forrest@0: ; Loop through each range, using base. forrest@0: forrest@0: do i=0,nr-2 forrest@0: if (i.ne.(nr-2)) then forrest@0: ; print("") forrest@0: ; print("In range ["+range(i)+","+range(i+1)+")") forrest@0: idx = ind((base.ge.range(i)).and.(base.lt.range(i+1))) forrest@0: else forrest@0: ; print("") forrest@0: ; print("In range ["+range(i)+",)") forrest@0: idx = ind(base.ge.range(i)) forrest@0: end if forrest@0: forrest@0: ; Calculate average forrest@0: forrest@0: if(.not.any(ismissing(idx))) then forrest@0: yvalues(nd,i) = avg(data(idx)) forrest@0: count(nd,i) = dimsizes(idx) forrest@0: else forrest@0: yvalues(nd,i) = yvalues@_FillValue forrest@0: count(nd,i) = 0 forrest@0: end if forrest@0: forrest@0: ;############################################################# forrest@0: ; set the following 4 classes to _FillValue: forrest@0: ; Water Bodies(0), Urban and Build-Up(13), forrest@0: ; Permenant Snow and Ice(15), Unclassified(17) forrest@0: forrest@0: if (i.eq.0 .or. i.eq.13 .or. i.eq.15 .or. i.eq.17) then forrest@0: yvalues(nd,i) = yvalues@_FillValue forrest@0: count(nd,i) = 0 forrest@0: end if forrest@0: ;############################################################# forrest@0: forrest@0: ; print(nd + ": " + count(nd,i) + " points, avg = " + yvalues(nd,i)) forrest@0: forrest@0: ; Clean up for next time in loop. forrest@0: forrest@0: delete(idx) forrest@0: end do forrest@0: forrest@0: delete(data) forrest@0: end do forrest@0: forrest@0: delete (base) forrest@0: delete (base_1D) forrest@0: delete (data1_1D) forrest@0: delete (data2_1D) forrest@0: forrest@0: ;===================================== forrest@0: ; compute correlation coef and M score forrest@0: ;===================================== forrest@0: forrest@0: u = yvalues(0,:) forrest@0: v = yvalues(1,:) forrest@0: forrest@0: good = ind(.not.ismissing(u) .and. .not.ismissing(v)) forrest@0: uu = u(good) forrest@0: vv = v(good) forrest@0: forrest@0: ; compute correlation coef forrest@0: cc = esccr(uu,vv,0) forrest@0: forrest@0: if (n .eq. 2) then forrest@0: bias = avg(abs(vv-uu)) forrest@0: bias = where((bias.gt. 6.),12.-bias,bias) forrest@0: Mscore = ((6. - bias)/6.)*5. forrest@0: M_score = sprintf("%.2f", Mscore) forrest@0: else forrest@0: bias = sum(abs(vv-uu)/abs(vv+uu)) forrest@0: Mscore = (1.- (bias/dimsizes(uu)))*5. forrest@0: M_score = sprintf("%.2f", Mscore) forrest@0: end if forrest@0: forrest@0: ; compute M_total forrest@0: forrest@0: M_total = M_total + Mscore forrest@0: forrest@0: ;================== forrest@0: ; output M_score forrest@0: ;================== forrest@0: forrest@0: print (Mscore) forrest@0: ;======================= forrest@0: ; output to html table forrest@0: ;======================= forrest@0: forrest@0: nn = n*3 forrest@0: forrest@0: do i=0,nrow-2 forrest@0: text4(i,nn) = sprintf("%.2f",u(i)) forrest@0: text4(i,nn+1) = sprintf("%.2f",v(i)) forrest@0: text4(i,nn+2) = "-" forrest@0: end do forrest@0: text4(nrow-1,nn) = sprintf("%.2f",avg(u)) forrest@0: text4(nrow-1,nn+1) = sprintf("%.2f",avg(v)) forrest@0: text4(nrow-1,nn+2) = M_score forrest@0: forrest@0: delete (u) forrest@0: delete (v) forrest@0: delete (uu) forrest@0: delete (vv) forrest@0: delete (yvalues) forrest@0: delete (good) forrest@0: forrest@0: ;======================================== forrest@0: ; global res changes for each component forrest@0: ;======================================== forrest@0: delta = 0.00001 forrest@0: forrest@0: if (n .eq. 0) then forrest@0: resg@cnMinLevelValF = 0. forrest@0: resg@cnMaxLevelValF = 10. forrest@0: resg@cnLevelSpacingF = 1. forrest@0: forrest@0: data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob) forrest@0: end if forrest@0: forrest@0: if (n .eq. 1) then forrest@0: resg@cnMinLevelValF = 0. forrest@0: resg@cnMaxLevelValF = 10. forrest@0: resg@cnLevelSpacingF = 1. forrest@0: forrest@0: data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob) forrest@0: end if forrest@0: forrest@0: if (n .eq. 2) then forrest@0: resg@cnMinLevelValF = 1. forrest@0: resg@cnMaxLevelValF = 12. forrest@0: resg@cnLevelSpacingF = 1. forrest@0: forrest@0: data_ob = where(ismissing(data_ob).and.(ismissing(data_mod).or.(data_mod.lt.delta)),0.,data_ob) forrest@0: end if forrest@0: forrest@0: if (n .eq. 3) then forrest@0: resg@cnMinLevelValF = 60. forrest@0: resg@cnMaxLevelValF = 360. forrest@0: resg@cnLevelSpacingF = 20. forrest@0: forrest@0: data_ob@_FillValue = 1.e+36 forrest@0: data_ob = where(data_ob .lt. 10.,data_ob@_FillValue,data_ob) forrest@0: forrest@0: data_mod@_FillValue = 1.e+36 forrest@0: data_mod = where(data_mod .lt. 10.,data_mod@_FillValue,data_mod) forrest@0: end if forrest@0: forrest@0: ;========================= forrest@0: ; global contour : ob forrest@0: ;========================= forrest@0: forrest@0: plot_name = "global_"+component(n)+"_ob" forrest@0: title = ob_name forrest@0: resg@tiMainString = title forrest@0: forrest@0: wks = gsn_open_wks (plot_type,plot_name) ; open workstation forrest@0: gsn_define_colormap(wks,"gui_default") ; choose colormap forrest@0: forrest@0: plot = gsn_csm_contour_map_ce(wks,data_ob,resg) forrest@0: frame(wks) forrest@0: forrest@0: clear (wks) forrest@0: delete (plot) forrest@0: forrest@0: ;============================ forrest@0: ; global contour : model forrest@0: ;============================ forrest@0: forrest@0: plot_name = "global_"+component(n)+"_model" forrest@0: title = "Model " + model_name forrest@0: resg@tiMainString = title forrest@0: forrest@0: wks = gsn_open_wks (plot_type,plot_name) forrest@0: gsn_define_colormap(wks,"gui_default") forrest@0: forrest@0: plot = gsn_csm_contour_map_ce(wks,data_mod,resg) forrest@0: frame(wks) forrest@0: forrest@0: clear (wks) forrest@0: delete (plot) forrest@0: forrest@0: ;================================ forrest@0: ; global contour: model vs ob forrest@0: ;================================ forrest@0: forrest@0: plot_name = "global_"+component(n)+"_model_vs_ob" forrest@0: forrest@0: wks = gsn_open_wks (plot_type,plot_name) forrest@0: gsn_define_colormap(wks,"gui_default") forrest@0: forrest@0: plot=new(3,graphic) ; create graphic array forrest@0: forrest@0: resg@gsnFrame = False ; Do not draw plot forrest@0: resg@gsnDraw = False ; Do not advance frame forrest@0: forrest@0: ; plot correlation coef forrest@0: forrest@0: gRes = True forrest@0: gRes@txFontHeightF = 0.02 forrest@0: gRes@txAngleF = 90 forrest@0: forrest@0: correlation_text = "(correlation coef = "+sprintf("%.2f", cc)+")" forrest@0: forrest@0: gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes) forrest@0: forrest@0: ; plot ob forrest@0: forrest@0: title = ob_name forrest@0: resg@tiMainString = title forrest@0: forrest@0: plot(0) = gsn_csm_contour_map_ce(wks,data_ob,resg) forrest@0: forrest@0: ; plot model forrest@0: forrest@0: title = "Model "+ model_name forrest@0: resg@tiMainString = title forrest@0: forrest@0: plot(1) = gsn_csm_contour_map_ce(wks,data_mod,resg) forrest@0: forrest@0: ; plot model-ob forrest@0: forrest@0: if (n .eq. 0) then forrest@0: resg@cnMinLevelValF = -2. forrest@0: resg@cnMaxLevelValF = 2. forrest@0: resg@cnLevelSpacingF = 0.4 forrest@0: end if forrest@0: forrest@0: if (n .eq. 1) then forrest@0: resg@cnMinLevelValF = -6. forrest@0: resg@cnMaxLevelValF = 6. forrest@0: resg@cnLevelSpacingF = 1. forrest@0: end if forrest@0: forrest@0: if (n .eq. 2) then forrest@0: resg@cnMinLevelValF = -6. forrest@0: resg@cnMaxLevelValF = 6. forrest@0: resg@cnLevelSpacingF = 1. forrest@0: end if forrest@0: forrest@0: if (n .eq. 3) then forrest@0: resg@cnMinLevelValF = -100. forrest@0: resg@cnMaxLevelValF = 100. forrest@0: resg@cnLevelSpacingF = 20. forrest@0: end if forrest@0: forrest@0: zz = data_mod forrest@0: zz = data_mod - data_ob forrest@0: title = "Model_"+model_name+" - Observed" forrest@0: resg@tiMainString = title forrest@0: forrest@0: plot(2) = gsn_csm_contour_map_ce(wks,zz,resg) forrest@0: forrest@0: ; plot panel forrest@0: forrest@0: pres = True ; panel plot mods desired forrest@0: pres@gsnMaximize = True ; fill the page forrest@0: forrest@0: gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot forrest@0: forrest@0: clear (wks) forrest@0: delete (plot) forrest@0: forrest@0: end do forrest@0: ;************************************************** forrest@0: ; html table forrest@0: ;************************************************** forrest@0: output_html = "table_model_vs_ob.html" forrest@0: forrest@0: header_text = "

LAI: Model "+model_name+" vs Observed

" forrest@0: forrest@0: header = (/"" \ forrest@0: ,"" \ forrest@0: ,"CLAMP metrics" \ forrest@0: ,"" \ forrest@0: ,header_text \ forrest@0: /) forrest@0: footer = "" forrest@0: forrest@0: table_header = (/ \ forrest@0: "" \ forrest@0: ,"" \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ,"" \ forrest@0: ,"" \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ," " \ forrest@0: ,"" \ forrest@0: /) forrest@0: table_footer = "
Biome Class"+component(0)+""+component(1)+""+component(2)+""+component(3)+"
observed"+model_name+"M_scoreobserved"+model_name+"M_scoreobserved"+model_name+"M_scoreobserved"+model_name+"M_score
" forrest@0: row_header = "" forrest@0: row_footer = "" forrest@0: forrest@0: lines = new(50000,string) forrest@0: nline = 0 forrest@0: forrest@0: set_line(lines,nline,header) forrest@0: set_line(lines,nline,table_header) forrest@0: ;----------------------------------------------- forrest@0: ;row of table forrest@0: forrest@0: do n = 0,nrow-1 forrest@0: set_line(lines,nline,row_header) forrest@0: forrest@0: txt1 = row_head(n) forrest@0: txt2 = text4(n,0) forrest@0: txt3 = text4(n,1) forrest@0: txt4 = text4(n,2) forrest@0: txt5 = text4(n,3) forrest@0: txt6 = text4(n,4) forrest@0: txt7 = text4(n,5) forrest@0: txt8 = text4(n,6) forrest@0: txt9 = text4(n,7) forrest@0: txt10 = text4(n,8) forrest@0: txt11 = text4(n,9) forrest@0: txt12 = text4(n,10) forrest@0: txt13 = text4(n,11) forrest@0: forrest@0: set_line(lines,nline,""+txt1+"") forrest@0: set_line(lines,nline,""+txt2+"") forrest@0: set_line(lines,nline,""+txt3+"") forrest@0: set_line(lines,nline,""+txt4+"") forrest@0: set_line(lines,nline,""+txt5+"") forrest@0: set_line(lines,nline,""+txt6+"") forrest@0: set_line(lines,nline,""+txt7+"") forrest@0: set_line(lines,nline,""+txt8+"") forrest@0: set_line(lines,nline,""+txt9+"") forrest@0: set_line(lines,nline,""+txt10+"") forrest@0: set_line(lines,nline,""+txt11+"") forrest@0: set_line(lines,nline,""+txt12+"") forrest@0: set_line(lines,nline,""+txt13+"") forrest@0: forrest@0: set_line(lines,nline,row_footer) forrest@0: end do forrest@0: ;----------------------------------------------- forrest@0: set_line(lines,nline,table_footer) forrest@0: set_line(lines,nline,footer) forrest@0: forrest@0: ; Now write to an HTML file. forrest@0: idx = ind(.not.ismissing(lines)) forrest@0: if(.not.any(ismissing(idx))) then forrest@0: asciiwrite(output_html,lines(idx)) forrest@0: else forrest@0: print ("error?") forrest@0: end if forrest@0: forrest@0: ;*************************************************************************** forrest@0: ; write total score to file forrest@0: ;*************************************************************************** forrest@0: forrest@0: asciiwrite("M_save.lai", M_total) forrest@0: forrest@0: ;*************************************************************************** forrest@0: end forrest@0: