#!/usr/bin/env ruby

load "/work11/ape/yukiko/lib/ape-view.rb"

# --------------------------------------------------------------------

$rezol = ["T39L48_eml","T39L24_eml","T39L96_eml","T79L48_eml","T159L48_eml"]

g_array = Array.new

$rezol.each{ |rezol|
  
  t = ape_new("/work11/ape/NetCDF/#{rezol}/AGUforAPE-03a_ML_control.nc")
  g_array.push(t.go("ml_u").cut(true,0,true).mean(0).
	       rename("ml_u_lat0_zonal").set_att("line_name",rezol))
  
}

$file_label ="eml_control"

#t = Ape_mkfig.new(2)
#t.nc_varlist("/work11/ape/NetCDF/#{$rezol[0]}/AGUforAPE-03a_ML_control.nc")
#tt = ape_new("/work11/ape/NetCDF/#{$rezol[0]}/AGUforAPE-03a_ML_control.nc")
#t.mkfig_plot(g_array)
#tt.grcls

#file_name = "eml_control_ml_u_lat0_zonal.eps"
#`dclpsrmcm dcl*.ps | dclpsrot > tmp.ps`
#`eps2eps tmp.ps  #{$fig_path}#{file_name}` 
#`rm tmp.ps dcl*.ps`

g_array = Array.new
 
  t = ape_new("/work11/ape/NetCDF/T39L48_eml/AGUforAPE-03a_ML_control.nc")
  g_array.push(t.go("ml_u").cut(true,0,true).mean(0).set_lost_axes(""). 
	       rename("zonalmean_u_at_equator").set_att("line_name","T39L48_eml"))

   t = ape_new("/work11/ape/NetCDF/T39L96_eml/AGUforAPE-03a_ML_control.nc")
  g_array.push(t.go("ml_u").cut(true,0,true).mean(0).
	       rename("ml_u_lat0_zonal").set_att("line_name","T39L96_eml"))

   t = ape_new("/work11/ape/NetCDF/T159L48_eml/AGUforAPE-03a_ML_control.nc")
  g_array.push(t.go("ml_u").cut(true,0,true).mean(0).
	       rename("ml_u_lat0_zonal").set_att("line_name","T159L48_eml"))


# $file_label ="non_control"
$file_label =""


#tt = Ape_mkfig.new(2)
tt = ape_new("/work11/ape/NetCDF/T39L48_eml/AGUforAPE-03a_ML_control.nc")
#tt.mkfig_plot(g_array)
tt.mkps(g_array)
tt.grcls


g_array = Array.new
 
  t = ape_new("/work11/ape/NetCDF/T39L48_eml/AGUforAPE-03a_SH_control.nc")
  g_array.push(t.go("sh_dppn").mean(0).set_lost_axes(""). 
	       rename("sh_tppn_zonal_mono").set_att("line_name","T39L48_eml") +
	       t.go("sh_cppn").mean(0))

   t = ape_new("/work11/ape/NetCDF/T39L96_eml/AGUforAPE-03a_SH_control.nc")
  g_array.push(t.go("sh_dppn").mean(0).
	       rename("sh_tppn_zonal_mono").set_att("line_name","T39L96_eml") +
	       t.go("sh_cppn").mean(0))

   t = ape_new("/work11/ape/NetCDF/T159L48_eml/AGUforAPE-03a_SH_control.nc")
  g_array.push(t.go("sh_dppn").mean(0).
	       rename("sh_tppn_zonal_mono").set_att("line_name","T159L48_eml")+
	       t.go("sh_cppn").mean(0))

tt = ape_new("/work11/ape/NetCDF/T39L48_eml/AGUforAPE-03a_SH_control.nc")
#tt.mkfig_plot(g_array)
##tt.mkps(g_array)
##tt.grcls



