#!/usr/bin/ruby #決まり文句 require "numru/ggraph" include NumRu #gp,gpu,gpvにそれぞれ海面気圧、x方向の速度、y方向の速度を格納 gp = GPhys::IO.open( "slp.2019.nc", "slp" ) gpu = GPhys::IO.open( "uwnd.10m.gauss.2019.nc", "uwnd" ) gpv = GPhys::IO.open( "vwnd.10m.gauss.2019.nc", "vwnd" ) #ダウンロードコンテンツ #フォントサイズの調節 DCL.uzfact(0.6) #軸範囲を超えた領域を非表示 DCL.sgpset('lclip',true) #欠損地処理 DCL.glpset('lmiss',true) #ダウンロードコンテンツ終了 #x、y軸にラベルを描く間隔を設定 GGraph.set_axes('xlabelint'=>10) GGraph.set_axes('ylabelint'=>10) #pngファイルとして出力 DCL.swpset("ifl",1) #出力 DCL.gropn(2) #円筒図法で表示 GGraph.set_fig( 'itr'=> 10 ) #海岸線を描画 GGraph.set_map( 'coast_world'=>true ) #繰り返しの開始 for i in 5..10 for j in 0..18 #jが6の倍数のときのみ時刻を設定、描画 if j%6 == 0 then ntime = "2019-09-" + i.to_s + " " + j.to_s + ":00:00" #軸範囲を制限しつつ、表示時刻を6時間ごとになるよう設定。annotateで右上の時刻を表示し、mapaxisで軸を描画、タイトルも設定 GGraph.tone( gp.cut('lon'=>90..180, 'lat'=>0..90, 'time'=>DateTime.parse(ntime)), true, 'annotate'=>true, 'map_axes'=>true, 'max'=>103000, 'min'=>97000, 'nlev'=>30,'title'=>"Sea Level Pressure and Surface Velocity") #カラーバーを表示、線とラベルの間隔を調節 GGraph.color_bar('left'=>true, 'tickintv'=>5, 'labelintv'=>5) #同様にベクトルも描画範囲、時刻を設定したが、重ねて表示するため、falseとした。また、ベクトルの間隔と大きさを設定した。 GGraph.vector( gpu.cut('time'=>DateTime.parse(ntime)),gpv.cut('time'=>DateTime.parse(ntime)), false, "xintv"=>2, "yintv"=>2, "factor"=>3, "unit_vect"=>true) #jが6の倍数でなければ図は描画しない else next #if文終了 end #繰り返しの終了 end end #図の表示を終了 DCL.grcls