require "numru/ggraph"
include NumRu

# 温度から計算した安定度
ncfn = "../fortran/ni3_dcpam_stability_Temp/out/dcpam_stb.nc"
vname = "stb"
gphys = GPhys::IO.open( ncfn, vname )
gphys = gphys.cut('time'=>147655..149994).cut('lat'=>0).mean('time').mean('lon')

# 温位から計算した安定度
ncfn = "../fortran/ni3_dcpam_stability_theta/out/dcpam_theta_stb.nc"
vname = "stb"
gphys2 = GPhys::IO.open( ncfn, vname )
gphys2 = gphys2.cut('time'=>147655..149994).cut('lat'=>0).mean('time').mean('lon')

# VIRA (温度依存あり, Lebbonois)
ncfn = "../fortran/ni3_vira_stability/out/vira_stb_dtemp.nc"
vname = "stb"
gphys_vira = GPhys::IO.open( ncfn, vname )

iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL.gropn(iws)

#DCL.sldiv('y',1,4)
DCL.sgpset('isub', 96)     # control character of subscription: '_' --> '`'
DCL.sgpset('lfull',true)
DCL.uzfact(0.6)            # font size
DCL.sgpset('lclip', true)  # clip graph
DCL.glpset('lmiss',true)   # missing value

GGraph.set_fig 'itr'=> 2, 'viewport'=>[0.25,0.7,0.15,0.6], 'window'=>[-1,14,2E7,1]

#GGraph.tone gphys, true 
#GGraph.contour gphys, false
#GGraph.color_bar

GGraph.line gphys, true, 'exchange'=>true, 'index'=>21, 'legend'=>"from Temp", 'legend_vx'=>0.5
GGraph.line gphys2, false, 'exchange'=>true, 'index'=>41, 'legend'=>"from theta", 'legend_vx'=>0.5, 'annotate'=>false
GGraph.line gphys_vira, false, 'exchange'=>true, 'index'=>31, 'legend'=>"VIRA", 'legend_vx'=>0.5, 'annotate'=>false

DCL.grcls
