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

#timestep  = ARGV[0].to_i

x1 = 0
x2 = 256000
#x2 = 500 * 1000 - 500 * 10
z1 = 0
z2 = 48000
t1 = 86400 * 49  # 49 日
t2 = 86400 * 50  # 50 日

#files = 'nccomb-restart/thermal-moist_restart.nc'
#gphys0 = GPhys::IO.open(files, 'VelX')
#files = /thermal-moist_VelX_rank(\d\d\d\d\d\d).nc/
#gphys  = GPhys::IO.open(files, 'VelX')

#files = 'nccomb-restart/thermal-moist_restart.nc'
#gphys0 = GPhys::IO.open(files, 'QMixBZ')
#gphys0 = gphys0.cut( 's'=>1 )
#files = /H2O-g_rank(\d\d\d\d\d\d).nc/
#gphys  = GPhys::IO.open(files, 'H2O-g')

#files = /thermal-moist_H2O-gAll_rank(\d\d\d\d\d\d).nc/
#gphys  = GPhys::IO.open(files, 'H2O-gAll')

files1 = "thermal-moist_H2O-gAll.nc"
gphys1  = GPhys::IO.open(files1, 'H2O-gAll')
files2 = 'thermal-moist_H2O-gAll_TET_CtlPress_atSfcFlux_x256km_z48km.nc'
gphys2  = GPhys::IO.open(files2, 'H2O-gAll')

#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.1,0.85,0.2,0.45] )  

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

gphysdisp0 = gphys1
gphysdisp0 = gphysdisp0.mean( 'x' )
gphysdisp0 = gphysdisp0.mean( 'y' )
gphysdisp0 = gphysdisp0.cut( 'z'=>0..10000 )
gphysdisp0 = gphysdisp0.cut( 't'=>t1..t2 )
gphysdisp0 = gphysdisp0.mean( 't' )
gphysdisp1  = gphysdisp0

gphysdisp0 = gphys2
gphysdisp0 = gphysdisp0.mean( 'x' )
gphysdisp0 = gphysdisp0.mean( 'y' )
gphysdisp0 = gphysdisp0.cut( 'z'=>0..10000 )
gphysdisp0 = gphysdisp0.cut( 't'=>t1..t2 )
gphysdisp0 = gphysdisp0.mean( 't' )
gphysdisp2  = gphysdisp0

GGraph.line( gphysdisp1, true, 'min' => 0.0, 'max' => 0.022, 'type'=>1, 'exchange'=>true )
GGraph.line( gphysdisp2, false, 'min' => 0.0, 'max' => 0.022, 'type'=>2, 'exchange'=>true )
#GGraph.line( gphysdisp1, true, 'min' => 0.0, 'max' => 0.020, 'type'=>1, 'transpose'=>true )
#GGraph.line( gphysdisp2, false, 'min' => 0.0, 'max' => 0.020, 'type'=>2, 'transpose'=>true )
#GGraph.line( gphysdisp, true )

DCL.grcls


###---------------------------------
###
### ゼロしろ
##
#            'pat'=>[1,10999,15999,20999,      30999,35999,40999,            55999,65999,70999,75999,80999,90999,95999] # 14 色
#            'pat'=>[1,10999,15999,20999,      30999,      40999,      50999,      60999,70999,75999,80999,90999]       # 12 色
# (降水量, 蒸発量)
#            'pat'=>[1,10999,      20999,      30999,      40999,            55999,65999,70999,75999,80999,90999]       # 11 色
###
### non ゼロしろ
##
# (エクスナー関数)
#            'pat'=>[  10999,15999,20999,25999,30999,35999,40999,45999,50999,      67999,70999,80999,85999,90999]
# (水平風, 鉛直風まま)
#            'pat'=>[  10999,15999,20999,25999,30999,      40999,            55999,      70999,75999,80999,90999,95999] # 12 色
# (地表面熱フラックス)
#            'pat'=>[  10999,15999,20999,25999,30999,      40999,            55999,65999,70999,      80999,90999]       # 11 色
#            'pat'=>[  10999,15999,20999,      30999,      40999,            55999,65999,70999,75999,80999,90999]       # 11 色
#            'pat'=>[  10999,      20999,      30999,      40999,            55999,65999,70999,75999,80999,90999]       # 10 色
###
### 試作中
##
# (水蒸気混合比まま)
#            'pat'=>[  10999,15999,20999,      30999,      40999,            55999,65999,70999,75999,80999,90999]       # 11 色
###
###
# (水蒸気混合比たまに)
#            'pat'=>[  10999,15999,20999,      30999,      40999,                  65999,70999,75999,80999,90999]       # 10 色
#            'pat'=>[  10999,15999,20999,      30999,      40999,                  65999,70999,75999,80999,90999]       # 9 色
###
###
### でふぉ
##
# (温度)
#            'pat'=>[  10999,12999,15999,20999,25999,30999,35999,40999,55999,65999,70999,75999,80999,90999,95999] # 15 色
###
###---------------------------------
