#!/usr/bin/env ruby
=begin

=draw_energy.rb

  * $B%(%M%k%.!<$N;~4VJQ2=$N@^$l@~?^$rIA$/(B
  * $B=i4|$N%(%M%k%.!<$KBP$9$kHf$rIA$$$F$$$k(B

=end

require "numru/ggraph"
require "numru/dcl"

include NumRu

file = "/home/kitamo/arare3/arare_diag-odaka1998-dx200-20050917.nc" 
Inittime = 0.0


# open file and initialize GPhys object

gp_ke = GPhys::IO.open(file, "KineticEnergyTotal")
gp_pe = GPhys::IO.open(file, "PotentialEnergyTotal")

# disturb from value at initial time

gp_ke = gp_ke - gp_ke.cut("t"=>Inittime)
gp_pe = gp_pe - gp_pe.cut("t"=>Inittime)

gp_te = gp_ke + gp_pe

DCL.gropn(4)
DCL.sgpset("lcntl", false)
DCL.uzfact(0.7)
GGraph.line(gp_te, true, "index"=>13, "max"=>1.0e+9, "min"=>-8.0e+9)
GGraph.line(gp_pe, false, "index"=>23 )
GGraph.line(gp_ke, false, "index"=>43 )
DCL.grcls
