# -*- coding: euc-jp -*-
require "numru/ggraph"
include NumRu


dir  = '.'
vname = 'PRCP'

gphys = GPhys::NetCDF_IO.open(dir+'/'+vname+".nc", vname)

gphysout = gphys.cut('lon'=>0).cut('lat'=>0)#.cut('time'=>times..timee)


gphysobs = GPhys::NetCDF_IO.open('./TWP-ICE_Obs_PRs.nc', 'PRs')

# unit conversion
timeunit = gphysout.coord('time').units
z = gphysobs.axis('time').pos.convert_units( Units[timeunit] )
gphysobs.axis('time').set_pos(z)


#gphysout = gphysout / 1000.0 * 1000 * 3600
#gphysout.units = 'mm hr-1'

#< DCLのオープンと設定 >
DCL.gropn(4)
#DCL.sldiv('y',2,2)           # 2x2に画面分割, 'y'=yoko: 左上→右上→左下...
DCL.sgpset('lcntl', false)   # 制御文字を解釈しない
DCL.sgpset('lfull',true)     # 全画面表示
DCL.uzfact(0.75)             # 座標軸の文字列サイズを 0.75 倍
DCL.sgpset('lfprop',true)    # プロポーショナルフォントを使う


#< GGraph による 描画 >
GGraph.set_fig 'itr'=>1, 'viewport'=>[0.15,0.85,0.15,0.6]#, 'window'=>[gphystime.val[0],gphystime.val[-1],sigs,sige]

GGraph.line( gphysout, true , 'annotate'=>false, 'legend'=>'model', 'index'=>20, 'min'=>0, 'max'=>30e-4 )
GGraph.line( gphysobs, false, 'annotate'=>false, 'legend'=>'Obs', 'index'=>40 )

DCL.grcls

