require "numru/ggraph"
include NumRu

#DCL.gropn(2)
DCL.gropn(4)

gphys1 = GPhys::IO.open('../../netCDF/thermal-moist_H2O-l-Cloud.nc', 'H2O-l-Cloud')
#gphys1 = GPhys::IO.open('arare-earth_H2O-l-Cloud.nc', 'H2O-l-Cloud')
#gphys2 = GPhys::IO.open('arare-earth_BasicZ.nc', 'H2O-l-CloudBasicZ')

###--- 引き数を置き変える ---###
tn = ARGV[0].to_i
dt = ARGV[1].to_i

###--- 定数の設定確認 ---###
#print tn
#printf ("\n")
#print dt     #, tmin, tmax
#printf ("\n")

###--- Draw with contor ---###
#  GGraph.contour( ( ( gphys1 ).cut(true, true, tn*86400  ) + gphys2 )  -  ( ( gphys1 ).cut(true, true, tn*86400 ).mean( 'x' ) + ( gphys2 ).mean( 'x' ) ) )

###--- Fix the tone level ---###
# 今関さんスクリプト (雲水混合比の絵をかく用) からぱくってきたもの
#GGraph.set_tone_levels( 'levels'=>[0,0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0008,0.001,0.0015,0.002,0.0025,0.0036],'patterns'=>[13999,15999,20999,27999,39999,50999,69999,73999,76999,79999,86999,92999,96999] )
# 下限を 0, 上限を 0.002 とした
GGraph.set_tone_levels( 
#  'levels'=>[-0.007,-0.006,-0.005,-0.004,-0.003,-0.002,-0.001,-0.0005,0,0.0005,0.001,0.002],
  'levels'=>[0,0.0001,0.0002,0.0004,0.0006,0.0008,0.001,0.0012,0.0014,0.0016,0.0018,0.002],
  'patterns'=>[13999,15999,20999,27999,39999,50999,69999,73999,76999,79999,86999,92999] )
#  'patterns'=>[13999,15999,20999,27999,39999,50999,69999,73999,76999,79999,86999] )

###--- Draw with tone ---###
  DCL.sgpset('lcntl', false)
#  GGraph.tone( ( ( gphys1 ).cut(true, true, tn*dt) + gphys2 )  -  ( ( gphys1 ).cut(true, true, tn*dt).mean( 'x' ) + ( gphys2 ).mean( 'x' ) ) )
#  GGraph.tone( ( gphys1 ).cut(true, true, tn*dt) + gphys2 ) ) 
  GGraph.tone( ( gphys1 ).cut(true, y=100, true, tn*dt) )
#  GGraph.tone( ( gphys1 ).cut(true, y=100, true, 100) )

###--- Draw side tone var ---### 
GGraph.color_bar("landscape"=>false,'labelintv'=>3)

DCL.grcls


