○ 球面 2 次元スペクトルモデルデータ用クラス(data.rb)
class DATA
require "narray"
require "ispack2.so"
attr_accessor :mm, :im, :jm
attr_accessor :grid, :spect
attr_accessor :omega
@@q, @@r, @@it, @@t = nil
def initialize(m, j, i)
@mm = m
@jm = j
@im = i
@@q, @@r, @@it, @@t = Ispack2.stinit(@mm, @jm, @im) if @@q == nil
@grid = nil
@spect = nil
end
def latitude
y, x = Ispack2.stogrd(@jm, @im, @@q)
return y
end
def jacobian(a)
return Ispack2.stajba(@mm, @jm, @im, self.spect, a.spect, @@q, @@r, @@it, @@t)
end
def volticity(a)
return Ispack2.stvrsa(@mm, @jm, @im, self.grid, a.grid, @@q, @@r, @@it, @@t)
end
def laplacian
return Ispack2.stclfa(@mm, self.spect)
end
def absolute_volticity
return Ispack2.ndtv2a(@mm, @omega, self.spect)
end
def to_stream_func
psi = self.dup
psi.spect = Ispack2.ndca2p(@mm, @omega, self.spect)
return psi
end
def energy
return Ispack2.ndgeea(@mm, self.spect)
end
def enstrophy
return Ispack2.ndgena(@mm, self.spect)
end
end