# -*- 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

#IntegPeriod  = 4320000.0e0
#tn = 20
#dt = IntegPeriod / tn

#files = 'nccomb-restart/thermal-moist_restart.nc'
#gphys0 = GPhys::IO.open(files, 'VelX')
#files = /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 = /H2O-l-CloudAll_rank(\d\d\d\d\d\d).nc/
#gphys  = GPhys::IO.open(files, 'H2O-l-CloudAll')

#files = /thermal-moist_ExnerAll_rank(\d\d\d\d\d\d).nc/
#gphys1  = GPhys::IO.open(files, 'ExnerAll')
files1 = 'thermal-moist_ExnerAll.nc'
gphys1  = GPhys::IO.open(files1, 'ExnerAll')
files2 = 'thermal-moist_ExnerAll_TET_CtlPress_atSfc_x256km_z48km.nc'
gphys2  = GPhys::IO.open(files2, 'ExnerAll')


#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.25,0.8,0.10,0.275] )

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


#gphysdisp0 = gphys
#for t in 0..gphys.coord(3).val.size-1
#  for k in 0..gphys.coord(2).val.size-1
#    for j in 0..gphys.coord(1).val.size-1
#      for i in 0..gphys.coord(0).val.size-1
#        gphysdisp0[i,j,k,t] = gphys0[i,j,k] + gphys[i,j,k,t]
#      end
#    end
#  end
#end
#gphysdisp0 = gphys
gphysdisp0 = gphys1
gphysdisp0 = gphysdisp0.mean( 'x' )
gphysdisp0 = gphysdisp0.mean( 'y' )
gphysdisp0 = gphysdisp0.cut( 'z'=>150 )
gphysdisp0 = gphysdisp0.cut( 't'=>0..86400 )
#gphysdisp  = gphysdisp0
gphysdisp1 = gphysdisp0

gphysdisp0 = gphys2
gphysdisp0 = gphysdisp0.mean( 'x' )
gphysdisp0 = gphysdisp0.mean( 'y' )
gphysdisp0 = gphysdisp0.cut( 'z'=>150 )
gphysdisp0 = gphysdisp0.cut( 't'=>0..86400 )
#gphysdisp  = gphysdisp0
gphysdisp2 = gphysdisp0

#GGraph.contour( gphysdisp, true, 'transpose'=>true )
#GGraph.line( gphysdisp, true, 'min' => 0.956, 'max' => 0.996 )
GGraph.line( gphysdisp1, true, 'min' => 0.990, 'max' => 0.996, 'type'=>1 )
GGraph.line( gphysdisp2, false, 'min' => 0.990, 'max' => 0.996, 'type'=>2 )
#GGraph.line( gphysdisp, true )
#GGraph.tone( gphysdisp, true, 'transpose'=>true )
#GGraph.tone( gphysdisp, true, 'transpose'=>true, 
#            'lev'=>[0,0.5e-3,1.0e-3,1.5e-3,2.0e-3,2.5e-3,3.0e-3,3.5e-3,4.0e-3,4.5e-3,5.0e-3,5.5e-3,6.0e-3,6.5e-3,7.0e-3],
#             # レベル＆パターンを陽に指定
#             'pat'=>[10999,12999,15999,20999,25999,30999,35999,40999,55999,65999,70999,75999,80999,90999,95999]
#             'lev'=>[   0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60,  0.65,  0.70, 0.75, 0.80, 0.85,  0.90],
#             'pat'=>[10999,15999,20999,25999,30999,35999,40999,45999,50999,67999,70999,80999,85999,90999]
#)
#GGraph.color_bar
#GGraph.color_bar( 'vlength'=>0.07, 'inffact'=>0.5 )
#GGraph.color_bar( 'vlength'=>0.12, 'inffact'=>1.0 )

### めも ###
###---------------------------------
###
### ゼロしろ
##
#            '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 色



DCL.grcls
