#!/usr/bin/ruby # coding: utf-8 require "numru/ggraph" include NumRu # NetCDFファイル "air.mon.mean.nc"から変数"air"を読み,GPhysオブジェクトgpに格納 gp = GPhys::IO.open( "air.mon.mean.nc", "air" ) # 経度を-30度から60度に切り取り # 緯度を-40度から40度に切り取り gp = gp.cut('lon'=>-30..60, 'lat'=>-40..40) # pngファイルに出力 DCL.swpset("ifl",1) DCL.gropn(2) # 両軸を線形にする GGraph.set_fig( 'itr'=>10) # 海岸線とグリッドを描画 GGraph.set_map( 'coast_world'=>true, 'grid'=>true ) # 12枚の絵に対して行う操作 for i in 1..12 time_label = "2020-" + i.to_s + "-01 00:00:0.0" #時間を2020年1月1日00:00からスタート print i, " : ", time_label, "\n" # 出力の際の経過を画面に表す GGraph.tone( gp.cut('time'=>DateTime.parse(time_label)), true, 'annotate'=>true, 'map_axes'=>true, 'min'=>0, 'max'=>50 ) # 最小値最大値の設定 GGraph.color_bar # カラーバーを描画 end DCL.grcls # 画面を閉じる