require "numru/ggraph"
include NumRu


x1 = 0
x2 = 512000
#x2 = 500 * 1000 - 500 * 10
z1 = 0
z2 = 30000


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


DCL.gropn(1)
#DCL.gropn(2)
#DCL.sldiv('y',1,3)
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] )

#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 = gphysdisp0.mean( 'x' )
gphysdisp0 = gphysdisp0.mean( 'y' )
gphysdisp  = gphysdisp0

#gphysdisp  = gphysdisp0.cut('t'=>1e5..1e8)

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'=>[1,10999,15999,20999,25999,30999,35999,40999,45999,50999,60999,65999,70999,80999,90999]
# )
GGraph.color_bar

DCL.grcls
