co2/42.test.ncl
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/co2/42.test.ncl	Mon Jan 26 22:08:20 2009 -0500
     1.3 @@ -0,0 +1,93 @@
     1.4 +; ***********************************************
     1.5 +; combine 19.metric_plot.ncl and 24.lines.ncl
     1.6 +; ***********************************************
     1.7 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
     1.8 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
     1.9 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
    1.10 +;load "/fis/cgd/cseg/people/jeff/clamp/co2/metrics_table.ncl"
    1.11 +;************************************************
    1.12 +begin
    1.13 +
    1.14 +  plot_type ="ps"
    1.15 +  plot_name = "table_zone" 
    1.16 +  wks = gsn_open_wks (plot_type,plot_name)   ; open workstation
    1.17 +;--------------------------------------------------------------
    1.18 +; for zone table 
    1.19 +
    1.20 +;**********************************
    1.21 +; table header name
    1.22 +  table_header_name = "Zone" 
    1.23 +
    1.24 +; column (not including header column)
    1.25 +  col_header_zone = (/"Stations","Amplitude Ratio", \
    1.26 +                      "Correlation Coef","M score","Combined Score"/)
    1.27 +  ncol_zone       = dimsizes(col_header_zone ) 
    1.28 +
    1.29 +; row (not including header row)
    1.30 +  row_header_zone = (/"60N-90N","30N-60N","EQ-30N","90S-EQ","Total"/)  
    1.31 +  nrow_zone       = dimsizes(row_header_zone)                  
    1.32 +
    1.33 +; arrays to be passed to table. 
    1.34 +  value_zone = new ((/nrow_zone, ncol_zone/),string ) 
    1.35 +;**********************************
    1.36 +
    1.37 +  table_length_zone = 0.4 
    1.38 +
    1.39 +; Table header
    1.40 +  ncr1  = (/1,1/)               ; 1 row, 1 column
    1.41 +  x1    = (/0.005,0.15/)        ; Start and end X
    1.42 +  y1    = (/0.900,0.995/)       ; Start and end Y
    1.43 +  text1 = table_header_name
    1.44 +  res1               = True
    1.45 +  res1@txFontHeightF = 0.03
    1.46 +  res1@gsFillColor   = "CornFlowerBlue"
    1.47 +
    1.48 +; Column header (equally space in x2)
    1.49 +  ncr2  = (/1,ncol_zone/)         ; 1 rows, 5 columns
    1.50 +  x2    = (/x1(1),0.995/)          ; start from end of x1
    1.51 +  y2    = y1                      ; same as y1
    1.52 +  text2 = col_header_zone
    1.53 +  res2               = True
    1.54 +  res2@txFontHeightF = 0.015
    1.55 +  res2@gsFillColor   = "Gray"
    1.56 +
    1.57 +; Row header (equally space in y2)
    1.58 +  ncr3  = (/nrow_zone,1/)         ; 5 rows, 1 columns
    1.59 +  x3    = x1                      ; same as x1
    1.60 +  y3    = (/1.0-table_length_zone,0.900/) ; end at start of y1
    1.61 +  text3 = row_header_zone
    1.62 +  res3               = True
    1.63 +  res3@txFontHeightF = 0.02
    1.64 +  res3@gsFillColor   = "Gray"
    1.65 +
    1.66 +; Main table body
    1.67 +  ncr4  = (/nrow_zone,ncol_zone/) ; 5 rows, 5 columns
    1.68 +  x4    = x2                      ; Start and end x
    1.69 +  y4    = y3                      ; Start and end Y
    1.70 +  text4 = new((/nrow_zone,ncol_zone/),string)
    1.71 +
    1.72 +  color_fill4      = new((/nrow_zone,ncol_zone/),string)
    1.73 +  color_fill4      = "white"
    1.74 +  color_fill4(:,ncol_zone-1) = "grey"
    1.75 +
    1.76 +  res4               = True       ; Set up resource list
    1.77 +; res4@gsnDebug      = True       ; Useful to print NDC row,col values used.
    1.78 +  res4@txFontHeightF = 0.02
    1.79 +  res4@gsFillColor   = color_fill4
    1.80 +
    1.81 +  delete (color_fill4)
    1.82 +
    1.83 +;**************************************************
    1.84 +; plot zone table
    1.85 +;**************************************************
    1.86 + 
    1.87 +  text4 = sprintf("%5.2f", 0.9999 )
    1.88 +
    1.89 +  gsn_table(wks,ncr1,x1,y1,text1,res1)
    1.90 +  gsn_table(wks,ncr2,x2,y2,text2,res2)
    1.91 +  gsn_table(wks,ncr3,x3,y3,text3,res3)
    1.92 +  gsn_table(wks,ncr4,x4,y4,text4,res4) 
    1.93 +
    1.94 +  frame(wks)
    1.95 +
    1.96 +end