# -*- coding: euc-jp -*-
require "numru/ggraph"
include NumRu

#timestep  = ARGV[0].to_i

x1 = 0
x2 = 256000
#x2 = 512000
#x2 = 500 * 1000 - 500 * 10
z1 = 0
z2 = 30000
t1 = 0
t2 = 2592000
#t2 = 86400 * 30
tn = 1440
#tn = 2400

files = "thermal-moist_DensThermExp.nc"
gphys1 = GPhys::IO.open(files, 'DensThermExp')
files = "thermal-moist_DensThermExp_z24km.nc"
gphys2 = GPhys::IO.open(files, 'DensThermExp')
files = "thermal-moist_DensThermExp_z36km.nc"
gphys3 = GPhys::IO.open(files, 'DensThermExp')
files = "thermal-moist_DensThermExp_z48km.nc"
gphys4 = GPhys::IO.open(files, 'DensThermExp')

#DCL.gropn(1)
DCL.gropn(2)
#DCL.sldiv('y',1,2)
DCL.sgpset('lfull',true)
DCL.sgpset('lcntl',false)
DCL.uzfact(0.7)
#DCL.uzfact(0.3)
#GGraph.set_fig( 'viewport'=>[0.25,0.7,0.15,0.6] )
# アスペクト比をそれっぽくする
GGraph.set_fig( 'viewport'=>[0.1,0.85,0.15,0.6] )
#GGraph.set_fig( 'viewport'=>[0.25,0.8,0.10,0.275] )

#xax = gphys1.coord(0)
#zax = gphys1.coord(2)
#tax = gphys1.coord(0)

gphysdisp1 = gphys1.cut( 't'=>t2 )
gphysdisp1 = gphysdisp1.mean( 'x' )
#gphysdisp1 = gphysdisp1.cut( 'z'=>0..12000 )
gphysdisp2 = gphys2.cut( 't'=>t2 )
gphysdisp2 = gphysdisp2.mean( 'x' )
#gphysdisp2 = gphysdisp2.cut( 'z'=>0..12000 )
gphysdisp3 = gphys3.cut( 't'=>t2 )
gphysdisp3 = gphysdisp3.mean( 'x' )
#gphysdisp3 = gphysdisp3.cut( 'z'=>0..12000 )
gphysdisp4 = gphys4.cut( 't'=>t2 )
gphysdisp4 = gphysdisp4.mean( 'x' )
#gphysdisp4 = gphysdisp4.cut( 'z'=>0..12000 )

#GGraph.contour( gphysdisp, true, 'transpose'=>true )
#GGraph.line( gphysdisp, true, 'min' => 0.956, 'max' => 0.996 )
#GGraph.line( gphysdisp1, true, 'exchange'=>true, 'min'=> -0.3, 'max'=>0.7 ) 
#GGraph.line( gphysdisp1, true, 'min' => 0.956, 'max' => 0.996 )
#GGraph.line( gphysdisp2, false, 'min' => 0.956, 'max' => 0.996, 'type' => 2 )
#GGraph.line( gphysdisp3, false, 'min' => 0.956, 'max' => 0.996, 'type' => 2 )
GGraph.line( gphysdisp4, true, 'exchange'=>true, 'min'=> -0.3, 'max'=>0.7,  'type'=>2 ) 
GGraph.line( gphysdisp1, false, 'exchange'=>true, 'min'=> -0.3, 'max'=>0.7, 'type'=>1 ) 
GGraph.line( gphysdisp2, false, 'exchange'=>true, 'min'=> -0.3, 'max'=>0.7, 'type'=>3 ) 
GGraph.line( gphysdisp3, false, 'exchange'=>true, 'min'=> -0.3, 'max'=>0.7, 'type'=>4 ) 
#GGraph.line( gphysdisp1, true ) 
#GGraph.line( gphysdisp2, false )
#GGraph.line( gphysdisp3, false )
#GGraph.line( gphysdisp, true )
#GGraph.tone( gphysdisp1, true )

DCL.grcls
