=begin

=exner-line.rb

$B%(%/%9%J!<4X?t$N=i4|J,I[$N@^$l@~?^$rIA$/(B

=end

require "numru/gphys"
require "numru/dcl"

include NumRu


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

if ARGV.index("-x")
  gphys0 = gphys0[0..-1,0,0]
  x_title = "x"
  x_unit = "m"
elsif ARGV.index("-z")
  gphys0 = gphys0[0,0..-1,0]
  x_title = "z"
  x_unit = "m"
elsif ARGV.index("-t")
  gphys0 = gphys0[0,0,0..-1]
  x_title = "t"
  x_unit = "s"
else
  gphys0 = gphys0[0..-1,0,0]
  x_title = "x"
  x_unit = "m"
end
y_title = "Exner"
y_unit = "1"

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

xmin = 0.0
xmax = 10000.0
ymin = 0.998
ymax = 1.008

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

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::sgplzu(gphys0.coord(0).val, gphys0.val, 1, 3 )
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=3000 m",0.02,0,-1,1)
i=1
DCL::sgtxzr(vxmax+0.01,vymax-0.03*i,"t=0 s",0.02,0,-1,1)
title = "Exner(1)"
DCL::uxsttl("t", title, 0 )

DCL::grcls

