co2/99.all.ncl.1
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/co2/99.all.ncl.1	Mon Jan 26 22:08:20 2009 -0500
     1.3 @@ -0,0 +1,558 @@
     1.4 +; ***********************************************
     1.5 +; using gsn_table for all
     1.6 +; combine 19.metric_plot.ncl and 24.lines.ncl
     1.7 +; ***********************************************
     1.8 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
     1.9 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
    1.10 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
    1.11 +;load "/fis/cgd/cseg/people/jeff/clamp/co2/metrics_table.ncl"
    1.12 +;************************************************
    1.13 +begin
    1.14 +
    1.15 +;************************************************
    1.16 +; read model data
    1.17 +;************************************************
    1.18 +
    1.19 +; from command line inputs
    1.20 +
    1.21 +;--------------------------------------------------
    1.22 +; edit table.html of current model for movel1_vs_model2
    1.23 +
    1.24 + if (isvar("compare")) then
    1.25 +    html_name2 = compare+"/table.html"  
    1.26 +    html_new2  = html_name2 +".new"
    1.27 +
    1.28 +; the following only needs to execute once
    1.29 +;   system("sed 1,/model_nameA/s//"+model_name+"/ "+html_name2+" > "+html_new2+";"+ \
    1.30 +;          "mv -f "+html_new2+" "+html_name2+";"+ \
    1.31 +;          "sed 1,/model_nameB/s//"+model_name+"/ "+html_name2+" > "+html_new2+";"+ \
    1.32 +;          "mv -f "+html_new2+" "+html_name2+";"+ \
    1.33 +;          "sed s#"+modeln+"#"+model_name+"# "+html_name2+" > "+html_new2+";"+ \
    1.34 +;          "mv -f "+html_new2+" "+html_name2)
    1.35 + end if
    1.36 +
    1.37 +;-------------------------------------
    1.38 +; edit table.html for current model
    1.39 +
    1.40 + html_name = model_name+"/table.html"  
    1.41 + html_new  = html_name +".new"
    1.42 +
    1.43 +; the following only needs to execute once
    1.44 +; system("sed s#model_name#"+model_name+"# "+html_name+" > "+html_new+";"+ \
    1.45 +;        "mv -f "+html_new+" "+html_name)
    1.46 +;------------------------------------------------
    1.47 +
    1.48 +  fm    = addfile(dirm+film3,"r")
    1.49 +
    1.50 +  x     = fm->CO2
    1.51 +  xi    = fm->lon
    1.52 +  yi    = fm->lat
    1.53 +
    1.54 +  xdim  = dimsizes(x)
    1.55 +  nlev  = xdim(1)
    1.56 +  y     = x(:,0,:,:)
    1.57 +  
    1.58 +; get co2 at the lowest level
    1.59 +  y     = x(:,nlev-1,:,:)
    1.60 +
    1.61 +; change to unit of observed (u mol/mol)
    1.62 +; Model_units [=] kgCO2 / kgDryAir
    1.63 +; 28.966 = molecular weight of dry air
    1.64 +; 44.       = molecular weight of CO2
    1.65 +; u mol = 1e-6 mol
    1.66 +
    1.67 +  factor = (28.966/44.) * 1e6
    1.68 +  y      = y * factor
    1.69 +
    1.70 +  y@_FillValue = 1.e36
    1.71 +  y@units      = "u mol/mol"
    1.72 +;************************************************
    1.73 +; read data: observed
    1.74 +;************************************************
    1.75 + diri  = "/fis/cgd/cseg/people/jeff/clamp_data/co2/ob/"
    1.76 + fili  = "co2_globalView_98.nc"
    1.77 + g     = addfile (diri+fili,"r")
    1.78 + val   = g->CO2_SEAS  
    1.79 + lon   = g->LON 
    1.80 + lat   = g->LAT
    1.81 + sta   = chartostring(g->STATION) 
    1.82 + delete (g)
    1.83 +
    1.84 + ncase = dimsizes(lat)
    1.85 +;**************************************************************
    1.86 +; get only the lowest level at each station 
    1.87 +;**************************************************************
    1.88 + lat_tmp = lat
    1.89 + lat_tmp@_FillValue = 1.e+36
    1.90 + 
    1.91 + do n = 0,ncase-1
    1.92 +    if (.not. ismissing(lat_tmp(n))) then 
    1.93 +       indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon)
    1.94 +       if (dimsizes(indexes) .gt. 1) then
    1.95 +          lat_tmp(indexes(1:)) = lat_tmp@_FillValue
    1.96 +       end if
    1.97 +       delete (indexes)
    1.98 +    end if
    1.99 + end do
   1.100 +
   1.101 + indexes = ind(.not. ismissing(lat_tmp))
   1.102 + 
   1.103 + lat_ob = lat(indexes)
   1.104 + lon_ob = lon(indexes)
   1.105 + val_ob = val(indexes,:)
   1.106 +;************************************************************
   1.107 +; interpolate model data into observed station
   1.108 +; note: model is 0-360E, 90S-90N
   1.109 +;************************************************************
   1.110 +; to be able to handle observation at (-89.98,-24.80)
   1.111 +  yi(0) = -90.
   1.112 +
   1.113 +  i = ind(lon_ob .lt. 0.)
   1.114 +  lon_ob(i) = lon_ob(i) + 360.  
   1.115 +
   1.116 +  yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0)
   1.117 +
   1.118 +  val_model = yo(pts|:,time|:)
   1.119 +  val_model_0 = val_model
   1.120 +
   1.121 +; remove annual mean
   1.122 +  val_model = val_model - conform(val_model,dim_avg(val_model),0)
   1.123 +
   1.124 +  nzone = 4
   1.125 +
   1.126 +;*******************************************************************
   1.127 +; for table -- zone
   1.128 +;*******************************************************************
   1.129 +; table header name
   1.130 +  table_header_name = "Zone" 
   1.131 +
   1.132 +; column (not including header column)
   1.133 +  col_header_zone = (/"Stations","Amplitude Ratio", \
   1.134 +                      "Correlation Coef","M score","Combined Score"/)
   1.135 +  ncol_zone       = dimsizes(col_header_zone ) 
   1.136 +
   1.137 +; row (not including header row)
   1.138 +  row_header_zone = (/"60N-90N","30N-60N","EQ-30N","90S-EQ","Total"/)  
   1.139 +  nrow_zone       = dimsizes(row_header_zone)                  
   1.140 +
   1.141 +; arrays to be passed to table. 
   1.142 +  value_zone = new ((/nrow_zone, ncol_zone/),string ) 
   1.143 +;--------------------------------------------------------------------
   1.144 +
   1.145 +  table_length_zone = 0.4 
   1.146 +
   1.147 +; Table header
   1.148 +  ncr1  = (/1,1/)               ; 1 row, 1 column
   1.149 +  x1    = (/0.005,0.15/)        ; Start and end X
   1.150 +  y1    = (/0.900,0.995/)       ; Start and end Y
   1.151 +  text1 = table_header_name
   1.152 +  res1               = True
   1.153 +  res1@txFontHeightF = 0.03
   1.154 +  res1@gsFillColor   = "CornFlowerBlue"
   1.155 +
   1.156 +; Column header (equally space in x2)
   1.157 +  ncr2  = (/1,ncol_zone/)         ; 1 rows, 5 columns
   1.158 +  x2    = (/x1(1),0.995/)          ; start from end of x1
   1.159 +  y2    = y1                      ; same as y1
   1.160 +  text2 = col_header_zone
   1.161 +  res2               = True
   1.162 +  res2@txFontHeightF = 0.015
   1.163 +  res2@gsFillColor   = "Gray"
   1.164 +
   1.165 +; Row header (equally space in y2)
   1.166 +  ncr3  = (/nrow_zone,1/)         ; 5 rows, 1 columns
   1.167 +  x3    = x1                      ; same as x1
   1.168 +  y3    = (/1.0-table_length_zone,0.900/) ; end at start of y1
   1.169 +  text3 = row_header_zone
   1.170 +  res3               = True
   1.171 +  res3@txFontHeightF = 0.02
   1.172 +  res3@gsFillColor   = "Gray"
   1.173 +
   1.174 +; Main table body
   1.175 +  ncr4  = (/nrow_zone,ncol_zone/) ; 5 rows, 5 columns
   1.176 +  x4    = x2                      ; Start and end x
   1.177 +  y4    = y3                      ; Start and end Y
   1.178 +  text4 = new((/nrow_zone,ncol_zone/),string)
   1.179 +
   1.180 +  color_fill4      = new((/nrow_zone,ncol_zone/),string)
   1.181 +  color_fill4      = "white"
   1.182 +  color_fill4(:,ncol_zone-1) = "grey"
   1.183 +
   1.184 +  res4               = True       ; Set up resource list
   1.185 +; res4@gsnDebug      = True       ; Useful to print NDC row,col values used.
   1.186 +  res4@txFontHeightF = 0.02
   1.187 +  res4@gsFillColor   = color_fill4
   1.188 +
   1.189 +  delete (color_fill4)
   1.190 +
   1.191 +;*******************************************************************
   1.192 +; for table -- station
   1.193 +;*******************************************************************
   1.194 +; column (not including header column)
   1.195 +  col_header_sta = (/"Latitude","Longitude","Amplitude Ratio", \
   1.196 +                      "Correlation Coef","M score","Combined Score"/)
   1.197 +  ncol_sta       = dimsizes(col_header_sta ) 
   1.198 +;-------------------------------------------------------------------
   1.199 +
   1.200 +; Table header
   1.201 +  ncr5  = (/1,1/)               ; 1 row, 1 column
   1.202 +  x5    = (/0.005,0.15/)        ; Start and end X
   1.203 +  y5    = (/0.900,0.995/)       ; Start and end Y
   1.204 +  res5               = True
   1.205 +  res5@txFontHeightF = 0.02
   1.206 +  res5@gsFillColor   = "CornFlowerBlue"
   1.207 +
   1.208 +; Column header (equally space in x2)
   1.209 +  ncr6  = (/1,ncol_sta/)         ; 1 rows, 5 columns
   1.210 +  x6    = (/x5(1),0.995/)          ; start from end of x1
   1.211 +  y6    = y5                      ; same as y1
   1.212 +  text6 = col_header_sta
   1.213 +  res6               = True
   1.214 +  res6@txFontHeightF = 0.012
   1.215 +  res6@gsFillColor   = "Gray"
   1.216 +
   1.217 +; Row header (equally space in y2)
   1.218 +
   1.219 +  res7               = True
   1.220 +  res7@txFontHeightF = 0.015
   1.221 +  res7@gsFillColor   = "Gray"
   1.222 +;--------------------------------------------------------------
   1.223 +; for station line plot
   1.224 +
   1.225 +; for x-axis in xyplot
   1.226 +  mon = ispan(1,12,1)
   1.227 +  mon@long_name = "month"
   1.228 +
   1.229 +  plot_type = "ps"
   1.230 +  plot_type_new = "png"
   1.231 +
   1.232 +  res                   = True                      ; plot mods desired
   1.233 +  res@xyLineThicknesses = (/2.0,2.0,2.0/)           ; make 2nd lines thicker
   1.234 +  res@xyLineColors      = (/"red","black"/)  ; change line color
   1.235 +
   1.236 +; Add a boxed legend using the more simple method
   1.237 +
   1.238 +  res@pmLegendDisplayMode    = "Always"
   1.239 +; res@pmLegendWidthF         = 0.1
   1.240 +  res@pmLegendWidthF         = 0.08
   1.241 +  res@pmLegendHeightF        = 0.06
   1.242 +; res@pmLegendOrthogonalPosF = -1.17
   1.243 +; res@pmLegendOrthogonalPosF = -1.00  ;(downward)
   1.244 +  res@pmLegendOrthogonalPosF = -0.30  ;(downward)
   1.245 +
   1.246 +; res@pmLegendParallelPosF   =  0.18
   1.247 +  res@pmLegendParallelPosF   =  0.23  ;(rightward)
   1.248 +
   1.249 +; res@lgPerimOn             = False
   1.250 +  res@lgLabelFontHeightF     = 0.015
   1.251 +  res@xyExplicitLegendLabels = (/"b30.061n","observed"/)
   1.252 +;-------------------------------------------------------------------
   1.253 +
   1.254 +  do z = 0,nzone-1
   1.255 +
   1.256 +  if (z .eq. 0) then 
   1.257 +;    maximum score for the zone, 60N-90N
   1.258 +     zone = "60N-90N" 
   1.259 +     score_max = 5.0
   1.260 +;    index of stations in this zone
   1.261 +     ind_z = ind(lat_ob .ge. 60.)
   1.262 +  end if
   1.263 +
   1.264 +  if (z .eq. 1) then 
   1.265 +;    maximum score for the zone, 30N-60N
   1.266 +     zone = "30N-60N" 
   1.267 +     score_max = 5.0
   1.268 +;    index of stations in this zone
   1.269 +     ind_z = ind(lat_ob .ge. 30. .and. lat_ob .lt. 60.)
   1.270 +  end if
   1.271 +
   1.272 +  if (z .eq. 2) then 
   1.273 +;    maximum score for the zone, EQ-30N 
   1.274 +     zone = "EQ-30N"
   1.275 +     score_max = 5.0
   1.276 +;    index of stations in this zone
   1.277 +     ind_z = ind(lat_ob .ge. 0. .and. lat_ob .lt. 30.)
   1.278 +  end if
   1.279 +
   1.280 +  if (z .eq. 3) then 
   1.281 +;    maximum score for the zone, 90S-EQ
   1.282 +     zone = "90S-EQ" 
   1.283 +     score_max = 5.0
   1.284 +;    index of stations in this zone
   1.285 +     ind_z = ind(lat_ob .lt. 0. )
   1.286 +  end if
   1.287 +
   1.288 + npts = dimsizes(ind_z)
   1.289 +
   1.290 +;-------------------------------------------------------------------------
   1.291 +; for metric table computation
   1.292 +
   1.293 + amp_ob        = new((/npts/),float)
   1.294 + amp_model     = new((/npts/),float)
   1.295 +
   1.296 + amp_ratio_sta = new((/npts/),float)
   1.297 + ccr_sta       = new((/npts/),float)
   1.298 + M_sta         = new((/npts/),float)
   1.299 + score_sta     = new((/npts/),float)
   1.300 +
   1.301 +;----------------------
   1.302 +; for table -- station
   1.303 +;----------------------
   1.304 +
   1.305 +; row (not including header row)  
   1.306 +  nrow_sta       = npts                  
   1.307 +
   1.308 +; Table header
   1.309 +  ncr5  = (/1,1/)               ; 1 row, 1 column
   1.310 +  x5    = (/0.005,0.15/)        ; Start and end X
   1.311 +  y5    = (/0.900,0.995/)       ; Start and end Y
   1.312 +  res5               = True
   1.313 +  res5@txFontHeightF = 0.02
   1.314 +  res5@gsFillColor   = "CornFlowerBlue"
   1.315 +
   1.316 +; Column header (equally space in x2)
   1.317 +  ncr6  = (/1,ncol_sta/)         ; 1 rows, 5 columns
   1.318 +  x6    = (/x1(1),0.995/)          ; start from end of x1
   1.319 +  y6    = y1                      ; same as y1
   1.320 +  text6 = col_header_sta
   1.321 +  res6               = True
   1.322 +  res6@txFontHeightF = 0.012
   1.323 +  res6@gsFillColor   = "Gray"
   1.324 +
   1.325 +; Row header (equally space in y2)
   1.326 +  ncr7  = (/nrow_sta,1/)         ; 5 rows, 1 columns
   1.327 +  x7    = x1                      ; same as x1
   1.328 +; y7    = (/1.0-table_length_sta,0.900/) ; end at start of y1
   1.329 +  text7 = new((/nrow_sta/),string)
   1.330 +  res7               = True
   1.331 +  res7@txFontHeightF = 0.015
   1.332 +  res7@gsFillColor   = "Gray"
   1.333 +;-------------------------------------------------------------------------
   1.334 +; for station line plot
   1.335 +
   1.336 +  npts_str = ""
   1.337 +  npts_str = npts
   1.338 +
   1.339 +  plot_data   = new((/2,12,npts/),float)
   1.340 +  plot_data_0 = new((/12,npts/),float)
   1.341 +
   1.342 +  plot_data!0 = "case"
   1.343 +  plot_data!1 = "month"
   1.344 +  plot_data!2 = "pts"
   1.345 +  plot_data@long_name   = "CO2 Seasonal"
   1.346 +
   1.347 +  plot_data_0!0 = "month"
   1.348 +  plot_data_0!1 = "pts"
   1.349 +  plot_data_0@long_name = "CO2"
   1.350 +;--------------------------------------------------------------------------
   1.351 + do n=0,npts-1
   1.352 +    amp_ob(n)    = max(val_ob(ind_z(n),:)) - min(val_ob(ind_z(n),:)) 
   1.353 +    amp_model(n) = max(val_model(ind_z(n),:)) - min(val_model(ind_z(n),:))
   1.354 +
   1.355 +    amp_ratio_sta(n) = amp_model(n)/amp_ob(n)
   1.356 +    ccr_sta(n) = esccr(val_ob(ind_z(n),:),val_model(ind_z(n),:),0)
   1.357 +    M_sta(n) = 1.-abs(amp_ratio_sta(n)-1.)
   1.358 +    score_sta(n) = (ccr_sta(n)*ccr_sta(n) + M_sta(n))*0.5 * score_max
   1.359 +
   1.360 +;----------------------------------------------------------------------
   1.361 +; for station line plot
   1.362 +
   1.363 +    plot_data(0,:,n) = (/val_model(ind_z(n),:)/)
   1.364 +    plot_data(1,:,n) = (/val_ob(ind_z(n),:)/)
   1.365 +
   1.366 +    plot_data_0(:,n) = (/val_model_0(ind_z(n),:)/)
   1.367 +   
   1.368 +    plot_name = sta(ind_z(n))    
   1.369 +    title = plot_name+"("+lat(ind_z(n))+","+lon(ind_z(n))+")"
   1.370 +
   1.371 +    wks = gsn_open_wks (plot_type,plot_name)   ; open workstation
   1.372 +;------------------------------------------
   1.373 +;   for panel plot
   1.374 +   
   1.375 +    plot=new(2,graphic)                        ; create graphic array
   1.376 +    res@gsnFrame     = False                   ; Do not draw plot 
   1.377 +    res@gsnDraw      = False                   ; Do not advance frame
   1.378 +
   1.379 +    pres                            = True     ; panel plot mods desired
   1.380 +    pres@gsnPanelYWhiteSpacePercent = 5        ; increase white space around
   1.381 +                                               ; indiv. plots in panel
   1.382 +    pres@gsnMaximize                = True     ; fill the page
   1.383 +;------------------------------------------
   1.384 +    res@tiMainString = title                           ; add title
   1.385 +
   1.386 +    plot(0)=gsn_csm_xy(wks,mon,plot_data(:,:,n),res)   ; create plot 1
   1.387 +
   1.388 +    plot(1)=gsn_csm_xy(wks,mon,plot_data_0(:,n),res) ; create plot 2
   1.389 +
   1.390 +    gsn_panel(wks,plot,(/2,1/),pres)                 ; create panel plot
   1.391 +
   1.392 +    system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
   1.393 +    system("rm "+plot_name+"."+plot_type)
   1.394 +
   1.395 +    clear (wks)
   1.396 +;---------------------------------------------------------------------------  
   1.397 + end do
   1.398 +;-------------------------------------------------------------------------
   1.399 +;   for line plot in a zone
   1.400 +
   1.401 +    plot_name = "All_"+npts_str
   1.402 +    title = plot_name + " in "+ zone
   1.403 +
   1.404 +    wks = gsn_open_wks (plot_type,plot_name)        ; open workstation
   1.405 +;-----------------------------------------
   1.406 +;   for panel plot
   1.407 +   
   1.408 +    plot=new(2,graphic)                        ; create graphic array
   1.409 +    res@gsnFrame     = False                   ; Do not draw plot 
   1.410 +    res@gsnDraw      = False                   ; Do not advance frame
   1.411 +
   1.412 +    pres                            = True     ; panel plot mods desired
   1.413 +    pres@gsnPanelYWhiteSpacePercent = 5        ; increase white space around
   1.414 +                                               ; indiv. plots in panel
   1.415 +    pres@gsnMaximize                = True     ; fill the page
   1.416 +;-----------------------------------------
   1.417 +    res@tiMainString = title                                     ; add title
   1.418 +
   1.419 +    plot(0) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data),res)   ; create plot 1
   1.420 +    
   1.421 +    plot(1) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data_0),res) ; create plot 2
   1.422 +
   1.423 +    gsn_panel(wks,plot,(/2,1/),pres)                 ; create panel plot
   1.424 +
   1.425 +    system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
   1.426 +    system("rm "+plot_name+"."+plot_type)
   1.427 +
   1.428 +    clear (wks)
   1.429 +;   delete (ind_z)
   1.430 +    delete (plot_data)
   1.431 +    delete (plot_data_0)    
   1.432 +;---------------------------------------------------------------------------
   1.433 +; for zone table value
   1.434 +
   1.435 + amp_ratio_zone = avg(amp_ratio_sta)
   1.436 + ccr_zone       = avg(ccr_sta)
   1.437 + M_zone   = 1.- (sum(abs(amp_model-amp_ob)/(amp_model+amp_ob))/npts) 
   1.438 + score_zone   = (ccr_zone*ccr_zone + M_zone)*0.5 * score_max
   1.439 +
   1.440 +  text4(z,0) = sprintf("%5.2f", npts)
   1.441 +  text4(z,1) = sprintf("%5.2f", amp_ratio_zone)
   1.442 +  text4(z,2) = sprintf("%5.2f", ccr_zone)
   1.443 +  text4(z,3) = sprintf("%5.2f", M_zone)
   1.444 +  text4(z,4) = sprintf("%5.2f", score_zone)  
   1.445 +;---------------------------------------------------------------------------
   1.446 +; plot station table
   1.447 +;----------------------------------
   1.448 +; header value for station table
   1.449 +  text5  = zone 
   1.450 +
   1.451 +; row value for station table 
   1.452 +  text7  = sta(ind_z)
   1.453 +
   1.454 +  if (z .eq. 0) then
   1.455 +     table_length_sta = 0.5
   1.456 +  end if
   1.457 +  if (z .eq. 1) then
   1.458 +     table_length_sta = 0.995
   1.459 +  end if
   1.460 +  if (z .eq. 2) then
   1.461 +     table_length_sta = 0.8
   1.462 +  end if
   1.463 +  if (z .eq. 3) then
   1.464 +     table_length_sta = 0.8
   1.465 +  end if    
   1.466 +
   1.467 +  x7 = x5   
   1.468 +  y7 = (/1.0-table_length_sta,0.900/) ; end at start of y1
   1.469 +
   1.470 +; Main table body
   1.471 +  ncr8  = (/nrow_sta,ncol_sta/) ; 5 rows, 5 columns
   1.472 +  x8    = x6                      ; Start and end x
   1.473 +  y8    = y7                      ; Start and end Y
   1.474 +  text8 = new((/nrow_sta,ncol_sta/),string)
   1.475 +
   1.476 +  color_fill8      = text8
   1.477 +  color_fill8      = "white"
   1.478 +  color_fill8(:,ncol_sta-1) = "grey"
   1.479 +
   1.480 +  res8               = True       ; Set up resource list
   1.481 +; res8@gsnDebug      = True       ; Useful to print NDC row,col values used.
   1.482 +  res8@txFontHeightF = 0.02
   1.483 +  res8@gsFillColor   = color_fill8
   1.484 +
   1.485 +  delete (color_fill8)
   1.486 +
   1.487 +; table value for station table
   1.488 +  text8(:,0) = sprintf("%5.2f", (/lat(ind_z)/))
   1.489 +  text8(:,1) = sprintf("%5.2f", (/lon(ind_z)/))
   1.490 +  text8(:,2) = sprintf("%5.2f", (/amp_ratio_sta/))
   1.491 +  text8(:,3) = sprintf("%5.2f", (/ccr_sta/))
   1.492 +  text8(:,4) = sprintf("%5.2f", (/M_sta/))
   1.493 +  text8(:,5) = sprintf("%5.2f", (/score_sta/))
   1.494 + 
   1.495 +  plot_name = "table_sta." + zone 
   1.496 +  
   1.497 +  wks = gsn_open_wks (plot_type,plot_name)   ; open workstation
   1.498 +
   1.499 +  gsn_table(wks,ncr5,x5,y5,text5,res5)
   1.500 +  gsn_table(wks,ncr6,x6,y6,text6,res6)
   1.501 +  gsn_table(wks,ncr7,x7,y7,text7,res7)
   1.502 +  gsn_table(wks,ncr8,x8,y8,text8,res8) 
   1.503 +
   1.504 +  frame(wks)
   1.505 +
   1.506 +  system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
   1.507 +  system("rm "+plot_name+"."+plot_type)
   1.508 +
   1.509 + delete (ind_z)
   1.510 + delete (amp_model)
   1.511 + delete (amp_ob)
   1.512 + delete (amp_ratio_sta)
   1.513 + delete (ccr_sta)
   1.514 + delete (M_sta)
   1.515 + delete (score_sta)
   1.516 + delete (text7)
   1.517 + delete (text8)
   1.518 + delete (res7)
   1.519 + delete (res8)
   1.520 + clear (wks)
   1.521 + end do
   1.522 +;**************************************************
   1.523 +; plot zone table
   1.524 +;**************************************************
   1.525 + 
   1.526 +  text4(4,0) = sum(stringtofloat(text4(0:3,0))) 
   1.527 +  text4(4,1) = 0.
   1.528 +  text4(4,2) = 0.
   1.529 +  text4(4,3) = 0.
   1.530 +  text4(4,4) = sum(stringtofloat(text4(0:3,4)))
   1.531 +
   1.532 +  plot_name = "table_zone" 
   1.533 +  wks = gsn_open_wks (plot_type,plot_name)   ; open workstation
   1.534 +
   1.535 +  gsn_table(wks,ncr1,x1,y1,text1,res1)
   1.536 +  gsn_table(wks,ncr2,x2,y2,text2,res2)
   1.537 +  gsn_table(wks,ncr3,x3,y3,text3,res3)
   1.538 +  gsn_table(wks,ncr4,x4,y4,text4,res4) 
   1.539 +
   1.540 +  frame(wks)
   1.541 +
   1.542 +  system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
   1.543 +  system("rm "+plot_name+"."+plot_type)
   1.544 +
   1.545 +  M_co2 = text4(4,4)
   1.546 +
   1.547 +  if (isvar("compare")) then
   1.548 +     system("sed 1,/M_co2/s//"+M_co2+"/ "+html_name2+" > "+html_new2+";"+ \
   1.549 +            "mv -f "+html_new2+" "+html_name2)
   1.550 +  end if
   1.551 +
   1.552 +  system("sed s#M_co2#"+M_co2+"# "+html_name+" > "+html_new+";"+ \
   1.553 +         "mv -f "+html_new+" "+html_name) 
   1.554 +;***************************************************************************
   1.555 +; output plots
   1.556 +;***************************************************************************
   1.557 +  output_dir = model_name+"/co2"
   1.558 +
   1.559 +  system("mv *.png " + output_dir) 
   1.560 +;*************************************************************************** 
   1.561 +end