#!/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 = "./nc/arare_diag-odaka1998-dx200-20050918.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_te = gp_ke + gp_pe

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

gp_te = gp_te 

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