#!/usr/bin/ruby
require "numru/ggraph"
include NumRu

gp = GPhys::IO.open("air.mon.mean.nc","air")  #譛亥ケウ蝮�ー玲クゥ縺ョ繝��繧ソ
gp = gp.cut('lon'=>135,'lat'=>35)             #譚ア邨�135蠎ヲ縲∝圏邱ッ35蠎ヲ繧帝∈謚�

DCL.swpset("ifl",1) #png縺ァ蜃コ蜉�
DCL.gropn(2)

GGraph.set_fig('itr'=>1)  #荳。霆ク邱壼ス「繧ー繝ゥ繝�

yr = 1980   #蟷エ縺ョ險ュ螳�
id = 10     #邱壹�濶イ縺ョ險ュ螳�

#蝓コ貅悶→縺吶k1980蟷エ縺ョ貂ゥ蠎ヲ蛻�ク�
gp80 = gp.cut('time'=>DateTime.parse(yr.to_s + "-08-01 00:00:0.0"))
#1980蟷エ縺ョ繝��繧ソ縺ァ隕乗�シ蛹悶&繧後◆1980蟷エ縺ョ貂ゥ蠎ヲ蛻�ク�シ医▽縺セ繧�1��
gpy = gp.cut('time'=>DateTime.parse(yr.to_s + "-08-01 00:00:0.0")) / gp80
GGraph.line(gpy,true,"exchange"=>true,"min"=>0.5,"max"=>2)

for i in 1..4   #1990~2020

  yr = yr + 10  #蜈医�繝��繧ソ縺ョ蜊∝ケエ蠕�
  id = id + 10  #邱壹�濶イ縺ョ螟画峩:鮟停�襍、竊堤キ鯛�髱停�鮟�

  #1980蟷エ縺ァ隕乗�シ蛹悶&繧後◆蜷�ケエ縺ョ貂ゥ蠎ヲ蛻�ク�
  gpy = gp.cut('time'=>DateTime.parse(yr.to_s + "-08-01 00:00:0.0")) / gp80
  GGraph.line(gpy,false,"exchange"=>true,"index"=>id,"min"=>0.5,"max"=>2)

end

DCL.grcls