=begin
= module Draw : rgtview $B$+$i8F$S=P$5$l$kIA2h$*$h$S@_Dj%a%=%C%I(B.

==Index

==GGraph(redef)

==module Draw

---settei_hoge

$BJQ?t(B hoge $BIA2hMQ@_DjItJ,(B.  

=end

module Draw
require "colorbar"
require "numru/ggraph"

=begin

#$B%G%U%)%k%H$N%a%=%C%I(B

  def GGraph::annotate(str_ary)
    charsize = 0.5 * DCL.uzpget('rsizec1')
    dvx = 0.01
    dvy = charsize*1.5
    raise TypeError,"Array expected" if ! str_ary.is_a?(Array)
    vxmin,vxmax,vymin,vymax = DCL.sgqvpt
    vx = vxmax + dvx
    vy = vymax - charsize/2
    str_ary.each{|str|
      DCL::sgtxzv(vx,vy,str,charsize,0,-1,1)
      vy -= dvy
    }
    nil
  end
  
=end


##-----------------------
#  $B@ZCGLL>pJs$NI=<(%a%=%C%I(B

  def GGraph::annotate(str_ary) # GGraph $B$N(B annotate $B%a%=%C%I$r:FDj5A(B
    lnum = 0
    str_ary.each{ |str|lnum += 1 }
    charsize = 0.7 * DCL.uzpget('rsizec1')
    dvx = 0.01
    dvy = charsize*1.5
    raise TypeError,"Array expected" if ! str_ary.is_a?(Array)
    vxmin,vxmax,vymin,vymax = DCL.sgqvpt
    vx = 0.65
    vy = 0.045 + (lnum-1)*dvy
    str_ary.each{|str|
      DCL::sgtxzv(vx,vy,str,charsize,0,-1,1)
      vy -= dvy
    }
    nil
  end

  def GGraph::line(gphys, newframe=true, options=nil)
    if newframe!=true && newframe!=false
      raise ArgumentError, "2nd arg (newframe) must be true or false"
    end
    if ! defined?(@@line_options)
      @@line_options = Misc::KeywordOptAutoHelp.new(
						    ['title', nil, 'Title of the figure(if nil, internally determined)'],
						    ['annotate', true, 'if false, do not put texts on the right margin even when newframe==true'],
						    ['exchange', false, 'whether to exchange x and y axes'],
						    ['index', 1, 'line/mark index'],
						    ['type', 1, 'line type'],
						    ['label', nil, 'if a String is given, it is shown as the label'],
						    ['max', nil, 'maximam value for draw line'],
						    ['min', nil, 'minimam value for draw line']
						    )
    end
    opts = @@line_options.interpret(options)
    gp = gphys.first1D
    if !opts['exchange']
      x = gp.coord(0)
      y = gp.data
      xax = x
      if opts['min']
	ymin = opts['min'].to_f
      else
	ymin = gp.data.val.min
      end
      if opts['max']
	ymax = opts['max'].to_f
      else
	ymax = gp.data.val.max
      end
      yax = VArray.new(NArray[ymin, ymax], gp.data, gp.data.name)      
    else
      y = gp.coord(0)
      x = gp.data
      yax = y
      if opts['min']
	xmin = opts['min'] 
      else
	xmin = gp.data.val.min
      end
      if opts['max']
	xmax = opts['max'] if opts['max']
      else
	xmax = gp.data.val.max
      end
      xax = VArray.new(NArray[xmin, xmax], gp.data, gp.data.name)
    end
    if newframe
      fig(xax, yax)
      axes(xax, yax)
      title( (opts['title'] || gp.data.get_att('long_name')) )
      annotate(gp.lost_axes) if opts['annotate']
    end
    if opts['label']
      lcharbk = DCL.sgpget('lchar')
      DCL.sgpset('lchar',true)
      DCL.sgsplc(opts['label'])
      end
    DCL.uulinz(x.val, y.val, opts['type'], opts['index'])
    DCL.sgpset('lchar',lcharbk) if opts['label']
    nil
  end
  
  
##-----------------------
#  $B%i%$%s%a%=%C%I:FDj5A(B?

  def plot_line_main(gphys_array, line_opts={})
    
    line_index_ary = Array.new; name_ary = Array.new

    default_index = 12

    line_hash = { "index"=> default_index }.update(line_opts)
    line_index_ary.push(default_index)
    name_ary.push(gphys_array[0].data.get_att("line_name"))
    
    GGraph.line( gphys_array[0], true, line_hash )
    gphys_array.size.times{ |num|
      unless num == 0
	line_hash = { "index"=> (num*10 + default_index)}
	line_index_ary.push(num*10 +default_index)
	name_ary.push(gphys_array[num].data.get_att("line_name"))
	GGraph.line( gphys_array[num], false, line_hash ) 
      end
  }


# nc 
#    if $gropn == 2
#
#      charsize = 0.79 - $file_label.size * 0.0115 
#      DCL::sgtxzv(charsize,0.62,$file_label,0.8 * DCL.uzpget('rsizec1'),0,-1,1)
#    else
#      charsize = 0.81 - $file_label.size * 0.0095 
#      DCL::sgtxzv(charsize,0.6,$file_label,0.8 * DCL.uzpget('rsizec1'),0,-1,1) 
#    end

    Draw::__show_line_index(name_ary,line_index_ary) 

  end



##-----------------------
#  $B%i%$%s%$%s%G%C%/%9$N<oN`$rI=<((B

def __show_line_index(str_ary,line_index_ary) 
    charsize = 0.7 * DCL.uzpget('rsizec1')
    dvx = 0.01
    dvy = charsize*1.5
    raise TypeError,"Array expected" if ! str_ary.is_a?(Array)
    vxmin,vxmax,vymin,vymax = DCL.sgqvpt
    vx = 0.15
    vy = 0.12 - charsize/2
  str_ary.size.times{|num|
    DCL::sgtxzv(vx,vy,"--- #{str_ary[num]}", 
		  charsize, 0, -1, line_index_ary[num])
      vy -= dvy
      if num == 3
	vx = 0.30
	vy = 0.12 - charsize/2
      end
  }
    nil
  end


##########################################################
#                  $B?'9g$$(B, $BEyCM@~@_Dj(B                    #
##########################################################

##-----------------------
#  $BEl@>Iw(B
 
  def settei_U(opts) 
    GGraph.set_linear_contour_options('min'=>-50,'int'=>2.5, 'max'=>70)
    levels = NArray[-1000, -15, -5, 0, 5, 15, 25, 1000]
    patterns = NArray[30999, 35999, 40999, 55999, 70999, 75999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>0,
      "tick1"=>20,"tick2"=>1
    }
  end

##-----------------------
#  $BFnKLIw(B

  def settei_V(opts)
    GGraph.set_linear_contour_options('int'=>0.5)
    levels = NArray[-1000, -1.5, -0.5, 0, 0.5, 1.5, 1000]
    patterns = NArray[30999,40999,55999,70999,75999,85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>0,
      "tick1"=>20,"tick2"=>1
    }
  end

##-----------------------
#  $B1tD>Iw(B

  def settei_W(opts)
    GGraph.set_linear_contour_options( 'int'=>0.01)
    levels = NArray[-10, -0.04, -0.02, -0.01, 0.0, 0.01, 0.02, 10]
    patterns = NArray[30999, 35999, 40999, 55999, 70999, 75999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>0,
      "tick1"=>20,"tick2"=>1
    }
  end

##-----------------------
#  $B29EY(B

  def settei_T(opts)
    GGraph.set_linear_contour_options( 'min'=>180, 'max'=>330, 'int'=>10)
    levels = levels = NArray.int(8).indgen!(0, 20)+180
    levels[0] = 150
    patterns = NArray[25999, 30999, 40999, 55999, 70999, 75999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "tick1"=>20,"tick2"=>1
    }
  end

##-----------------------
#  $BI=LL29EY(B

  def settei_SKT(opts)
    GGraph.set_linear_contour_options( 'min'=>180, 'max'=>330, 'int'=>10)
    levels = NArray[190.0, 210.0, 230.0, 250.0, 270.0, 290.0, 310.0]
    patterns = NArray[35999, 45999, 60999, 70999,75999,85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
#      "nobound"=>1,
      "tick1"=>7,"tick2"=>1
    }
  end



##-----------------------
#  $BBPN.@-9_1+(B

  def settei_CP
    $levels = NArray[0.0002, 0.0015, 0.002, 0.0025, 0.003, 0.0035, 1000]
    $patterns = NArray[35999, 45999, 60999, 70999,75999,85999]

    $draw_opts["levels"] =  $levels
    $draw_opts["patterns"] = $patterns

    $cbar_conf = {
      "levels"=>$levels, 
      "colors"=>$patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>7,"tick2"=>1
    }
  end

##-----------------------
#  $BAX>u@-9_1+(B

  def settei_LSP
    $levels = NArray[0.0007, 0.0009, 0.0011, 0.0014, 0.0017, 0.002, 1000]
    $patterns = NArray[35999, 45999, 60999, 70999, 75999, 85999]

    $draw_opts["levels"] =  $levels
    $draw_opts["patterns"] = $patterns

    $cbar_conf = {
      "levels"=>$levels, 
      "colors"=>$patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>7,"tick2"=>1
    }
  end

##-----------------------
#  $BAm9_1+(B

  def settei_TP(opts)
    GGraph.set_linear_tone_options( 'max'=>0.03, 'nlev'=>50, 'min'=>0.003)

    opts["colorbar_opts"] = {
      "tick1"=>100,"tick2"=>10
    }

   return opts
  end

##-----------------------
#  $B9_1+6/EY(B

  def settei_PRATE(opts)
    levels = NArray[0.00005, 0.00006, 0.00007, 0.00008, 0.00009, 0.0001, 1000]
    patterns = NArray[35999, 45999, 60999, 70999, 75999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>7,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B@5L#$NCOI=LLD9GHJ|<M(B

  def settei_NLWRS(opts)
    GGraph.set_linear_contour_options( 'int'=>10)
    levels = NArray[0, 25, 50, 75, 100, 125, 150, 10000]
    patterns = NArray[35999, 45999, 60999, 70999, 75999, 80999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>7,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B>e8~$-COI=LLD9GHJ|<M(B

  def settei_ULWRF(opts)
    levels = NArray[100, 160, 180, 200, 220, 240, 260, 300, 350]
    patterns = NArray[20999, 25999, 35999, 40999, 99999, 95999, 90999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "tick1"=>8,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B%8%*%]%F%s%7%c%k%O%$%H(B

  def settei_HGT(opts)
    GGraph.set_linear_contour_options( 'int'=>50)
    levels = NArray.int(8).indgen!(0, 200)+4800
    levels[0] = 0 
    patterns = NArray[30999, 35999, 40999, 55999, 70999, 75999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>8,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $BAjBP<>EY(B

  def settei_RHUM(opts)
    GGraph.set_linear_contour_options( 'int'=>5)
    levels = NArray.int(11).indgen!(0, 10)
    patterns = NArray[15999, 25999, 30999, 35999, 40999, 50999, 70999, 75999, 80999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "tick1"=>10,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $BHf<>(B

  def settei_SHUM(opts)
    GGraph.set_linear_contour_options('int'=>0.001)
    levels = NArray[0, 0.002, 0.004, 0.006, 0.008, 0.01, 0.012, 0.014, 0.016, 0.018, 0.02]
    patterns = NArray[15999, 25999, 30999, 35999, 40999, 50999, 70999, 75999, 80999, 85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "tick1"=>10,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B@xG.%U%i%C%/%9(B

  def settei_LHTFL(opts)
    GGraph.set_linear_contour_options('int'=>25)
    levels = NArray[0, 50, 100, 150, 200, 250, 10000]
    patterns = NArray[30999,40999,55999,70999,75999,85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>1,
      "tick1"=>10,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B82G.%U%i%C%/%9(B

  def settei_SHTFL(opts)
    GGraph.set_linear_contour_options('int'=>25)
    levels = NArray[0, 1, 10, 20, 50, 100, 10000]
    patterns = NArray[30999,40999,55999,70999,75999,85999]

    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>1,
      "tick1"=>10,"tick2"=>1
    }

   return opts
  end

##-----------------------
#  $B%Q%o!<%9%Z%/%H%k(B

  def settei_PWS(opts)
    GGraph.set_linear_tone_options( 'nlev'=>10)
    opts["colorbar_opts"] = {
      "tick1"=>10,"tick2"=>1
    }
  end

##-----------------------
#  $B<ANLN.@~4X?t(B

  def settei_strm(opts, obj=nil)
    @flag_tonf = true;     @flag_tonc = true # these flag is WITHOUT tonf or c!!
    GGraph.set_linear_contour_options( 'interval'=>1.0e10 )  
    levels = NArray[obj.val.min, 0.0, obj.val.max]
    patterns = NArray[35999,70999]
#    patterns = NArray[1201,1204]
    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>0,
      "tick1"=>7,"tick2"=>1
    }
  end

##-----------------------
#  $B<ANLN.@~4X?t(B

  def settei_strm_rmean(opts, obj=nil)
#    @flag_tonf = true;     @flag_tonc = true # these flag is WITHOUT tonf or c!!
    GGraph.set_linear_contour_options( 'interval'=>1.0e10 )  
    levels = NArray[obj.val.min, 0.0, obj.val.max]
    patterns = NArray[35999,70999]
    opts["levels"] =  levels
    opts["patterns"] = patterns

    opts["colorbar_opts"] = {
      "levels"=>levels, 
      "colors"=>patterns,
      "eqlev"=>true,
      "nobound"=>0,
      "tick1"=>7,"tick2"=>1
    }
  end

##-----------------------
#  $B290L(B

  def settei_Theta
    lev = [370, 400, 450, 500, 600, 700, 800] 
    $levels = NArray::to_na(NArray.int(16).indgen!(200, 10).to_a + lev)
    mj = 1; mn = 1
    $index = [mj, mn]

    $draw_opts["levels"] =  $levels

  end

##-----------------------
#  $BM-8z0LCV%(%M%k%.!<(B

  def settei_Available
    GGraph.set_linear_contour_options( 'nlev'=>30 )  
    levels = NArray[-100, -0.05, 0, 0.05, 0.1, 100] 
    patterns = NArray[35999, 45999, 60999, 70999, 85999]

    $draw_opts["levels"] =  levels
    $draw_opts["patterns"] = patterns

    $cbar_conf = {
      "levels"=>$levels, 
      "colors"=>$patterns,
      "eqlev"=>true,
      "nobound"=>2,
      "tick1"=>7,"tick2"=>1
    }
  end

##-----------------------
#  native

  def settei_native
  end

##-----------------------
#  $B<ANLN.@~4X?t$H29EY(B

  def settei_strm_temp
    GGraph.set_linear_contour_options( 'nlev'=>15 )  
    GGraph.set_linear_tone_options( 'min'=>180, 'nlev'=>90, 'max'=>300 )
  end

##########################################################
#                     $BIA2hJ}K!(B $B@_Dj(B                      #
##########################################################
  
##-----------------------
#  window $B:n@.(B

  def mkwin(vp=[0.15,0.85,0.23,0.58])
    # -f, --file $B%*%W%7%g%s$,M-8z$J$i$P(B dcl.ps $B$KJ]B8(B.
    if ($OPT_f) || ($OPT_file) then
      output = 2
    else
      output = 1  # $B%G%U%)%k%H$OI8=`=PNO$K(B.
    end
    # viewport $B$NBg$-$5(B, $B<4$N@_Dj(B
    GGraph.set_fig('viewport'=>vp)  # set_*: $B=D2#Hf$O(B 2 : 1
    GGraph.set_fig('itr'=> ($OPT_itr).to_i) if ($OPT_itr)  
    GGraph.set_fig( "xrev"=>"units:mb,units:hPa,units:millibar",  
		   "yrev"=>"units:mb,units:hPa,units:millibar") 

    # $BAk3+$/(B
    DCL.gropn(output)

    # $B%U%)%s$H$N@_Dj(B
    DCL.sgpset('lcntl', false) ; DCL.uzfact(0.7)
    DCL.sgpset('lfull', true)  ; DCL.sgpset('lfprop',true)
    DCL.uscset('cyspos', 'B' )              # y $B<4$NC10L$N0LCV$r2<J}$X(B 
  end

##-----------------------
#  $B$*3(IA$-%a%=%C%I=i4|CM(B

  Draw_opts_default = {
    "levels"     => nil,
    "patterns"   => nil,
    "line"       => false,
    "cont"       => true,
    "tone"       => true,
    "colorbar"   => true,
    "colorbar_opts" => nil,
    "annot"     => true,
    "map"        => false,
    "exchange"        => false,
    "min"        => false,
    "max"        => false,
    "filename"   => nil
     }

##-----------------------
#  $B$*3(IA$-%a%$%s%a%=%C%I(B

  def draw(gphys, frame_flag, options=Draw_opts_default)

    # check missing valu if gphys.data.val.is_a?(NArrayMiss) for nam
    if gphys.data.val.is_a?(NArrayMiss)
      rmiss  = (gphys.data.val.max * 2)
      grid =   gphys.grid_copy
      data = gphys.data + 0
      nam = data.val.dup
      nam.set_missing_value(rmiss)
      data.replace_val(nam)
      gphys = GPhys.new(grid, data)
      before = DCLExt.gl_set_params('lmiss'=>true,'rmiss'=>rmiss)
    end

    # check use tonf or tonc 
    if @flag_tonf
      flag_tonf = false
    elsif
      flag_tonf = true
    end
    if @flag_tonc
      flag_tonc = false
    elsif
      flag_tonc = true
    end

    # set options
    levels = options["levels"]
    patterns = options["patterns"]

    if (options["line"] || gphys.data.val.dim == 1) 
      draw_flag = "line"
    elsif (!options["line"] && options["mark"])
      draw_flag = "mark"
    elsif (!options["line"] && gphys.data.val.dim >= 2) && options["tone"] && options["cont"] 
      draw_flag = "full"
    elsif (!options["line"] && gphys.data.val.dim >= 2) && options["tone"] && !options["cont"] 
      draw_flag = "nocont"
    elsif (!options["line"] && gphys.data.val.dim >= 2) && !options["tone"] && options["cont"] 
      draw_flag = "noshade"
    end

    case draw_flag
    when "line"
      GGraph.line(gphys, frame_flag, "min"=>options["min"], "max"=>options["max"])
    when "mark"
      GGraph.mark(gphys, frame_flag)
    when "full"
      if levels && patterns
        GGraph.tone(gphys,
		  frame_flag, 
		  "lev"=>levels, 
		  "patterns"=>patterns, 
		  "tonf"=>flag_tonf, 
		  "tonc"=>flag_tonc,
		  "annot"=>options["annot"],
#		  "exchange"=>($OPT_exch),
		  "title"=>$title
		  )
      else
        GGraph.tone(gphys,
	  	    frame_flag, 
		    "annot"=>options["annot"],
		    "tonf"=>flag_tonf, 
		    "tonc"=>flag_tonc,
#		    "exchange"=>($OPT_exch),
		    "title"=>$title
		    )
      end
      GGraph.contour(gphys, false, "annot"=>options["annot"])
    when "nocont"
      if levels && patterns
        GGraph.tone(gphys,
		  frame_flag, 
		  "lev"=>levels, 
		  "patterns"=>patterns,
		    "tonf"=>flag_tonf, 
		    "tonc"=>flag_tonc, 
		  "annot"=>options["annot"],
#		  "exchange"=>($OPT_exch),
		  "title"=>$title
		  )
      else
        GGraph.tone(gphys,
	  	    frame_flag, 
		    "title"=>$title,
		    "tonf"=>flag_tonf, 
		    "tonc"=>flag_tonc, 
#		    "exchange"=>($OPT_exch),
		    "annot"=>options["annot"]
		    )
      end
    when "noshade"
      mj = DCL.udpget('indxmj')
      mn = DCL.udpget('indxmn')
      GGraph.contour(gphys, 
		     frame_flag, 
		     "title"=>$title,
		     "annot"=>true,#options["annot"],
		     "levels"=>levels,
		     "index" =>[mj,mn],
#		     "exchange"=>($OPT_exch),
		     "label" =>true
		   )
    end

    # print unit
    DCL::sgtxzv(0.78,0.58+0.02,"(units:#{gphys.data.units.to_s})",
	        0.7*DCL.uzpget('rsizec2'),0,0,3)    
    # print filename
    DCL::sgtxzv(0.27,0.58+0.02,"[#{options["filename"]}]",
	        0.5*DCL.uzpget('rsizec2'),0,0,3)  if options["filename"]



    # $BCO?^IA2h(B
    DCL.draw_map                    if options["map"]
    unless (draw_flag == "mark" ||  draw_flag == "line")
      if (options["colorbar"] && options["tone"] )
        DCL::Util::color_bar(options["colorbar_opts"])  if !options["colorbar_opts"].nil?
        DCL::Util::color_bar              if options["colorbar_opts"].nil?
      end
    end

    DCL.ueitlv  # $B?'@_Dj$rGr;f$K(B 

  end

##-----------------------
#  window $BJD$8$k(B

  def clwin
    DCL.grcls       
  end

##-----------------------
#  $BCO?^IA2h(B

  def draw_map(vp=[0.15,0.85,0.23,0.58])
    DCL::grfig                           # $B2~%Z!<%8$7$J$$(B
    DCL::grstrn(10)                      # $B@55w1_E{?^K!(B
    DCL::grswnd(0.0,360.0,-90.0,90.0)    # $B0^EY7PEY$r@_Dj(B
    DCL::grsvpt(vp[0],vp[1],vp[2],vp[3])
    DCL::umpfit                          # $B$"$H$O$*$^$+$;(B
    DCL::grstrf                          # $B3NDj(B
    DCL::umpmap("coast_world")           # $BCO?^$rIA$/(B
  end

end
