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