# Title: Ruby script drawing contour map for deepconv/arare5 output data 
#
# History: 2011/09/27 (Masatsugu Odaka)
#
require "numru/ggraph"
include NumRu

file = 'thermal-dry_PTempAdv.nc'

Adv   = GPhys::IO.open('thermal-dry_PTempAdv.nc',   'PTempAdv'  )
NDiff = GPhys::IO.open('thermal-dry_PTempNDiff.nc', 'PTempNDiff')
Turb  = GPhys::IO.open('thermal-dry_PTempTurb.nc',  'PTempTurb' )
Disp  = GPhys::IO.open('thermal-dry_PTempDisp.nc',  'PTempDisp' )

time  = GPhys::IO.open(file, 't').val

# <Open DCL>
DCL.swlset( 'ldump', true )
DCL.gropn(4)

for i in 0...time.length do
# <Drawing data by GGraph>
#  GGraph.line( var.cut(5500,100,true,time[i]) )

  GGraph.line( Adv.cut(5500,100,true,time[i]), \
               true, 'exchange'=>true , 'index'=>22, 'type'=>1, 'label'=>'adv', \
               'title'=>'Potential Temp. Tendency', 'max'=>5.0e-3, 'min'=>-5.0e-3)    # °ÜÎ®

  GGraph.line( Turb.cut(5500,100,true,time[i]),  \
               false, 'exchange'=>true , 'index'=>42, 'type'=>1, 'label'=>'turb', \
               'max'=>5.0e-3, 'min'=>-5.0e-3)    # ÍðÎ®³È»¶

  GGraph.line( NDiff.cut(5500,100,true,time[i]),  \
               false, 'exchange'=>true , 'index'=>32, 'type'=>1, 'label'=>'ndiff', \
               'max'=>5.0e-3, 'min'=>-5.0e-3)    # ¿ôÃÍ³È»¶

  GGraph.line( Disp.cut(5500,100,true,time[i]),  \
               false, 'exchange'=>true , 'index'=>152, 'type'=>1, 'label'=>'disp', \
               'max'=>5.0e-3, 'min'=>-5.0e-3)    # »¶°ï²ÃÇ®

end
# <Close DCL>
DCL.grcls