An extension of RubyDCL.
Original methods
DCL::ugvect
, scaling are made in term of the physical (or "U") coordinate.MATH1
DCL.glpset
multiple times (for each key and val of hash
).GRPH1
DCL.sgpset
multiple times (for each key and val of hash
).DCL.slpset
multiple times (for each key and val of hash
).DCL.swpset
multiple times (for each key and val of hash
).GRPH2
DCL.uzpset
multiple times (for each key and val of hash
).DCL.ulpset
multiple times (for each key and val of hash
).DCL.ucpset
multiple times (for each key and val of hash
).DCL.uupset
multiple times (for each key and val of hash
).DCL.uspset
multiple times (for each key and val of hash
).DCL.udpset
multiple times (for each key and val of hash
).DCL.uepset
multiple times (for each key and val of hash
).DCL.ugpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.DCL.umpset
multiple times (for each key and val of hash
).gl_set_params(hash)
Calls DCL.glpset
multiple times (for each key and val of hash
).
ARGUMENTS
RETURN VALUE
EXAMPLES
You can modify parameters temporarily as follows.
before = DCLExt.gl_set_params({'lmiss'=>true,'rmiss'=>9999.0}) .... DCLExt.gl_set_params(before) # reset the change
sg_set_params(hash)
Calls DCL.sgpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
sl_set_params(hash)
Calls DCL.slpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
sw_set_params(hash)
Calls DCL.swpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
uz_set_params(hash)
Calls DCL.uzpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
ul_set_params(hash)
Calls DCL.ulpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
uc_set_params(hash)
Calls DCL.ucpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
uu_set_params(hash)
Calls DCL.uupset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
us_set_params(hash)
Calls DCL.uspset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
ud_set_params(hash)
Calls DCL.udpset
multiple times (for each key and val of hash
).
ARGUMENTS
RETURN VALUE
EXAMPLES
You can modify parameters temporarily as follows.
before = DCLExt.ud_set_params('indxmj'=>4,'lmsg'=>false) DCL.udcntz(data) DCLExt.ud_set_params(before) # reset the change
ud_set_linear_levs(v, options)
Set contour levels with a constant interval
ARGUMENTS
options (Hash) : option specification by keys and values. Available options are
name default value description 'min' nil minimum contour value (Numeric) 'max' nil maximum contour value (Numeric) 'nlev' nil number of levels (Integer) 'interval' nil contour interval (Numeric) 'nozero' nil delete zero contour (true/false) 'coloring' false set color contours with ud_coloring (true/false) 'clr_min' 13 (if coloring) minimum color id (Integer) 'clr_max' 99 (if coloring) maximum color id (Integer)
Here, interval
has a higher precedence over nlev
.
Since all the default values are nil, only those explicitly specified
are interpreted. If no option is provided, the levels generated will
be the default ones set by udcnt[rz] without any level specification.
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
levels
, the same Array is repeated (so
for instance [1,1,3] is interpreted as [1,1,3,1,1,3,1,1,3,...]).
If it is a single Integer, all the contour will have the same index.If nil, the value of 'indxmn' is used.
levels
, the same Array is repeated.
the length must agree with that of levels
.
If it is a single Integer, all the contour will have the same type.
If nil, set to be 1.levels
, the same Array is repeated.
the length must agree with that of levels
.
If it is a single String, all the contour will have the same label.
If true, all the contours will have the labels representing the levels.
If false, no label will be drawn (set to "").
If nil, same as true for the contours whose index is equal to "INDXMJ",
and same as false otherwise.levels
, the same Array is repeated.
If nil, the default value ("RSIZEL") is used for non-empty labels.
If a single Numeric, the same value is used for all the contours.
Note that it is recommended to not to use this parameter but
use DCL.udpset('RZISEL'. label_height), since a positive value
here always means to draw labels even when the label is empty.RETURN VALUE
ud_add_contour(levels,index=nil,line_type=nil,label=nil,label_height=nil)
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
options (Hash) : option specification by keys and values. Available options are
name default value description 'min' nil minimum tone level (Numeric) 'max' nil maximum tone level (Numeric) 'nlev' nil number of levels (Integer) 'interval' nil tone-level interval (Numeric)
Here, interval
has a higher precedence over nlev
.
Since all the default values are nil, only those explicitly specified
are interpreted. If no option is provided, the levels generated will
be the default ones set by udcnt[rz] without any level specification.
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)
ug_set_params(hash)
DCL.ugpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.um_set_params(hash)
Calls DCL.umpset
multiple times (for each key and val of hash
).
See gl_set_params for usage.
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
options (Hash) : options to change the default behavior if specified:
option name default value # description: 'yax' false # true => y-axis, false => x-axis 'cside' nil # "b", "t", "l", "r", nil (=>left/bottom), # or false (=>right/top)' 'dtick1' 1 # small tick interval in hours 'dtick2' nil # large tick (with hour labels) interval in hours 'year' false # true => add year to date label 'month' true # true => add month to date label
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
options (Hash) : options to change the default behavior if specified: option name default value # description: "yax" false # true => y-axis, false => x-axis "cside" nil # "b", "t", "l", "r", nil (=>left/bottom), or false
# (=>right/top)
"margin_factor" 0.9 # Factor to control the extent to use
# UCPACK; The smaller, the less, requiring more # space between year labels
"dtick1" nil # (For long time series) small tick interval
# (years)
"dtick2" nil # (For long time series) large tick with year
# labels (years)
"help" false # show help message if true
lon_ax( options=nil )
Draw longitude axis. (label format: degrees + 'E' or 'W')
ARGUMENTS
options (Hash) : options to change the default behavior if specified. It is a Hash with option names (String) as keys and their values. Options are interpreted by a NumRu::Misc::KeywordOptAutoHelp, so you can shorten the keys (by omitting tails) as long as it is unambiguous.
option name default value # description: "yax" false # true => draw y-axis, false => draw x-axis "cside" nil # "b", "t", "l", "r", # nil (=>left/bottom), or false (=>right/top) "dtick1" nil # Interval of small tickmark # (if nil, internally determined) "dtick2" nil # Interval of large tickmark with labels # (if nil, internally determined)
lat_ax( options=nil )
Draw latitude axis. (label format: degrees + 'N' or 'S')
ARGUMENTS
options (Hash) : options to change the default behavior if specified. It is a Hash with option names (String) as keys and their values. Options are interpreted by a NumRu::Misc::KeywordOptAutoHelp, so you can shorten the keys (by omitting tails) as long as it is unambiguous.
option name default value # description: "xax" false # true => draw x-axis, false => draw y-axis "cside" nil # "b", "t", "l", "r", # nil (=>left/bottom), or false (=>right/top) "dtick1" nil # Interval of small tickmark # (if nil, internally determined) "dtick2" nil # Interval of large tickmark with labels # (if nil, internally determined)
unit_vect( vxfxratio, vyfyratio, fxunit=nil, fyunit=nil, options=nil )
Show the "unit vector", which indicate the vector scaling.
ARGUMENTS
options (Hash) : options to change the default behavior if specified. It is a Hash with option names (String) as keys and their values. Options are interpreted by a NumRu::Misc::KeywordOptAutoHelp, so you can shorten the keys (by omitting tails) as long as it is unambiguous.
option name default value # description: "vxunit" 0.05 # x unit vect len in V coord. Used only when # fxunit is omitted (default) "vyunit" 0.05 # y unit vect len in V coord. Used only when # fyunit is omitted (default) "vxuloc" nil # Starting x position of unit vect "vyuloc" nil # Starting y position of unit vect "vxuoff" 0.05 # Specify vxuloc by offset from right-bottom # corner "vyuoff" 0.0 # Specify vyuloc by offset from right-bottom # corner "inplace" true # Whether to print labels right by the unit # vector (true) or below the x axis (false) "rsizet" nil # Label size(default taken from uz-parameter # 'rsizel1') "index" 3 # Line index of the unit vector "help" false # show help message if true "vertical" true # (used only in unit_vect_single) the unit vector # is directed upward if true, to the right if not.
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)
next_unit_vect_options(options)
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
fx
and fy
,
respectively. Useful if the grid points are too many.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
fx
and fy
,
respectively. Useful if the grid points are too many.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
set_color_bar_options(options)
color_bar(options=nil)
Example Here is the simplest case, where no argument is given to color_bar.
DCL.uetone(hoge) DCL.usdaxs ... DCL.color_bar
This draws a color bar by using the levels and tone patterns(colors) set previously. There are many parameters you can set manually, as introduced below:
Description of options
option name default value # description: "levels" nil # tone levels (if omitted, latest ones are used) "patterns" nil # tone patterns (~colors) (if omitted, latest # ones are used) "voff" nil # how far is the bar from the viewport in the V # coordinate "vcent" nil # center position of the bar in the V coordinate # (VX or VY) "vlength" 0.3 # bar length in the V coordinate "vwidth" 0.02 # bar width in the V coordinate "inffact" 2.25 # factor to change the length of triangle on the # side for infinity (relative to 'vwidth') "landscape" false # if true, horizonlly long (along x axes) "portrait" true # if true, vertically long (along y axes) "top" false # place the bar at the top (effective if # landscape) "left" false # place the bar in the left (effective if # portrait) "units" nil # units of the axis of the color bar "units_voff" 0.0 # offset value for units from the default position # in the V coordinate (only for 'units' != nil) "title" nil # title of the color bar "title_voff" 0.0 # offset value for title from the default position # in the V coordinate (only for 'title' != nil) "tickintv" 1 # 0,1,2,3,.. to specify how frequently the # dividing tick lines are drawn (0: no tick lines, # 1: every time, 2: ever other:,...) "labelintv" nil # 0,1,2,3,.. to specify how frequently labels are # drawn (0: no labels, 1: every time, 2: ever # other:,... default: internally determined) "labels_ud" nil # user-defined labels for replacing the default # labels (Array of String) "charfact" 0.9 # factor to change the label/units/title character # size (relative to 'rsizel1') "log" false # set the color bar scale to logarithmic "constwidth" false # if true, each color is drawn with the same width "index" nil # line index of tick lines and bar frame "charindex" nil # line index of labels, units, and title "chval_fmt" nil # string to specify the DCL.chval format for # labeling "help" false # show help message if true
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