co2/42.test.ncl
author Forrest Hoffman <forrest@climatemodeling.org>
Thu, 26 Mar 2009 14:02:21 -0400
changeset 1 4be95183fbcd
permissions -rw-r--r--
Modifications to scoring and graphics production for the final version of code for the C-LAMP paper in GCB.
forrest@0
     1
; ***********************************************
forrest@0
     2
; combine 19.metric_plot.ncl and 24.lines.ncl
forrest@0
     3
; ***********************************************
forrest@0
     4
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
forrest@0
     5
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
forrest@0
     6
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
forrest@0
     7
;load "/fis/cgd/cseg/people/jeff/clamp/co2/metrics_table.ncl"
forrest@0
     8
;************************************************
forrest@0
     9
begin
forrest@0
    10
forrest@0
    11
  plot_type ="ps"
forrest@0
    12
  plot_name = "table_zone" 
forrest@0
    13
  wks = gsn_open_wks (plot_type,plot_name)   ; open workstation
forrest@0
    14
;--------------------------------------------------------------
forrest@0
    15
; for zone table 
forrest@0
    16
forrest@0
    17
;**********************************
forrest@0
    18
; table header name
forrest@0
    19
  table_header_name = "Zone" 
forrest@0
    20
forrest@0
    21
; column (not including header column)
forrest@0
    22
  col_header_zone = (/"Stations","Amplitude Ratio", \
forrest@0
    23
                      "Correlation Coef","M score","Combined Score"/)
forrest@0
    24
  ncol_zone       = dimsizes(col_header_zone ) 
forrest@0
    25
forrest@0
    26
; row (not including header row)
forrest@0
    27
  row_header_zone = (/"60N-90N","30N-60N","EQ-30N","90S-EQ","Total"/)  
forrest@0
    28
  nrow_zone       = dimsizes(row_header_zone)                  
forrest@0
    29
forrest@0
    30
; arrays to be passed to table. 
forrest@0
    31
  value_zone = new ((/nrow_zone, ncol_zone/),string ) 
forrest@0
    32
;**********************************
forrest@0
    33
forrest@0
    34
  table_length_zone = 0.4 
forrest@0
    35
forrest@0
    36
; Table header
forrest@0
    37
  ncr1  = (/1,1/)               ; 1 row, 1 column
forrest@0
    38
  x1    = (/0.005,0.15/)        ; Start and end X
forrest@0
    39
  y1    = (/0.900,0.995/)       ; Start and end Y
forrest@0
    40
  text1 = table_header_name
forrest@0
    41
  res1               = True
forrest@0
    42
  res1@txFontHeightF = 0.03
forrest@0
    43
  res1@gsFillColor   = "CornFlowerBlue"
forrest@0
    44
forrest@0
    45
; Column header (equally space in x2)
forrest@0
    46
  ncr2  = (/1,ncol_zone/)         ; 1 rows, 5 columns
forrest@0
    47
  x2    = (/x1(1),0.995/)          ; start from end of x1
forrest@0
    48
  y2    = y1                      ; same as y1
forrest@0
    49
  text2 = col_header_zone
forrest@0
    50
  res2               = True
forrest@0
    51
  res2@txFontHeightF = 0.015
forrest@0
    52
  res2@gsFillColor   = "Gray"
forrest@0
    53
forrest@0
    54
; Row header (equally space in y2)
forrest@0
    55
  ncr3  = (/nrow_zone,1/)         ; 5 rows, 1 columns
forrest@0
    56
  x3    = x1                      ; same as x1
forrest@0
    57
  y3    = (/1.0-table_length_zone,0.900/) ; end at start of y1
forrest@0
    58
  text3 = row_header_zone
forrest@0
    59
  res3               = True
forrest@0
    60
  res3@txFontHeightF = 0.02
forrest@0
    61
  res3@gsFillColor   = "Gray"
forrest@0
    62
forrest@0
    63
; Main table body
forrest@0
    64
  ncr4  = (/nrow_zone,ncol_zone/) ; 5 rows, 5 columns
forrest@0
    65
  x4    = x2                      ; Start and end x
forrest@0
    66
  y4    = y3                      ; Start and end Y
forrest@0
    67
  text4 = new((/nrow_zone,ncol_zone/),string)
forrest@0
    68
forrest@0
    69
  color_fill4      = new((/nrow_zone,ncol_zone/),string)
forrest@0
    70
  color_fill4      = "white"
forrest@0
    71
  color_fill4(:,ncol_zone-1) = "grey"
forrest@0
    72
forrest@0
    73
  res4               = True       ; Set up resource list
forrest@0
    74
; res4@gsnDebug      = True       ; Useful to print NDC row,col values used.
forrest@0
    75
  res4@txFontHeightF = 0.02
forrest@0
    76
  res4@gsFillColor   = color_fill4
forrest@0
    77
forrest@0
    78
  delete (color_fill4)
forrest@0
    79
forrest@0
    80
;**************************************************
forrest@0
    81
; plot zone table
forrest@0
    82
;**************************************************
forrest@0
    83
 
forrest@0
    84
  text4 = sprintf("%5.2f", 0.9999 )
forrest@0
    85
forrest@0
    86
  gsn_table(wks,ncr1,x1,y1,text1,res1)
forrest@0
    87
  gsn_table(wks,ncr2,x2,y2,text2,res2)
forrest@0
    88
  gsn_table(wks,ncr3,x3,y3,text3,res3)
forrest@0
    89
  gsn_table(wks,ncr4,x4,y4,text4,res4) 
forrest@0
    90
forrest@0
    91
  frame(wks)
forrest@0
    92
forrest@0
    93
end