# 全球平均した温度の鉛直分布を描画する
#
# * 2011/10/23 作成

require "numru/ggraph"
include NumRu

dir = '..'
vname = 'Temp'

ts = 2 * 365 * 4 + 1
te = 3 * 365 * 4

gphysw = GPhys::NetCDF_IO.open(dir+'/'+vname+".nc", 'lat_weight')
weight = gphysw.val
weight = weight / weight.sum(0)

gphys = GPhys::IO.open(dir+'/'+vname+".nc", vname)
time = gphys.coord('time').val


# 描画の設定

DCL.gropn(2)
DCL.sgpset('lfull',true)
GGraph.set_fig( 'itr'=> 2, 'viewport'=>[0.25,0.7,0.15,0.6])
#DCL.uzfact(0.75)
DCL.sgpset('lcntl', false)   # 制御文字を解釈しない
DCL.sgpset('lfprop',true)    # プロポーショナルフォントを使う

GGraph.set_axes('xunits'=>'','yunits'=>'','xtitle'=>'','ytitle'=>'') 
#DCL.uxsttl('b','CLT=1800 s',-1) 

# 描画

gphys = gphys.cut('time'=>time[ts]..time[te])

GGraph.line( (gphys * weight.reshape!(1,gphysw.shape[0])).sum(1).mean(0).mean('time'), true, 'exchange'=>true, 'annot'=>false,'titl'=>'')
DCL.grcls
