# -*- coding: utf-8 -*-
# NetCDF ファイルから画像を切り出す Ruby スクリプト
# main = で NetCDF データを指定

require "numru/ggraph"
include NumRu
include GGraph

#<< Graphic Setting >>
DCL.swpset('iwidth',700)      # window width
DCL.swpset('iheight',700)     # window height
###DCL.swpset('ldump',true)      # dump image files
DCL.swpset('lwait',false)     # do not wait mouse click to show the next page
###DCL.swpset('lalt',true)       # background plot
DCL.sgscmn(10)                # change colomap (see below)
###DCL.sgscmn(5)                 # change colomap (see below)

DCL.gropn(2)
DCL.sgpset('lfprop',true)   # to use the propotional font
DCL.sgpset('lcorner',false) # do not show the corner mark
DCL.sgpset('isub', 96)      # control character of subscription: '_' --> '`'
DCL.glpset('lmiss',true)    # handle data missing

#puts "Please input the time."
#num=gets.chomp
#puts "#{num.to_f}"
num=ARGV[2]
var=ARGV[1].to_s
#puts var
filename=ARGV[0].to_s
main = GPhys::IO.open("#{filename}", "#{var}")
#main = GPhys::IO.open("#{filename}", 'Km')
#main = GPhys::IO.open("#{filename}", 'Exner')
#main = GPhys::IO.open("#{filename}", 'PTemp')
#GGraph.contour( main.cut('t'=>num.to_f) )
#GGraph.tone( main.cut('t'=>num.to_f, 'y'=>0), true, 'levels'=>[-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6])
#GGraph.tone( main.cut('t'=>num.to_f, 'y'=>0), true, 'levels'=>[-0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6])
#GGraph.tone( main.cut('t'=>num.to_f, 'y'=>0), true, 'levels'=>[-0.00006, -0.00005, -0.00004, -0.00003, -0.00002, -0.00001, 0.0, 0.00001, 0.00002, 0.00003, 0.00004, 0.00005, 0.00006])
GGraph.tone( main.cut('t'=>num.to_f, 'y'=>0), true, 'levels'=>[0, 5, 10, 15, 20, 25, 30, 35, 40])
#GGraph.tone( main.cut('t'=>num.to_f, 'y'=>0) )
GGraph.color_bar('vlength'=>0.5,"landscape"=>true,'tickintv'=>0)
