require "numru/gphys"
require "numru/dcl"
require "./colorbar"

include NumRu

filename = ARGV[0]
varname = "VelX"
gphys0 = GPhys::NetCDF_IO.open(filename,varname)
gphys0 = gphys0[0..-1,0,0..-1]

if ARGV.index("-ps") then
  DCL::gropn(2)
else
  DCL::gropn(4)
end

xmin = 0.0
xmax = 10000.0
ymin = 0.0
ymax = 20.0

vxmin = 0.2
vxmax = 0.8
vymin = 0.2
vymax = 0.8

x_title = "x"
x_unit = "m"
y_title = "t"
y_unit = "s"

DCL::sglset("LCNTL", false )
DCL::udlset("LMSG", false )
DCL::uglset("LMSG", false )
DCL::gllset("LMISS", true )

DCL::grfrm
DCL::grswnd(xmin,xmax,ymin,ymax)
DCL::grsvpt(vxmin,vxmax,vymin,vymax)
DCL::grstrn(1)
DCL::grstrf

DCL::sglset("LCLIP", true )
DCL::uwsgxa(gphys0.coord(0).val)
DCL::uwsgya(gphys0.coord(1).val)
DCL::ueitlv
DCL::uegtla(-4.0, 4.0, 0 )
DCL::uetone(gphys0.val)
DCL::udgcla(-4.0, 4.0, 0 )
DCL::udcntz(gphys0.val)
DCL::ussttl(x_title, x_unit, y_title, y_unit)
DCL::usdaxs
DCL::sglset("LCLIP", false )
i=0
DCL::sgtxzr(vxmax+0.01,vymax-0.03*i,"z=200 m",0.02,0,-1,1)
DCL::uzrset("ROFFXT", 0.06)
title = "VelX(m/s)"
DCL::uxsttl("t", title, 0 )

MyTool::colorbar(-4.0, 4.0)

DCL::grcls
