require "numru/ggraph"
include NumRu

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

#gphys1 = GPhys::IO.open('arare-earth_PotTemp.nc', 'PotTemp')
gphys1 = GPhys::IO.open('../../netCDF/thermal-moist_Km.nc', 'Km')
#gphys2 = GPhys::IO.open('arare-earth_BasicZ.nc', 'PotTempBasicZ')

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

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

###--- Draw with contour ---###
#  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'=>[-12.0,-9.0,-7.0,-5.0,-3.0,-2.0,-1.0,0,1.0,2,3.0,5.0,7.0,9.0,11.2],'patterns'=>[11999,13999,15999,20999,27999,39999,50999,69999,73999,76999,79999,86999,92999,96999,98999] )
# ひとまず 0.25 ～ 320 で Fix
#  GGraph.set_tone_levels( 'levels'=>[-36.0,-30.0,-24.0,-18.0,-12.0,-6.0,-2.0,-1.5,-1.0,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1.0,1.5,2.0,4.0,8.0,12.0,18.0],'patterns'=>[11999,14999,18999,22999,26999,29999,329999,35999,38999,41999,44999,47999,50999,54999,58999,62999,64999,68999,73999,78999,83999,88999,93999,98999] )
  GGraph.set_tone_levels(
   'levels'=>[0,25.0,50.0,75.0,100.0,125.0,150.0,175.0,200.0,230.0,260.0,290.0,320.0],
   'patterns'=>[11999,13999,15999,20999,27999,39999,50999,69999,73999,76999,79999,86999,92999] ) # ,96999,98999] )

###--- 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, y=100, true, tn*dt) )
#  GGraph.tone( ( gphys1 ).cut(true, y=100, true, t=0) )

###--- Draw side tone var ---###
  ###--- labelintv でバーの横に数値を入れる間隔を指定 ---###
GGraph.color_bar("landscape"=>false,'labelintv'=>3)


DCL.grcls

