module NumRu::DCLExt

An extension of RubyDCL.

Index

Original methods

MATH1

GRPH1

GRPH2

Module Functions

glpack

gl_set_params(hash)

Calls DCL.glpset multiple times (for each key and val of hash).

ARGUMENTS

RETURN VALUE

EXAMPLES

sgpack

sg_set_params(hash)

Calls DCL.sgpset multiple times (for each key and val of hash).

See gl_set_params for usage.

slpack

sl_set_params(hash)

Calls DCL.slpset multiple times (for each key and val of hash).

See gl_set_params for usage.

swpack

sw_set_params(hash)

Calls DCL.swpset multiple times (for each key and val of hash).

See gl_set_params for usage.

uzpack

uz_set_params(hash)

Calls DCL.uzpset multiple times (for each key and val of hash).

See gl_set_params for usage.

ulpack

ul_set_params(hash)

Calls DCL.ulpset multiple times (for each key and val of hash).

See gl_set_params for usage.

ucpack

uc_set_params(hash)

Calls DCL.ucpset multiple times (for each key and val of hash).

See gl_set_params for usage.

uupack

uu_set_params(hash)

Calls DCL.uupset multiple times (for each key and val of hash).

See gl_set_params for usage.

uspack

us_set_params(hash)

Calls DCL.uspset multiple times (for each key and val of hash).

See gl_set_params for usage.

udpack

ud_set_params(hash)

Calls DCL.udpset multiple times (for each key and val of hash).

ARGUMENTS

RETURN VALUE

EXAMPLES

ud_set_linear_levs(v, options)

Set contour levels with a constant interval

ARGUMENTS

ud_set_contour(levels,index=nil,line_type=nil,label=nil,label_height=nil)

Set contours of at specified levels.

Normally you do not have to specify label and label_height.

It calls DCL.udsclv for each level. So the arguments are basically the same as DCL.udsclv, but only levels are mandatory here.

ARGUMENTS

If nil, the value of 'indxmn' is used.

RETURN VALUE

ud_add_contour(levels,index=nil,line_type=nil,label=nil,label_height=nil)

Same as ud_set_contour, but does not clear the contour levels that have been set.

uepack

ue_set_params(hash)

Calls DCL.uepset multiple times (for each key and val of hash).

See gl_set_params for usage.

ue_set_linear_levs(v, options)

Set tone levels with a constant interval

ARGUMENTS

ue_set_tone(levels, patterns)

Set tone levels and patterns.

patterns are set between levels as follows:

when (levels.length == patterns.length+1)

  levels[0]  |  levels[1]  |  levels[2]  ...  |  levels[-2]  |  levels[-1]
         patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

when (levels.length == patterns.length)

  levels[0]  |  levels[1]  |  levels[2]  ...  |  levels[-1]  |  +infty
         patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

when (levels.length == patterns.length-1)

  -infty  |  levels[0]  |  levels[1]  ...  |  levels[-1]  |  +infty
      patterns[0]   patterns[1]   ...  patterns[-2]   patterns[-1]

else
  error (exception raised)

ARGUMENTS

RETURN VALUE

ue_add_tone(levels, patterns)

Same as ue_set_tone, but does not clear the tone levels that have been set.

ugpack

ug_set_params(hash)

Calls DCL.ugpset multiple times (for each key and val of hash). See gl_set_params for usage.

umpack

um_set_params(hash)

Calls DCL.umpset multiple times (for each key and val of hash).

See gl_set_params for usage.

Original methods:

Date and time axes

datetime_ax(date_from, date_to, options=nil)

Draw axes with date and hours. The DCL window must have been defined in the units "days" and to start with 0 (regarding the direction to draw the axis).

ARGUMENTS

date_ax(date_from, date_to, options=nil)

Similar to datetime_ax but draws a calendar axis in terms of date (not hours). This method uses DCL's UCPACK (DCL.uc[xy]acl) when appropritate; i.e., when the period is short enough (typically with in a few years) so that year labels are written. Unfortunately, the current uc[xy]acl (or uc[xy]yr) suppress year labels when the period is long to write year albels for each year. In such a case, this method uses DCLExt.year_ax. Note that future uc[xy]acl may cover all the situation, so this method will not be needed.

ARGUMENTS

Longitude/Latitude Axes

lon_ax( options=nil )

Draw longitude axis. (label format: degrees + 'E' or 'W')

ARGUMENTS

lat_ax( options=nil )

Draw latitude axis. (label format: degrees + 'N' or 'S')

ARGUMENTS

Vectors

unit_vect( vxfxratio, vyfyratio, fxunit=nil, fyunit=nil, options=nil )

Show the "unit vector", which indicate the vector scaling.

ARGUMENTS

unit_vect_single(vfratio, flen, options=nil )

Draw a unit vector (only one arrow is drawn). Suitable to called after flow_vect_anyproj.

ARGUMENTS

set_unit_vect_options(options)

Change the default option values for unit_vect.

next_unit_vect_options(options)

Set the option values effective only in the next call of unit_vect

flow_vect( fx, fy, factor=1.0, xintv=1, yintv=1)

2D Vector plot. Unlike DCL::ugvect, scaling are made in term of the physical (or "U") coordinate.

This method is meant to substitute DCL::ugvect. The scaling is made in terms of the U coordinate. This method is suitable to show vectors such as velocity, since the arrow direction represets the direction in the U coordinate. Also, one can re-scale the vector length easily by using the argument factor.

Currently, this method is not compatible with map projection, since it calls DCL::ugvect internally.

ARGUMENTS

flow_vect_anyproj(fx, fy, xg, yg, factor=1.0, xintv=1, yintv=1, distvect_map=true, vfratio=nil)

flow_vect that can be used under any of the projections supported by DCL. Arrows drawn by this method have lengths proportional to sqrt(fx**2+fy**2), and their directions are properly directed locally (consistent with the local coordinate). A special treatment is made for map projections if distvect_map==true (see below). Singular points of the projection is heuristically handled (see the source code for details).

ARGUMENTS

RETURN VALUE

flow_itr5( fx, fy, factor=1.0, unit_vect=false )

2D Vector plot on the polar coodinate.

This method just perform rotatation of the vector in U-coordinate to N-coordinate and passed to DCL.ugvect.

ARGUMENTS

Color bars

set_color_bar_options(options)

To set options of color_bar effective in the rest.

color_bar(options=nil)

Others

legend(str, type, index, line=false, size=nil, vx=nil, dx=nil, vy=nil, first=true, mark_size=nil)

Annotates line/mark type and index (and size if mark). By default it is shown in the right margin of the viewport.

quasi_log_levels_z(vals, nlev=nil, max=nil, min=nil, cycle=1)

Driver of quasi_log_levels with data values

quasi_log_levels(lev0, lev1, cycle=1)

Returns approximately log-scaled contour/tone levels as well as major/minor flags for contours. No DCL call is made in here.

RETURN VALUE:

DCL.sgpset('lclip',true)

for itr in [10,12]
  DCL.grfrm
  DCL.grstrn(itr)
  DCL.grsvpt(0.1,0.9,0.25,0.75)
  DCL.umscnt(180, 0, 0)
  DCL.grswnd(xdeg[0],xdeg[-1],ydeg[0],ydeg[-1])
  DCL.grstxy(-180, 180, -90, 90 )
  DCL.umpset('lglobe', true)
  DCL.umpfit
  DCL.grstrf
  DCL.udcntz(z)
  vfratio, flenmax = DCLExt.flow_vect_anyproj(u, v, xdeg, ydeg)
  DCLExt.unit_vect_single(vfratio, flenmax)
  DCL.umplim
end

itr = 30
DCL.grfrm
DCL.grstrn(itr)
DCL.grsvpt(0.1,0.9,0.1,0.9)
DCL.umscnt(180, 90, 0)
DCL.grswnd(xdeg[0],xdeg[-1],ydeg[0],ydeg[-1])
DCL.grssim(0.3,0,0)
DCL.grstxy(-180, 180, 10, 90 )
DCL.umpset('lglobe', true)
DCL.umpfit
DCL.grstrf
DCL.udcntz(z)
vfratio, flenmax = 
  DCLExt.flow_vect_anyproj(u[true,ny/2+1..-1], v[true,ny/2+1..-1],
                              xdeg, ydeg[ny/2+1..-1])
DCLExt.unit_vect_single(vfratio, flenmax)
DCL.umplim

itr = 30
DCL.grfrm
DCL.grstrn(itr)
DCL.grsvpt(0.1,0.9,0.1,0.9)
DCL.umscnt(180, 30, 0)
DCL.grswnd(xdeg[0],xdeg[-1],ydeg[0],ydeg[-1])
DCL.grssim(0.3,0,0)
DCL.grstxy(-180, 180, 0, 90 )
DCL.umpset('lglobe', true)
DCL.umpfit
DCL.grstrf
#DCL.udcntz(z[true,ny/2+1..-1])
DCL.uepset("ltone",true)
DCL.udcntz(z[true,ny/2+1..-1])
vfratio, flenmax = 
  DCLExt.flow_vect_anyproj(u, v,
                              xdeg, ydeg,
                              1.0,1,1,true,nil,0.3)
  #DCLExt.flow_vect_anyproj(u[true,ny/2..-1], v[true,ny/2..-1],
  #                            xdeg, ydeg[ny/2..-1])
DCLExt.unit_vect_single(vfratio, flenmax)
DCL.umplim

## for datetime_ax
date_from = DateTime.parse('2005-06-30 17:00')
date_to = DateTime.parse('2005-07-01 5:00')
date_from2 = DateTime.parse('2005-06-29 17:00')
date_to2 = DateTime.parse('2005-07-02 5:00')

any_offst = 10

DCL.grfrm
DCL.grswnd(0.0, date_to-date_from, any_offst, date_to2-date_from2+any_offst)
DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
DCL.grstrn(1)
DCL.grstrf
DCLExt.datetime_ax(date_from,  date_to,                 'year'=>true)
DCLExt.datetime_ax(date_from,  date_to, 'cside'=>'t',   'year'=>true)
DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true)
DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true, 'cside'=>'r')
DCL.uxsttl('b','TIME AND DATE',0.0)
DCL.uysttl('l','TIME AND DATE',0.0)

DCL.grfrm
DCL.grswnd(0.0, date_to-date_from, 0, date_to2-date_from2)
DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
DCL.grstrn(1)
DCL.grstrf
DCL.uzpset('inner',-1)
DCLExt.datetime_ax(date_from,  date_to,               'dtick2'=>2)
DCLExt.datetime_ax(date_from,  date_to, 'cside'=>'t', 'dtick2'=>2)
DCL.uzpset('inner',1)
DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true, 
                   'dtick1'=>2, 'dtick2'=>24)
DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true, 'cside'=>'r',
                   'dtick1'=>2, 'dtick2'=>24)
DCL.uxsttl('b','TIME AND DATE',0.0)
DCL.uysttl('l','TIME AND DATE',0.0)

## for date_ax
date_from = DateTime.parse('1995-06-30 17:00')
date_to = DateTime.parse('2000-02-01 5:00')
any_offst = 10

3.times do
  DCL.grfrm
  DCL.grswnd(0.0, date_to-date_from, any_offst, date_to-date_from+any_offst)
  DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
  DCL.grstrn(1)
  DCL.grstrf
  #DCL.uzpset("irotcyl",0)
  #DCL.uzpset("irotcxb",1)
  DCLExt.date_ax(date_from,  date_to)
  DCLExt.date_ax(date_from,  date_to, "yax"=>true)
  date_to = date_to >> 15*12
end