#
# u2df06.rb
#
# $Id: u2df06.rb,v 1.1 2000/11/22 14:35:57 keiko Exp $
#

require "narray"
require "numru/dcl"

include NumRu
include Math


nx = 19
ny = 19
xmin = 0
xmax = 360
ymin = -90
ymax = 90
drad = PI/180
dz = 0.05
p = NArray.sfloat(nx, ny)

#-- data ---
rmiss = DCL::glrget('RMISS')
DCL::gllset('LMISS', true)

for j in 0..ny-1
  for i in 0..nx-1
    alon = (xmin + (xmax-xmin)*i/(nx-1)) * drad
    alat = (ymin + (ymax-ymin)*j/(ny-1)) * drad
    slat = sin(alat)
    if ((i == 2 && j == 14) || ((8 <= i && i <= 11) && (6 <= j && j <= 10)))
      p[i,j]=rmiss
    else
      p[i,j] = cos(alon) * (1-slat**2) * sin(2*PI*slat) + dz
    end
  end
end

#-- graph ---
iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL::gropn iws

DCL::sglset('LSOFTF', true)
DCL::grfrm

DCL::grswnd(xmin, xmax, ymin, ymax)
DCL::grsvpt(0.2, 0.8, 0.2, 0.8)
DCL::grstrn(1)
DCL::grstrf

DCL::usdaxs

DCL::udcntr(p)
DCL::uetone(p)

DCL::grcls

