require "numru/ggraph"
include NumRu

c1=5.0*(10**(-1))
c2=5.0*(10**(-2))
c3=5.0*(10**(-3))
c4=5.0*(10**(-4))
c5=2.5*(10**(-3))
c6=1.0*(10**(-2))

time=510

gphys1 = GPhys::IO.open("./src/c_5d-1/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys2 = GPhys::IO.open("./src/c_5d-2/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys3 = GPhys::IO.open("./src/c_5d-3/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys4 = GPhys::IO.open("./src/c_5d-4/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys5 = GPhys::IO.open("./src/c_25d-3/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys6 = GPhys::IO.open("./src/c_1d-2/u_mu.nc","u").cut("t"=>time).cut("height"=>0)
gphys10 = GPhys::IO.open("./src/c_5d-1/ft.nc","u")

Lat = gphys10.axis('lat').pos.val
mu = NArray.float(192).fill(0.0)
line = NArray.float(192).fill(0.0)

for i in 0..191 do
mu[i] = sin(Lat[i]*(Math::PI/180.0))
end

Mu = VArray.new(mu,{"long_name"=>"sin Latitude","units"=>""},"sinLat")
axis_mu = Axis.new.set_pos(Mu)
line = VArray.new(line,{"long_name"=>"zonal wind","units"=>"m/s"},"u")
gphys10 = GPhys.new(Grid.new(axis_mu),line)

DCL.gropn(1)
DCL.uzfact(0.6)
GGraph.set_fig("itr"=>1,"viewport"=>[0.1,0.7,0.2,0.6])
GGraph.set_axes("ytitle"=>"surface zonal wind (m/s)","yunits"=>"","xtitle"=>"sin (Lat)","xunits"=>"")
#GGraph.set_axes("ytitle"=>"surface stress","yunits"=>"","xtitle"=>"sin (Lat)","xunits"=>"")
rmiss = DCL.glpget('rmiss')

GGraph.line(gphys1,true,"exchange"=>false,"annotate"=>false,"title"=>"","index"=>20,"min"=>-30,"max"=>34)
GGraph.line(gphys2,false,"exchange"=>false,"annotate"=>false,"index"=>40)
GGraph.line(gphys3,false,"exchange"=>false,"annotate"=>false,"index"=>10)
GGraph.line(gphys4,false,"exchange"=>false,"annotate"=>false,"index"=>60)
GGraph.line(gphys5,false,"exchange"=>false,"annotate"=>false,"index"=>50)
GGraph.line(gphys6,false,"exchange"=>false,"annotate"=>false,"index"=>30)
GGraph.line(gphys10,false,"exchange"=>false,"annotate"=>false,"index"=>10)

DCL.grcls

