# -*- 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
#z2 = 48000
t1 = 0
t2 = 86400 * 50
dt = 1800
tn = t2 / dt

files = "thermal-moist_H2O-gInt.nc"
gphysH2OgInt = GPhys::IO.open(files, 'H2O-gInt')
##files = "thermal-moist_H2O-g_SfcMassFlux.nc"
#files = "thermal-moist_H2O-g_SfcMassFlux_IntValue30day.nc"
#gphys2 = GPhys::IO.open(files, 'H2O-g_SfcMassFlux')
##files = "thermal-moist_H2O-l-Rain_FallFluxAtLB.nc"
#files = "thermal-moist_H2O-l-Rain_FallFluxAtLB_IntValue30day.nc"
#gphys3 = GPhys::IO.open(files, 'H2O-l-Rain_FallFluxAtLB')

#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] )

tax = gphysH2OgInt.coord(0)

#-- 水蒸気混合比の鉛直積分の時間変化を求める --#
#gphysdisp0 = gphys1.cut( 't'=>t2 ).val - gphys1.cut( 't'=>t1 ).val
#gphysdisp1 = gphysdisp0
#
#print "\n Integral of H2O-gAll in z :\n"
#p gphysdisp1

gphysdispH2OgInt = gphysH2OgInt
#
##gphysdisp0 = gphys
#gphysdisp0 = gphys2
#gphysdisp0 = gphysdisp0.mean( 'x' )
#gphysdisp0 = gphysdisp0.mean( 'y' )
#gphysdisp0 = gphysdisp0 * t2
##gphysdisp0 = gphysdisp0.cut( 'z'=>150 )
##gphysdisp  = gphysdisp0
#gphysdisp2 = gphysdisp0
#
#print "\n Total of H2O-g_SfcMassFlux :\n"
#p gphysdisp2.val
#
#gphysdisp0 = gphys3
#gphysdisp0 = gphysdisp0.mean( 'x' )
#gphysdisp0 = gphysdisp0.mean( 'y' )
#gphysdisp0 = gphysdisp0 * t2
##gphysdisp0 = gphysdisp0.cut( 'z'=>150 )
##gphysdisp  = gphysdisp0
#gphysdisp3 = gphysdisp0

#print "\n Total of H2O-l-Rain_FallFlux at Lower Boundary :\n"
#p gphysdisp3.val

#gphysdisp = gphysdisp2 - gphysdisp3

#GGraph.contour( gphysdisp, true, 'transpose'=>true )
#GGraph.line( gphysdisp, true, 'min' => 0.956, 'max' => 0.996 )
#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( gphysdispH2OgInt, true ) 
#GGraph.line( gphysdisp2, false )
#GGraph.line( gphysdisp3, false )
#GGraph.line( gphysdisp, true )

DCL.grcls
 
