Source: src/idl_cvs/tabinv.pro
NAME:
TABINV
PURPOSE:
To find the effective index of a function value in an ordered vector.
CALLING SEQUENCE:
TABINV, XARR, X, IEFF
INPUTS:
XARR - the vector array to be searched, must be monotonic
increasing or decreasing
X - the function value(s) whose effective
index is sought (scalar or vector)
OUTPUT:
IEFF - the effective index or indices of X in XARR
real or double precision, same # of elements as X
RESTRICTIONS:
TABINV will abort if XARR is not monotonic. (Equality of
neighboring values in XARR is allowed but results may not be
unique.) This requirement may mean that input vectors with padded
zeroes could cause routine to abort.
PROCEDURE:
A binary search is used to find the values XARR(I)
and XARR(I+1) where XARR(I) < X < XARR(I+1).
IEFF is then computed using linear interpolation
between I and I+1.
IEFF = I + (X-XARR(I)) / (XARR(I+1)-XARR(I))
Let N = number of elements in XARR
if x < XARR(0) then IEFF is set to 0
if x > XARR(N-1) then IEFF is set to N-1
EXAMPLE:
Set all flux values of a spectrum (WAVE vs FLUX) to zero
for wavelengths less than 1150 Angstroms.
IDL> tabinv, wave, 1150.0, I
IDL> flux( 0:fix(I) ) = 0.
NOTES:
Users of V5.3 or later can use a faster version of tabinv.pro
available at http://idlastro.gsfc.nasa.gov/ftp/v53/ which makes use of
the VALUE_LOCATE() intrinsic function.
FUNCTIONS CALLED:
ISARRAY()
REVISION HISTORY:
Adapted from the IUE RDAF January, 1988
More elegant code W. Landsman August, 1989
Mod to work on 2 element decreasing vector August, 1992
Converted to IDL V5.0 W. Landsman September 1997
Source: src/idl_cvs/tagrankof.pro
NAME:
tagRankOf
PURPOSE:
Return a list of MDSplus signals with a certain rank
(that contain data)
CATEGORY:
MDSplus
CALLING SEQUENCE:
tags = tagRankOf( rankDesired )
INPUTS:
rankDesired = 0 for scalars, 1 for vectors, etc.
KEYWORD PARAMETERS:
Optional Keywords:
filter - wild card specifer. E.g. '*ip*' will get all of
specifed rank with ip in the the tag name.
fullpaths - returns full pathnames of tags found
print - if set, tags and full pathnames found will be printed
debug - print some debugging info
the tree may be opened before this routine is called, or you can specify:
treeName - MDSplus tree. Default='NSTX' (unless embedded in nodeString)
shot - MDSplus shot to search. Default=-1 (the model tree).
server - MDSplus server. Default comes from the environmental variable _path
OUTPUTS:
tags = tagnames of specifed rank fitting any filter specified
if none are found fitting criteria, 'none' is returned.
EXAMPLE:
IDL> print, tagRankOf( 1, filter='i*', shot=120200, tree='wf' )
\WF::ICHI \WF::IOH \WF::IP \WF::IPF1AL \WF::IPF1AU \WF::IPF1B \WF::IPF2L \WF::IPF2U
\WF::IPF3L \WF::IPF3U \WF::IPF4 \WF::IPF5 \WF::ITF
IDL> mdsopen,'microwave', 120200
IDL> scalarNames = tagRankOf(0)
IDL> someSigs = tagRankOf( 1, filter='n*', /print )
COMMON BLOCKS:
none
NOTES:
Only returns signals with data in them.
LIMITATIONS:
An MDSplus shot file must be open first.
MODIFICATION HISTORY:
10-Jan-08 Added extra keywords for findMDSnodes [BD]
14-Mar-00 more efficient & added keywords [BD]
20-Jan-00 Written by Bill Davis
Source: src/idl_cvs/tagsearch.pro
NAME:
tagsearch
PURPOSE:
Search MDS Plus Trees for a tag
CATEGORY:
MDSplus, Utility
CALLING SEQUENCE:
IDL> status=tagsearch(searchtag[,tag=tag, path=path])
INPUTS:
searchnode and optional variable to return an array of full paths containing
tag name and an array containing the tag names
KEYWORD PARAMETERS:
the tree may be opened before this routine is called, or you can specify:
Inputs (optional):
treeName - MDSplus tree. Default='NSTX' (unless embedded in nodeString)
shot - MDSplus shot to search. Default=-1 (the model tree).
server - MDSplus server. Default comes from the environmental variable _path
Returned:
path
tag
OUTPUTS:
status of function
COMMON BLOCKS:
none
EXAMPLE:
IDL> status=tagSearch('xp_', tag=tag, path=fullpath, tree='nstx')
NOTES:
will return 0 if tag is found and -1 if it is not found in the tree specified
MODIFICATION HISTORY:
08-May-2009 default to nstx tree if none indicated [BD]
10-Jan-08 use findMDSnodes, since findtags.fun not in Linux distribution [BD]
01-Dec-00 Added capability for wildcards in search string
28-Feb-00 Written by Dana Mastrovito, PPPL
Source: src/idl_cvs/tag_exist.pro
NAME:
TAG_EXIST
PURPOSE:
To test whether a tag name exists in a structure.
CATEGORY:
MDSplus, structure
CALLING SEQUENCE:
status = tag_exist(str, tag)
INPUTS:
str - structure variable to search
tag - tag name to search for
OUTPUTS:
Function returns 1 if tag name exists or 0 if it does not.
KEYWORDS:
INDEX = index of matching tag
METHOD:
Routine obtains a list of tagnames and tests whether the
requested one exists or not. The search is recursive so
if any tag names in the structure are themselves structures
the search drops down to that level.
Common : None
Restrictions: None
Side effects: None
Written : C D Pike, RAL, 18-May-94
Modified : 03-May-2007 datatype wasn't working, so just use SIZE [BD]
: Version 1.1, D Zarro, ARC/GSFC, 27-Jan-95
Passed out index of matching tag
Version : Version 1.1, 27-Jan-95
Source: src/idl_cvs/tdis.pro
NAME:
tdis
PURPOSE:
Search MDS Plus Trees for TDI DATA
CATEGORY:
MDSplus, Utility
CALLING SEQUENCE:
IDL> result = tdis( keyword[,sensitvity][, tdi=tdi][,path=path] )
INPUTS:
searchstring and optional variables to control case sensitivity and return an array of text strings found
and an array of paths to those strings
KEYWORD PARAMETERS:
(output)
tdi - the full tdi found
path - the full path to the text
OUTPUTS:
result=status of function
COMMON BLOCKS:
none
EXAMPLE:
IDL> result=tdi('build','sensitive',tdi=tdi,path=path)
NOTES:
this version is specifically for idl4 (?)
tree must already be open before tsearch can be called
if no records are found in current tree returns -1 else returns 0
MODIFICATION HISTORY:
30-Jan-00 Speed up. Fixed node names.
01-Dec-00 Added capability for wildcards in search string
07-Feb-00 Written by Dana Mastrovito, PPPL
Source: src/idl_cvs/template.pro
NAME:
TEMPLATE
PURPOSE:
Provide a template for IDL routines to be used by others
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> opt = template(shot)
INPUTS:
shot = NSTX shot number
KEYWORD PARAMETERS:
Inputs:
HLP - When set, help information is printed.
tree - MDSplus tree
sig - MDSplus signal to look for in current shot
xsize - horizontal size of X window
ysize - vertical size of X window
xpos - initial X position of lower left of X window in pixels
ypos - initial Y position of lower left of X window in pixels
charsize - size of characters on plot
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Outputs:
status - if odd, then success
OUTPUTS:
opt = returned value out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> opt = TEMPLATE( /HLP )
NOTES:
When the routine is called with no parameters, or with the
keyword hlp set, help information is printed.
MODIFICATION HISTORY:
20-Jan-2012 Written by Bill Davis, PPPL
Source: src/idl_cvs/testcmd.pro
NAME:
testcmd
PURPOSE:
test batch execution
CATEGORY:
Example, Batch
INVOCATION:
$ IDL runtestcmd.pro
Where runtestcmd.pro might contain:
testcmd, key='key input', file='newfile.txt'
exit
WRITTEN by Bill Davis, 23-Apr-99
Source: src/idl_cvs/textlines.pro
NAME:
textlines
PURPOSE:
Form lines of text for outputing (say, in a table form). If
formats are not input, then guess about good formatting for
variables of different types.
CATEGORY:
STRINGS, Output
CALLING SEQUENCE:
IDL> lines = textlines( arg01, arg02, arg03, arg04, ... )
INPUTS:
inputs = up to 40 scalars or arrays (of same length)
KEYWORD PARAMETERS:
Optional Inputs:
formats - array of formats for each column
tabs - if =0 then will put a space between each column, rather than a tab
debug - if set, debug output will be printed
Optional Output:
getFormat
OUTPUTS:
lines - string array of formatted output
EXAMPLE:
arg01 = [1,2,3] & arg02=['a','b','c']
arg03 = [0.1,0.2,0.3] & arg04 =arg01
lines = textlines( arg01, arg02, arg03, arg04, /debug )
MODIFICATION HISTORY:
20-Dec-2007 Written by Bill Davis, PPPL
Source: src/idl_cvs/th_image_cont.pro
NAME:
TH_IMAGE_CONT
PURPOSE:
Plot contours of Images with both contour lines and colors
CATEGORY:
2-D Plotting
USAGE:
******************** HIGH FREQUENCY RADAR DIVISION, SRL **********************
*************************** Ionospheric Effects ******************************
HELP
1 TH_IMAGE_CONT
Overlays an image and a contour plot and optionally adds a scale bar.
Based on the IDL USERLIB routine IMAGE_CONT. This routine supersedes
the USERLIB one, having far more functionality, yet capable of EXACTLY
reproducing the effect of IMAGE_CONT. Scale bar appears on the
right-hand-side unless /NOBAR is set. NB: the scale bar is
automatically created by a recursive call to this routine using the
same color and image parameters
Format:
In its simplest form (allowing all parameters to default)
IDL> TH_IMAGE_CONT, IMAGE
or,
IDL> TH_IMAGE_CONT, IMAGE, X, Y
And in its most complex form, specifying ALL parameter
IDL> TH_IMAGE_CONT, IMAGE, $
ASPECT=aspect, $
BADPTS=badpts,$
BAR_LABEL_LENGTH=bar_label_length, $
BAR_RANGE=bar_range, $
BAR_SEPARATION=bar_separation, $
BAR_TICKLEN=bar_ticklen, $
BAR_TICKNAME=bar_tickname, $
BAR_TICKS=bar_ticks, $
BAR_TICKV=bar_tickv,$
BARSZ_CHARS=barsz_chars, $
BOTTOMcolor=bottomcolor,$
C_COLORS=c_colors,$
C_LINESTYLE=c_linestyle, $
C_THICK=c_thick, $
CONGRID=congrid, $
CONT=cont, $
CRANGE=crange, $
CT=ct, $
CUBIC=cubic, $
DEBUG=debug, $
EXACT=exact, $
RAISE_PTITLE=raise_ptitle
IMAGE_WINDOW=image_window, $
INTERP=interp,$
LEVELS=levels,$
MAX_VALUE=max_value, $
NLEVELS=nlevels, $
NOBAR=nobar, $
NOCONT=nocont, $
NOERASE=noerase,$
TOPcolor=topcolor,$
TSIZE=tsize, $
WINDOW_SCALE=window_scale, $
XRANGE=xrange, $
YRANGE=yrange
2 IMAGE
2-dimensional array to display as an image.
2 /ASPECT
set to retain image's aspect ratio. Assumes square
pixels. If /WINDOW_SCALE is set, the aspect ratio is retained.
2 BADPTS
indices into IMAGE data which define the bad points.
These will not be contoured
2 BAR_LABEL_LENGTH
the space, in characters (default = 2), for the bar label
2 Btitle
Bar title
2 BAR_RANGE
set the range limits for the color scale bar
(same as CRANGE, defaults to autoscaling if
BAR_TICKV not set)
2 BAR_SEPARATION
the separation, in characters (default = 2), between the scale
bar and the image. Note that the |y-ticklength| will be added
to this value if y-ticklength < 0.
Both the image and the color bar need to fit
into the space allowed for the plot window, otherwise an
informative message will be printed and unpredictable results
may occur for the displayed image
2 BAR_TICKS
set the number of tick intervals for the labelling
of the scale bar
(defaults to !z.ticks)
2 BAR_TICKV
the values to label on the scale bar. If this is set
then the scale bar will have AT LEAST this range
(defaults to !z.tickv)
2 BAR_TICKNAME
the labels to use on the scale bar
(defaults to !z.range)
2 BAR_TICKLEN
the length of the ticks on the scale bar in fractions of tick
bar window, (defaults to !z.ticklen)
2 BARSZ_CHARS
the size of the scale bar in characters (default = 2).
Both the image and the color bar need to fit
into the space allowed for the plot window, otherwise an
informative message will be printed and unpredictable results
may occur for the displayed image. If the value of this
keyword is <=0 then no bar will be displayed BUT the scaling
and window size will be calculated as those a color bar is to
be used. This is useful when doing multiple plots per page
where only some scale bars are not required but you want the
plots to all be the same size. Set BARSZ_CHARS = -#chars to
allow room for a bar of #chars size but not to put a scale bar
on the plot. Then set BARSZ_CHARS = +#chars to plot the bar on
alongside another plot, to end up with images of the same
size. Useful in collaboration with the SIDES procedure (which
will set flags for when the plot is on the Left,Right,Top and
Bottom of the plot window).2 BOTTOMcolor
Set this keyword to the color index of the desired bottom
color (range from 0 to TOPcolor-1).
Note that the default value for this keyword is 1,
which allows the color of the image to
be independent of the background and axes colors
(!P.background and !P.color). If the user sets this keyword
then allowance should be made for these colors as they are
generally swapped for POSTSCRIPT and X-Window devices
2 /CONGRID
if the image has to be resampled then use the USERLIB CONGRID
routine
2 /CONT
only do the contouring (no image)
2 CRANGE
set the range limits for the color scale bar
(same as BAR_RANGE, defaults to autoscaling if
BAR_TICKV not set)
2 CT
load a color table (uses LOADCT via MK_COLOR)
2 /CUBIC
if the image has to be resampled AND interpolated then use the
CUBIC interpolation rather than the bi-linear (see INTERP
Keyword)
2 /DEBUG
write out some inforamtion as it goes2 /EXACT
When set this will force the contour routine to fit to the
exact positions relative to the image.
When data is displayed as an image each datum is expanded out
to fill a pixel of finite dimensions. The assignment of where
the "data value" resides within this space is open to debate,
but is most appropriately (to this author) assigned to the
geometric centre of the pixel. Most defaults assign this
position to be at the bottom left-hand corner of the
pixel. Contour will fit to the 2-d plane assuming that the
data value is associated with the bottom left-hand corner. To
reconcile this with the notion of the value being in the
middle of the pixel the contour call is made with the x/y
values and ranges for the image adjusted (effectively by half
a pixel in the x/y directions). This is the EXACT mapping. By
default, the mapping will be the default contour one.
2 RAISE_PTITLE
Raise the plot title by this many character units above the
plot to allow room to put a label on the top x-axis. Default
is raise by 1 char. If not called then the default y-position
is 1 char unit above plot (allowing room for xticks, and
scaled by !P.charsize)
2 IMAGE_WINDOW
the position of the image window. Can be used to set
!p.position so you can over-plot the image.
(Only useful when the scale-bar has been used)
2 /INTERP
set to bi-linear interpolate if image is resampled.
(see also the CUBIC keyword)
2 /NOBAR
dont put a scale bar on the right-hand-side
2 /NOCONT
only do the imaging (no contours)
2 /NOERASE
dont erase the previous plot
/NOLOAD
if set, do not load color table
2 TOPcolor
Set this keyword to the color index of the desired bottom
color (range from BOTTOMcolor+1 to !D.n_colors-1). Note that
the default value for this keyword is !D.n_colors-2, which
allows the color of the image to be independent of the
background and axes colors (!P.background and !P.color). If
the user sets this keyword then allowance should be made for
these colors as they are generally swapped for POSTSCRIPT and
X-Window devices
2 TSIZE
size of the plot title (default = 1)
2 /WINDOW_SCALE
set to scale the window size to the image size,
otherwise the image size is scaled to the window size.
Ignored when outputting to devices with scalable pixels.
2 XRANGE
will set the ranges for the x-axes labelling
2 YRANGE
will set the ranges for the y-axes labelling
2 Contour
most of the CONTOUR parameters are passed directly
2 Examples
IDL> th_image_cont, image
IDL> th_image_cont, image, /nocont, /nobar
IDL> !p.title = "!17 This is an example of what can be done!3"
IDL> !x.title = "X Title" & !y.title = "Y Title" & !z.title = "Z Title"
IDL> !x.ticklen = -0.02 & !y.ticklen = -0.02 & !z.ticklen = -0.02
IDL> !p.charsize = 1.5
IDL> levels = findgen(5)*2
IDL> image = findgen(20,20)/40.
IDL> th_image_cont, image, crange=[0,10], /follow, level=levels, $
tsize=1.5*!p.charsize, bar_tickv=levels
2 Error_responses
Returns to the calling procedure on an error
2 Limitations/Assumptions
The currently selected display is affected.
If the device has scalable pixels then the image is written over
the plot window.
As with all TV style image displays, the axes range is independent of
the image, so it is up to the user the ensure correct labelling of the
axes.
NOTE: if the user aborts while this routine is processing then the
system variables (in particular !p.position) will have
been changed, causing subsequent plots to appear different. Issue the
command "resetplt,/all" to reset all the system variables back to the
startup state.
NOTE: if x or y does not have a constant interval, the image will be
wrong. Instead, use contour, /fill...
2 References
See USERLIB IMAGE_CONT
2 Keywords
Graphics images contours
2 MODIFICATIONS:
-------------
05-Sep-2013 if /NoLoad set, use values in common block from mk_colors (if set)
for max values
07-Jun-2013 make /EXACT the default
27-Jul-2012 tweeked color table handling. Add rainbow keyword.
07-Jan-2010 print error if input not 2-D array
06-Jun-2006 several changes including adding x & ytickformat keywords
06-Apr-2006 limit max dimension of interpolated postscript plots to 2000 pixels
14-Mar-2006 added zrange keyword [BD]
25-Oct-01 Made Contours work when /ASPECT set. Made Contours work when
XRANGE or YRANGE set.
18-Apr-00 Made interpolated image align with data. /EXACT does not give
an exact representation. Warn if style=2
06-Dec-99 Added another pixel to TV image size, so it fills the grid square
23-Aug-99 Allow Contour, Z, X, Y format. Use MK_COLOR
07-Jan-98 BD allow more space at the bottom and right-hand side for text
(keyword BAR_LABEL_LENGTH added)
07-Aug-97 Bill Davis- v. 2.24
[1] added _extra call to main CONTOUR and removed
it from those making the bar.
(more modifications in file)
Source: src/idl_cvs/time2sec.pro
NAME:
time2Sec
PURPOSE:
Return times in seconds since Ja. 1, 1970
CATEGORY:
Dates, times
CALLING SEQUENCE:
seconds = time2Sec( time )
INPUTS:
time - string in military style '11:04' or '23:59' (no double quotes!)
KEYWORDS
OUTPUT
time - string with AM or PM after it (no space between). This is the
format SQL queries want.
EXAMPLE:
IDL> print,time2Sec( '6:08')
22080.000
IDL> print,time2Sec( '6:08PM')
65280.000
MODIFICATION HISTORY:
WRITTEN by 03-Mar-2009 Bill Davis
Source: src/idl_cvs/timesofshots.pro
NAME:
timesofshots
PURPOSE:
return dates and times, like 12:26PM, of NSTX shot
CATEGORY:
dates, MDSplus
CALLING SEQUENCE:
IDL> times = timesofshots( shot1, shot2, dates=dates )
IDL> times = timesofshots( year=2010, dates=dates )
INPUTS:
shot1 - starting shot
shot2 - ending shot
KEYWORD PARAMETERS:
year - if set, will find the shots for that year
dates - dates of files in dd-mon-yyyy (e.g., 07-Jul-2007)
longDates - dates (LONG) of files in YYYYMMDD (e.g., 20061231)
times - time of day of file, e.g., 23:59:59
verbose - if set, will print informational output
OUTPUTS:
times - time of day of file, e.g., '12:05PM'
EXAMPLE:
IDL> times = timesofshots( year=2010, dates=dates, shots=shots, longd=longd )
IDL> for i=0,4 do print, shots[i], ' ', dates[i], ' ', times[i]
136730 23-Feb-2010 12:05PM
136731 23-Feb-2010 12:17PM
136732 23-Feb-2010 12:23PM
136733 23-Feb-2010 12:30PM
136734 23-Feb-2010 12:40PM
NOTES:
you will need database setup done, as for the NSTX logbook. E.g.,
source /p/nstxusr/util/setup/mkmdsplusdbfile.csh
MODIFICATION HISTORY:
08-Jul-2013 added year keyword
WRITTEN by Bill Davis, 27-Feb-2009
Source: src/idl_cvs/toidltime.pro
NAME:
toIdlTime
PURPOSE:
Convert a date string to IDL time (output from SYSTIME(1),
i.e., seconds since 1/1/1970
CATEGORY:
Dates
CALLING SEQUENCE:
seconds = TOIDLTIME( date_time )
INPUTS:
date_time - string line '06/14/2004 11:04:52' (no double quotes!)
KEYWORD PARAMETERS:
OUTPUTS:
seconds since 1/1/1970 (type long64)
NOTES:
EXAMPLE:
IDL> print, systime(0), long64(systime(1))
Fri Oct 14 09:10:43 2005 1129295443
IDL> print, toIdlTime('10/14/2005 09:10:43')
1129295443
IDL> print, fromIdlSeconds(1129295443)
10/14/2005 09:10:43
IDL> print, toIdlTime('20 Jun 11')
MODIFICATION HISTORY:
17-Mar-2010 Handle dates like 'Fri Feb 5 17:04:55 2010', and inputs
of Julian dates and Long dates (like 20091231)
WRITTEN 14-Oct-2005 by Bill Davis
Source: src/idl_cvs/totstruct.pro
NAME:
totstruct
PURPOSE:
find the total of numerical values in a structure
(handles structures within the input structure)
CATEGORY:
Programming, Math
EXAMPLE:
IDL> structure = { a: 2.3, b:10, c:[2.1,22.3], d:'Hi Mom'}
IDL> print, totstruct(structure)
36.7
IDL> structure2 = { a: 2.3, b:10, c:[2.1,99], d:'Hi Mom' }
IDL> structure = [structure, structure2]
IDL> print, totstruct(structure)
99.0000
IDL> inStruc = {a:77., b:88., c:101.}
IDL> structure = { a: 2.3, b:10, c:[2.1,22.3], d:'Hi Mom', e:inStruc }
IDL> print, totstruct(structure)
302.700
NOTES:
will not consider values in sub-structures
MODIFICATIONS
25-Mar-2008 handles arrays of structures, and go into nested
structures [BD]
01-Dec-2006 Ignore non-numeric structure elements [BD]
Source: src/idl_cvs/tree_exists.pro
NAME:
tree_exists
PURPOSE:
Return a true if an MDSplus tree exists for a given shot number
CATEGORY:
MDSplus, Trees
CALLING SEQUENCE:
found = tree_exists( shot, tree )
INPUTS:
(tree and shot arguments can be reversed, if shot is an number)
shot - MDSplus shot number, i.e, ID. Can be string acceptable to
mk_shotlist.pro
tree - tree to open. Defaults to 'wf'
KEWORDS:
(returned)
list - list of shots found
EXAMPLE:
IDL> IF tree_exists(101526,'operations') THEN ...
IDL> founds = tree_exists( '112300-112302 112305+2', 'wf', list=shots )
NOTE:
Returns true only if shot exists; the shot may be empty.
If you have an account on skylark.pppl.gov, you use mdir.pro,
which is faster.
19-Nov-2008 make work if input arguments are reversed
WRITTEN 15-Nov-2008 by Bill Davis (old version replaced)
Source: src/idl_cvs/trimtagnames.pro
NAME:
trimtagnames
PURPOSE:
Trim tree info from an MDSplus tag name
CATEGORY:
MDSplus, Tagnames
CALLING SEQUENCE:
trimmedList = trimtagnames( sigList )
INPUTS:
sigList - a string array of MDSplus tag names in
KEYWORD PARAMETERS:
(Optional)
all - if set, trim everything but string following the last :
treeOnly - if set only remove the tree (& top:).
Leave the backslash, TDI, etc.
OUTPUTS:
trimmedList - a string array of MDSplus tag names
EXAMPLE:
trimmedList = trimtagnames( sigList )
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
18-Oct-00 Added keyword treeOnly:
Don't assume tree name at beginning of string
(allows for trimming tree names from TDI expressions)
Written by Bill Davis March, 1999
Source: src/idl_cvs/trismooth.pro
NAME:
trismooth
PURPOSE:
Triangular smoothing of a vector, including points near the ends.
CATEGORY:
Smoothing
CALLING SEQUENCE:
SMOOTHED = trismooth( VECTOR, WINDOW_WIDTH )
INPUTS:
VECTOR = The vector to be smoothed
WINDOW_WIDTH = The full width of the window over which the weighted
average is determined for each point (if even, use window+1).
KEYWORDS:
GAUSS - if set, weighting is gaussian, rather than triangular
OUTPUT:
Function returns the smoothed vector
SUBROUTINES CALLED:
PROCEDURE:
Each point is replaced by triangular weighting of the nearest WINDOW of points.
The width of the window shrinks towards the ends of the vector. REVISION HISTORY:
Written, Bill Davis. 23-Mar-00, per Michael Bell
Source: src/idl_cvs/truns_get.pro
NAME:
truns_get
PURPOSE:
List info (in a database) on NSTX TRANSP runs (to a screen or file)
CATEGORY:
TRANSP, Database
CALLING SEQUENCE:
IDL> truns_get, shotyear=shotyear, shotnumber=shotnumber, runID=runID, $
rundate=rundate, runby=runby, $
outFile=outFile
INPUTS:
(none required)
KEYWORD PARAMETERS:
(all optional)
shotyear - e.g., '2001'
shotnumber - e.g., 105535
runID - e.g., 01
rundate - run date (YYYYMMDD), e.g., 20010802
runby - person, e.g. 'KAYE'
outFile - string (if not present, data listed to screen)
OUTPUTS:
data to screen or file, if specified
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> truns_get, shotYear=2001 ; all 2001 NSTX TRANSP runs to screen
IDL> truns_get, rundate=20010911
MODIFICATION HISTORY:
25-May-2005 Switched double and single quotes in queries to work on RHEL.
30-Jan-2002 Written by Bill Davis, PPPL
Based on a program by Stan Kaye.
Source: src/idl_cvs/tvimage.pro
NAME:
TVIMAGE
PURPOSE:
This purpose of TVIMAGE is to create a device-independent TV command
with the power and functionality to be used in sophisticated graphics
programs, as well as at the IDL command line. It can be thought of as
a "smart" TV command.
AUTHOR:
FANNING SOFTWARE CONSULTING:
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
CATEGORY:
2-D Plotting
CALLING SEQUENCE:
TVIMAGE, image
INPUTS:
image: A 2D (MxN) or 24-bit (e.g., MxNx3) byte array. A
24-bit image with an alpha channel (e.g., MxNx4) is
also permitted. The alpha channel will be blended with
the current background image. See the AlphaBackgroundImage
keyword for details.
x : The X position of the lower-left corner of the image.
This parameter is only recognized if the TV keyword is set.
If the Y position is not used, X is taken to be the image
"position" in the window. See the TV command documenation
for details.
y : The Y position of the lower-left corner of the image.
This parameter is only recognized if the TV keyword is set.
KEYWORD PARAMETERS:
ACOLOR: This keyword has been depreciated in favor of the COLOR keyword.
ADDCMD: Set this keyword to add the TVImage command to an FSC_Window
command list. Setting this command will force ERASEIT to be set
to 0, so the TVImage command can exist peacefully with other commands
in an FSC_Window command list. Setting this keyword automatically sets
the WINDOW keyword.
ALPHABACKGROUNDIMAGE: Normally, when a image with an alpha channel is displayed,
the image is blended with the image currently in the display window.
This means, the program has to obtain that background image. This is not a
problem on devices (e.g., WIN, X, Z) that allow this kind of operation,
but it is on devices (e.g., the PostScript device, PS) that do not.
To get around this problem, you can pass the background image to the
TVImage program, along with the alpha channel image you wish to display
(via the image parameter) and the alpha channel image will be blended
with this image appropriately on all devices. If an alpha channel image
is displayed on a device in which there is no way to obtain the background
image, and this keyword is not used to pass a background image, then
the alpha channel image will be blended with a white background image.
This keyword is only used if an alpha channel image is passed to the
program via the image parameter. The AlphaBackgroundImage does not need
to have the same dimensions as the alpha channel image.
ALPHABGPOSITION: Normally, the alpha background image is displayed in the current graphics
window, or is taken from the current graphics window. This is not always correct.
Sometimes you want to actually position both the background and foreground image
in a window. If this keyword is used to specify a position, the alphabackground image
will be positioned at this location before the blending occurs.
AXES: Set this keyword to draw a set of axes around the image. Setting this
keyword also sets SAVE=1, unless told otherwise.
AXKEYWORDS: An IDL structure variable of PLOT keywords as structure fields
and keyword values as the values of the fields. Pass directly to the
PLOT command that draws the axes for the image. Ignored unless the
AXES keyword is set. For example,
TVImage, image, /AXES, AXKEYWORDS={TICKLEN:-0.025}
The axis color, range, title, font and character size must be
set with TVIMAGE keywords ACOLOR, [XY]RANGE, [XY]TITLE, FONT, and
CHARSIZE.
BACKGROUND: This keyword specifies the background color. Note that
the keyword ONLY has effect if the ERASE keyword is also
set or !P.MULTI is set to multiple plots and TVIMAGE is
used to place the *first* plot. [Note change, setting this keyword
automatically sets ERASE=1.] Can be a string (e.g., 'ivory'), or
a 24-bit value that can be decomposed into a color, or an 8-bit
index number into the current color table.
If you are in indexed color mode, the background color index
must be outside the range of image color indices, or you will
see the background color in your image output. For example, you
should NOT use code like this while in indexed color mode:
TVImage, image, Background=FSC_Color('gray')
Since FSC_Color will load a gray color in index 81, which is inside
the indices assigned to the image. To do this correctly in indexed color
mode, do this:
TVImage, image, Background='gray'
Or, this:
TVImage, Bytscl(image, Top=253), Background=FSC_Color('gray',254)
BOTTOM: IF SCALE=1, the image is scaled so that all displayed pixels have values
greater than or equal to BOTTOM and less than or equal to TOP.
The value of BOTTOM is 0 by default.
BREWER: Obsolete and not used.
COLOR: Set this keyword to the axis color. If a byte or integer value,
it will assume you are using INDEXED color mode. If a long integer
is will assume you are using DECOMPOSED color mode. If a string,
is will pass the string color name along to FSC_COLOR for processing.
CHARSIZE: Sets the character size. Used only if the AXES keyword is also set.
ERASE: If this keyword is set an ERASE command is issued
before the image is displayed.
FONT: Set this to the type of font wanted on axis annotation. By default
FONT = !P.Font. Used only if the AXES keyword is also set.
_EXTRA: This keyword picks up any TV keywords you wish to use.
HALF_HALF: Obsolete and not used. Image resizing is always done
as if CONGRID was called with CENTER=1. This prevents
image pixels from changing locations in the output image.
KEEP_ASPECT_RATIO: Normally, the image will be resized to fit the
specified position in the window. If you prefer, you can
force the image to maintain its aspect ratio in the window
(although not its natural size) by setting this keyword.
The image width is fitted first. If, after setting the
image width, the image height is too big for the window,
then the image height is fitted into the window. The
appropriate values of the POSITION keyword are honored
during this fitting process. Once a fit is made, the
POSITION coordiates are re-calculated to center the image
in the window. You can recover these new position coordinates
as the output from the POSITION keyword.
LAYOUT: This keyword specifies a grid with a graphics window and determines
where the graphic should appear. The syntax of LAYOUT is a 3-element
array: [ncolumns, nrows, location]. The grid is determined by the
number of columns (ncolumns) by the number of rows (nrows). The location
of the graphic is determined by the third number. The grid numbering
starts in the upper left (1) and goes sequentually by column and then
by row.
MARGIN: A single value, expressed as a normalized coordinate, that
can easily be used to calculate a position in the window.
The margin is used to calculate a POSITION that gives
the image an equal margin around the edge of the window.
The margin must be a number in the range 0.0 to 0.333. This
keyword is ignored if the POSITION or OVERPLOT keywords are
used. It is also ignored when TVImage is executed in a
multi-plot window, EXCEPT if it's value is zero. In this
special case, the image will be drawn into its position in
the multi-plot window with no margins whatsoever. (The
default is to have a slight margin about the image to separate
it from other images or graphics.
MAXVALUE: If defined, the data is linearly scaled between MINVALUE
and MAXVALUE. MAXVALUE is set to MAX(image) by default.
Setting this keyword to a value implies SCALE=1. If the maximum
value of the image is GT 255, this implies SCALE=1.
MINVALUE: If defined, the data is linearly scaled between MINVALUE
and MAXVALUE. MINVALUE is set to MIN(image) by default.
Setting this keyword to a value implies SCALE=1. If the minimum
value of the image is LT 0, this implies SCALE=1.
MULTIMARGIN: Sometimes, when displaying multiple images with !P.Multi, you
want the images to be slightly smaller than the position created
by !P.Multi so you can add, for example, a colorbar or an annotation
to the image. This keyword can be used to adjust the image position
by a small margin. A four-element array, the margins apply to the
[bottom, left, top, right] of the image position. So, to
leave room at the top of an image for a color bar, you might
type this:
TVImage, image, MultiMargin=[0, 0, 4, 0]
This keyword applies *only* to images displayed with !P.Multi, and if
passed a scalar value, will use the same value for all four positions.
MINUS_ONE: The value of this keyword is passed along to the FSC_RESIZE_IMAGE
command. It prevents FSC_RESIZE_IMAGE from adding an extra row and
column to the resulting array, which can be a problem with
small image arrays. This keyword is set to 1 by default.
NCOLORS: If this keyword is supplied, the TOP keyword is ignored and
the TOP keyword is set equal to NCOLORS - 1. This
keyword is provided to make TVIMAGE easier to use with the
color-loading programs such as LOADCT:
LoadCT, 5, NColors=100, Bottom=100
TVImage, image, NColors=100, Bottom=100
Setting this keyword to a value implies SCALE=1.
NOINTERPOLATION: Setting this keyword disables the default bilinear
interpolation done to the image when it is resized. Nearest
neighbor interpolation is done instead. This is preferred
when you do not wish to change the pixel values of the image.
This keyword must be set, for example, when you are displaying
GIF files that come with their own non-IDL color table vectors.
NORMAL: Setting this keyword means image position coordinates x and y
are interpreted as being in normalized coordinates. This keyword
is only valid if the TV keyword is set.
OVERPLOT: Setting this keyword causes the POSITION keyword to be ignored
and the image is positioned in the location established by the
last graphics command. For example:
Plot, Findgen(11), Position=[0.1, 0.3, 0.8, 0.95]
TVImage, image, /Overplot
PALETTE: Set this keyword to a 3 x N or N x 3 byte array containing
the RGB color vectors to be loaded before the image is displayed.
Such vectors can be obtained, for example, from CTLOAD with the
RGB_TABLE keyword:
CTLoad, 4, /BREWER, /REVERSE, RGB_TABLE=palette
TVImage, LoadData(7), PALETTE=palette
POSITION: The location of the image in the output window. This is
a four-element floating array of normalized coordinates of
the type given by !P.POSITION or the POSITION keyword to
other IDL graphics commands. The form is [x0, y0, x1, y1].
The default is [0.0, 0.0, 1.0, 1.0]. Note that this keyword is ALSO
an output keyword. That is to say, upon return from TVIMAGE
this keyword (if passed by reference) contains the actual
position in the window where the image was displayed. This
may be different from the input values if the KEEP_ASPECT_RATIO
keyword is set, or if you are using TVIMAGE with the POSITION
keyword when !P.MULTI is set to something other than a single
plot. One use for the output values might be to position other
graphics (e.g., a colorbar) in relation to the image.
Note that the POSITION keyword should not, normally, be used
when displaying multiple images with !P.MULTI. If it *is* used,
its meaning differs slightly from its normal meaning. !P.MULTI
is responsible for calculating the position of graphics in the
display window. Normally, it would be a mistake to use a POSITION
graphics keyword on a graphics command that was being drawn with
!P.MULTI. But in this special case, TVIMAGE will use the POSITION
coordinates to calculate an image position in the actual position
calculated for the image by !P.MULTI. The main purpose of this
functionality is to allow the user to display images along with
colorbars when using !P.MULTI. See the example below.
QUIET: There are situations when you would prefer that TVIMAGE does not
advertise itself by filling out the FSC_$TVIMAGE common block. For
example, if you are using TVIMAGE to draw a color bar, it would
not be necessary. Setting this keyword means that TVIMAGE just
goes quietly about it's business without bothering anyone else.
SAVE: Set this to cause a data coordinate system to be established
for the image. The XRANGE and YRANGE keyword values will be used
to establish a data coordinate system coincident with the final
image position. Setting the AXES keyword automatically sets SAVE=1.
SCALE: Set this keyword to byte scale the image before display. If this
keyword is not set, the image is not scaled before display.
TITLE: The title annotation. Used only if the keyword AXES is set.
TOP: IF SCALE=1, the image is scaled so that all displayed pixels have values
greater than or equal to BOTTOM and less than or equal to TOP.
The value of TOP is !D.Table_Size by default.
TV: Setting this keyword makes the TVIMAGE command work much
like the TV command, although better. That is to say, it
will still set the correct DECOMPOSED state depending upon
the kind of image to be displayed (8-bit or 24-bit). It will
also allow the image to be "positioned" in the window by
specifying the coordinates of the lower-left corner of the
image. The NORMAL keyword is activated when the TV keyword
is set, which will indicate that the position coordinates
are given in normalized coordinates rather than device
coordinates.
Setting this keyword will ensure that the keywords
KEEP_ASPECT_RATIO, MARGIN, MINUS_ONE, MULTI, and POSITION
are ignored. Alpha channels are also ignored when this keyword
is set.
WHITE: A shorthand way of setting the ERASE keyword to 1 and the BACKGROUND
keyword to "white. Also sets the ACOLOR keyword to "black," unless
it is already set to something else.
WINDOW: Set this keyword to add the command to an FSC_Window application.
Setting this keyword ALWAYS sets the ERASEIT keyword. If you want
to add an image to an FSC_Window without the ERASEIT keyword set,
use the ADDCMD keyword.
XRANGE: If the AXES keyword is set, this keyword is a two-element vector
giving the X axis range. By default, [0, size of image in X].
XTITLE: The X title string to use for the X image axis. Used only if the AXES
keyword is set.
YRANGE: If the AXES keyword is set, this keyword is a two-element vector
giving the Y axis range. By default, [0, size of image in Y].
YTITLE: The Y title string to use for the Y image axis. Used only if the AXES
keyword is set.
OUTPUTS:
None.
SIDE EFFECTS:
Unless the KEEP_ASPECT_RATIO keyword is set, the displayed image
may not have the same aspect ratio as the input data set.
RESTRICTIONS:
If the POSITION keyword and the KEEP_ASPECT_RATIO keyword are
used together, there is an excellent chance the POSITION
parameters will change. If the POSITION is passed in as a
variable, the new positions will be returned in the same variable
as an output parameter.
If a 24-bit image is displayed on an 8-bit display, the
24-bit image must be converted to an 8-bit image and the
appropriate color table vectors. This is done with the COLOR_QUAN
function. The TVIMAGE command will load the color table vectors
and set the NOINTERPOLATION keyword if this is done. Note that the
resulting color table vectors are normally incompatible with other
IDL-supplied color tables. Hence, other graphics windows open at
the time the image is display are likely to look strange.
Other programs from Coyote Library are required.
EXAMPLE:
To display an image with a contour plot on top of it, type:
filename = FILEPATH(SUBDIR=['examples','data'], 'worldelv.dat')
image = BYTARR(360,360)
OPENR, lun, filename, /GET_LUN
READU, lun, image
FREE_LUN, lun
TVIMAGE, image, POSITION=thisPosition, /KEEP_ASPECT_RATIO
CONTOUR, image, POSITION=thisPosition, /NOERASE, XSTYLE=1, $
YSTYLE=1, XRANGE=[0,360], YRANGE=[0,360], NLEVELS=10
To display four images in a window without spacing between them:
!P.Multi=[0,2,2]
TVImage, image, Margin=0
TVImage, image, Margin=0
TVImage, image, Margin=0
TVImage, image, Margin=0
!P.Multi = 0
To display four image in a window with associated color bars:
!P.Multi=[0,2,2]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 0
TVImage, image, Position=p
FSC_Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 2
TVImage, image, Position=p
FSC_Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 3
TVImage, image, Position=p
FSC_Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
p = [0.02, 0.3, 0.98, 0.98]
LoadCT, 5
TVImage, image, Position=p
FSC_Colorbar, Position=[p[0], p[1]-0.1, p[2], p[1]-0.05]
!P.Multi =0
MODIFICATION HISTORY:
Written by: David Fanning, 20 NOV 1996.
Fixed a small bug with the resizing of the image. 17 Feb 1997. DWF.
Removed BOTTOM and NCOLORS keywords. This reflects my growing belief
that this program should act more like TV and less like a "color
aware" application. I leave "color awareness" to the program
using TVIMAGE. Added 24-bit image capability. 15 April 1997. DWF.
Fixed a small bug that prevented this program from working in the
Z-buffer. 17 April 1997. DWF.
Fixed a subtle bug that caused me to think I was going crazy!
Lession learned: Be sure you know the *current* graphics
window! 17 April 1997. DWF.
Added support for the PRINTER device. 25 June 1997. DWF.
Extensive modifications. 27 Oct 1997. DWF
1) Removed PRINTER support, which didn't work as expected.
2) Modified Keep_Aspect_Ratio code to work with POSITION keyword.
3) Added check for window-able devices (!D.Flags AND 256).
4) Modified PostScript color handling.
Craig Markwart points out that Congrid adds an extra row and column
onto an array. When viewing small images (e.g., 20x20) this can be
a problem. Added a Minus_One keyword whose value can be passed
along to the Congrid keyword of the same name. 28 Oct 1997. DWF
Changed default POSITION to fill entire window. 30 July 1998. DWF.
Made sure color decomposition is OFF for 2D images. 6 Aug 1998. DWF.
Added limited PRINTER portrait mode support. The correct aspect ratio
of the image is always maintained when outputting to the
PRINTER device and POSITION coordinates are ignored. 6 Aug 1998. DWF
Removed 6 August 98 fixes (Device, Decomposed=0) after realizing that
they interfere with operation in the Z-graphics buffer. 9 Oct 1998. DWF
Added a MARGIN keyword. 18 Oct 1998. DWF.
Re-established Device, Decomposed=0 keyword for devices that
support it. 18 Oct 1998. DWF.
Added support for the !P.Multi system variable. 3 March 99. DWF
Added DEVICE, DECOMPOSED=1 command for all 24-bit images. 2 April 99. DWF.
Added ability to preserve DECOMPOSED state for IDL 5.2 and higher. 4 April 99. DWF.
Added TV keyword to allow TVIMAGE to work like the TV command. 11 May 99. DWF.
Added the OVERPLOT keyword to allow plotting on POSITION coordinates
estabished by the preceding graphics command. 11 Oct 99. DWF.
Added automatic recognition of !P.Multi. Setting MULTI keyword is no
longer required. 18 Nov 99. DWF.
Added NOINTERPOLATION keyword so that nearest neighbor interpolation
is performed rather than bilinear. 3 Dec 99. DWF
Changed ON_ERROR condition from 1 to 2. 19 Dec 99. DWF.
Added Craig Markwardt's CMCongrid program and removed RSI's. 24 Feb 2000. DWF.
Added HALF_HALF keyword to support CMCONGRID. 24 Feb 2000. DWF.
Fixed a small problem with image start position by adding ROUND function. 19 March 2000. DWF.
Updated the PRINTER device code to take advantage of available keywords. 2 April 2000. DWF.
Reorganized the code to handle 24-bit images on 8-bit displays better. 2 April 2000. DWF.
Added BACKGROUND keyword. 20 April 2000. DWF.
Fixed a small problem in where the ERASE was occuring. 6 May 2000. DWF.
Rearranged the PLOT part of code to occur before decomposition state
is changed to fix Background color bug in multiple plots. 23 Sept 2000. DWF.
Removed MULTI keyword, which is no longer needed. 23 Sept 2000. DWF.
Fixed a small problem with handling images that are slices from 3D image cubes. 5 Oct 2000. DWF.
Added fix for brain-dead Macs from Ben Tupper that restores Macs ability to
display images. 8 June 2001. DWF.
Fixed small problem with multiple plots and map projections. 29 June 2003. DWF.
Converted all array subscripts to square brackets. 29 June 2003. DWF.
Removed obsolete STR_SEP and replaced with STRSPLIT. 27 Oct 2004. DWF.
Small modification at suggestion of Karsten Rodenacker to increase size of
images in !P.MULTI mode. 8 December 2004. DWF.
Minor modifications on Karsten Rodenacker's own account concerning margination
and TV behaviour. 8 December 2004. KaRo
There was a small inconsistency in how the image was resized for PostScript as
opposed to the display, which could occasionally result in a small black line
to the right of the image. This is now handled consistently. 3 January 2007. DWF.
Made a small change to CMCONGRID to permit nearest-neighbor interpolation for 3D arrays.
Previously, any 24-bit image was interpolated, no matter the setting of the NOINTERP
keyword. 22 April 2007. DWF.
Updated the program for the 24-bit Z-buffer in IDL 6.4. 11 June 2007. DWF.
Added new POSITION keyword functionality for !P.MULTI display. 9 Sept 2007. DWF.
Bit one too many times. Added _STRICT_EXTRA keywords for all _EXTRA keywords. 1 Feb 2008. DWF.
Added FSC_$TVIMAGE common block for interactive interaction with TVINFO. 16 March 2008. DWF.
Added SCALE keyword. 18 March 2008. DWF.
Added keywords to allow axes to be drawn around the image. 18 March 2008. DWF.
Added QUIET keyword to allow by-passing of FSC_$TVIMAGE common block updating. 21 March 2008. DWF.
Made BACKGROUND and ERASE valid keywords only on 24-bit devices. Ignored on others. 28 May 2008. DWF.
Cannot make color work in device independent way for axes, unless I handle axis color directly. To this
end, I have added an ACOLOR keyword. 16 June 2008. DWF.
Added BREWER keyword so I can specify Brewer colors with BACKGROUND and ACOLOR keywords. 16 June 2008. DWF.
Fixed a problem with the BACKGROUND keyword and multiple plots. 16 March 2009. DWF.
Added the ability to display transparent images. 13 May 2009. DWF.
Modified to work with 24-bit color PostScript in IDL 7.1. 24 May 2009. DWF.
Added MULTIMARGIN keyword to allow position adjustment when plotting with
!P.Multi. 7 July 2009. DWF.
Fixed a problem in which displaying an image with !P.MULTI turned on, switched the
color of the output window. If this happens to you, set the BACKGROUND keyword
to the color you want to have in the window. 4 January 2010. DWF.
Some LINUX distributions cannot both get the current color decomposition state and
set the state to another value on the same DEVICE command. I have changed all such
occurances to two commands. One gets the current state, the other sets it. 11 Oct 2010. DWF.
Added the SAVE keyword to save the data coordinate system established by adding axes
to the image. 29 Oct 2010. DWF.
If the AXES keyword is set, but no MARGIN or POSITION keyword is set, and the command
is not doing a multiplot, then a Margin of 0.1 is used so image axes are shown.
30 Oct 2010. DWF.
Changed the way alpha channel blending works. The alpha channel image is now blended
with the background image in the display, if it can be obtained for a partical graphics
device, or a background image can be passed to the program via the AlphaBackgroundImage
keyword, or failing that, the alpha channel image is blended with a white background.
1 November 2010. DWF.
Removed TVIMAGE_ERROR routine in favor of ERROR_MESSAGE, since other Coyote Library
routines are already used in the program. 1 Nov 2010. DWF.
Forgot to set the SET_PIXEL_DEPTH keyword in Z-Buffer to 24. Screwed up alpha channel
display. 2 November 2010. DWF.
Small error in alpha channel processing when images are the same size. Reorganized
the code to avoid duplication. 5 November 2010. DWF.
The SAVE keyword now always establishes a data coordinate system for the image
if this keyword is set, using the values of XRANGE and YRANGE. The data
coordinate system is coincident with the file position of the image. 11 Nov 2010. DWF.
Added the WHITE keyword. 12 Nov 2010. DWF.
Modified how the ERASE keyword works. Now images only erase the background when this
keyword is set and !P.MULTI[0] is set to 0. 12 Nov 2010. DWF.
Final color table restoration skipped in Z-graphics buffer. 17 November 2010. DWF.
Made changes that supports the BACKGROUND color in PostScript. Requires the program
PS_BACKGROUND from the Coyote Library. 17 November 2010. DWF.
If the BACKGROUND color is set, then ERASEIT=1 automatically. 17 November 2010. DWF.
Alpha images can only be produced in IDL 6.5 or higher. Issue warning. 17 November 2010. DWF.
BACKGROUND color changes affected multi-plots. Fixed 18 Nov 2010. DWF.
BACKGROUND color changes affected display in indexed color. Fixed 18 Nov 2010. DWF.
Removed TVIMAGE_CONGRID in favor of FSC_RESIZE_IMAGE, which always does the interpolation
with centered pixels, and allows nearest neightbor resampling of true-color images.
20 November 2010. DWF.
Incorporated TVSCALE functionality into TVIMAGE. 22 November 2010. DWF.
Problem fixed when displaying alpha image when POSITION and ALPHABACKGROUND keywords used
simultaneously. 8 Dec 2010. DWF.
More sophisticated selection of axis color. 5 Jan 2011. DWF.
The fix on 8 Dec 2010 was causing problems with positioning of normal alpha images.
I have now solved the original problem with a new ALPHABGPOSITION keyword, while
restoring functionality that was lost in the 8 Dec 2010 fix. 10 January 2011. DWF.
Added XTITLE and YTITLE keywords to add titles to image axes. 10 January 2011. DWF.
Added FONT, CHARSIZE, and TITLE keywords. 11 Jan 2011. DWF.
Depreciated ACOLOR keyword in favor of new COLOR keyword. 11 Jan 2011. DWF.
Added ADDCMD and WINDOW keywords to allow TVIMAGE to work with FSC_Window. 26 Jan 2011. DWF.
Added LAYOUT and PALETTE keywords. 28 Jan 2011. DWF.
Source: src/idl_cvs/tvimage_congrid.pro
NAME:
TVIMAGE_CONGRID
PURPOSE:
Shrink or expand the size of an array by an arbitrary amount.
This IDL procedure simulates the action of the VAX/VMS
CONGRID/CONGRIDI function.
This function is similar to "REBIN" in that it can resize a
one, two, or three dimensional array. "REBIN", however,
requires that the new array size must be an integer multiple
of the original size. CONGRID will resize an array to any
arbitrary size (REBIN is somewhat faster, however).
REBIN averages multiple points when shrinking an array,
while CONGRID just resamples the array.
CATEGORY:
2-D Plotting
CALLING SEQUENCE:
array = TVIMAGE_CONGRID(array, x, y, z)
INPUTS:
array: A 1, 2, or 3 dimensional array to resize.
Data Type : Any type except string or structure.
x: The new X dimension of the resized array.
Data Type : Int or Long (greater than or equal to 2).
OPTIONAL INPUTS:
y: The new Y dimension of the resized array. If the original
array has only 1 dimension then y is ignored. If the
original array has 2 or 3 dimensions then y MUST be present.
z: The new Z dimension of the resized array. If the original
array has only 1 or 2 dimensions then z is ignored. If the
original array has 3 dimensions then z MUST be present.
KEYWORD PARAMETERS:
INTERP: If set, causes linear interpolation to be used.
Otherwise, the nearest-neighbor method is used.
CUBIC: If set, uses "Cubic convolution" interpolation. A more
accurate, but more time-consuming, form of interpolation.
CUBIC has no effect when used with 3 dimensional arrays.
MINUS_ONE:
If set, will prevent CONGRID from extrapolating one row or
column beyond the bounds of the input array. For example,
If the input array has the dimensions (i, j) and the
output array has the dimensions (x, y), then by
default the array is resampled by a factor of (i/x)
in the X direction and (j/y) in the Y direction.
If MINUS_ONE is present (AND IS NON-ZERO) then the array
will be resampled by the factors (i-1)/(x-1) and
(j-1)/(y-1).
HALF_HALF:
If set, will tell CONGRID to extrapolate a *half* row
and column on either side, rather than the default of
one full row/column at the ends of the array. If you
are interpolating images with few rows, then the
output will be more consistent with this technique.
This keyword is intended as a replacement for
MINUS_ONE, and both keywords probably should not be
used in the same call to CONGRID.
OUTPUTS:
The returned array has the same number of dimensions as the original
array and is of the same data type. The returned array will have
the dimensions (x), (x, y), or (x, y, z) depending on how many
dimensions the input array had.
PROCEDURE:
IF the input array has three dimensions, or if INTERP is set,
then the IDL interpolate function is used to interpolate the
data values.
If the input array has two dimensions, and INTERP is NOT set,
then the IDL POLY_2D function is used for nearest neighbor sampling.
If the input array has one dimension, and INTERP is NOT set,
then nearest neighbor sampling is used.
EXAMPLE:
; vol is a 3-D array with the dimensions (80, 100, 57)
; Resize vol to be a (90, 90, 80) array
vol = TVIMAGE_CONGRID(vol, 90, 90, 80)
MODIFICATION HISTORY:
DMS, Sept. 1988.
DMS, Added the MINUS_ONE keyword, Sept. 1992.
Daniel Carr. Re-wrote to handle one and three dimensional arrays
using INTERPOLATE function.
DMS, RSI, Nov, 1993. Added CUBIC keyword.
Craig Markwardt, Dec, 1997. Added halfhalf keyword to
more evenly distribute "dead" pixel row
Use uniformly spaced grid points for half_half W. Landsman Feb. 2000
(and slightly modified by C. Markwardt 14 Feb 2000)
DWF, FSC, 22 Apr 2007. Modified the program so that 3D arrays use nearest-neighbor
interpolation unless the INTERP keyword is set.
DWF, FSC, 22 Apr 2007. Function renamed from CMCONGRID to TVIMAGE_CONGRID on
recommendation of Craig Markwardt as he wants no part of this. :-)
Source: src/idl_cvs/tvrd_24.pro
NAME:
TVRD_24
PURPOSE:
This function reads a 24-bit image from a 24-bit or 8-bit
display device, returning a pixel-interleaved byte array
of type BYTARR(3, xsize, ysize), where xsize and ysize are
the dimensions of the current graphics device.
CATEGORY:
Graphics.
CALLING SEQUENCE:
image = TVRD_24()
INPUTS:
None
KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
image = tvrd_24()
MODIFICATION HISTORY:
Part of Struan's Surface Tutorial:
http://www.sljus.lu.se/stm/IDL/Surf_Tips/
Written by: Struan Gray, Sljusfysik, Lunds Universitet, 970305.
Source: src/idl_cvs/tv_24.pro
NAME:
TV_24
PURPOSE:
This procedure displays a 24-bit image on the current
graphics device, constructing a custom colour table if
the device supports less than 257 colours.
CATEGORY:
Graphics.
CALLING SEQUENCE:
TV_24(image)
INPUTS:
IMAGE: the pixel-interleaved, 24-bit image to be displayed.
IMAGE should be of type BYTARR(3,M,N).
KEYWORD PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
On 8-bit displays the current colour table is overwritten,
on 24-bit displays it is preserved.
RESTRICTIONS:
None.
EXAMPLE:
Display a 24-bit image on an 8-bit display:
TV_24(image)
MODIFICATION HISTORY:
Part of Struan's Surface Tutorial:
http://www.sljus.lu.se/stm/IDL/Surf_Tips/
Written by: Struan Gray, Sljusfysik, Lunds Universitet, 970305.
Source: src/idl_cvs/twoscomplement.pro
NAME:
TWOSCOMPLEMENT
PURPOSE:
Taking the Two's Complement of an integer
CATEGORY:
Math, Hardware, CAMAC
CALLING SEQUENCE:
twoscomp = TwosComplement( int )
INPUT:
int - raw encoder value (8, 16 or 32 bit integer)
OUTPUT:
twoscomp - Two's complement of input.
KEYWORDS:
Optional Input:
NBITS - # of bits; throw away this bit if there is a carry after
adding 1 to the complement. Default is determined by data type.
IfNeg - Only return the Two's Complement if value negative
ALGORITHM:
Taking the Two's Complement of a k-Digit Bitstring:
1.Complement the bitstring; i.e., change all 0s to 1s and all 1s to 0s; retain all leading 0s in your result.
2.Add 1 to this binary number (if there is a carry of 1 into the (k+1)st position, throw it away so that the
result is still k-digits).
3.The result from (2) is the two's complement of the bitstring
COMMENT:
Works in many cases, but sign bit may get extended in some applications
MODIFICATION HISTORY:
5-Jun-00 WMD Added Nbits & IfNeg Keywords
Source: src/idl_cvs/twosurf.pro
NAME:
TWOSURF
PURPOSE:
This function returns a 24-bit image of two interlocking surfaces
with various combinations of colour, shading and grids.
For each surface the colour coding can tied to the surface height
or to an independent array. A grid can be overlaid on the surface or
used to mask a coloured and/or shaded plot so as to produce a coloured
and/or shaded grid. Light shading can be applied to both the coloured
and gridded surface, or just the coloured surface, leaving the grid
unshaded.
The light shading parameters are determined by previous calls to
SET_SHADING. The viewing position and 3d-2d scaling are handled by
the usual graphics keywords - see the documentation for SURFACE and
SHADE_SURF in the IDL user's guide.
The image returned by TWOSURF is a pixel-interleaved 24-bit image
of type bytarr(3, xsize, ysize). If on entry the current graphics
device is a screen window or the z-buffer, xsize and ysize are the
dimensions of the current or default window on that device. If the
current device is anything else (eg a plotter or a postscript file)
the default size of the z-buffer (640x480) is used. On exit the
current graphics device and colour map are unchanged.
CATEGORY:
Graphics, Surface Plotting
CALLING SEQUENCE:
result = TWOSURF(SURFONE, SURFTWO)
INPUTS:
SURFONE: A two-dimensional array containing the data for the
first of the surfaces to be plotted.
SURFTWO: A two-dimensional array containing the data for the
second of the surfaces to be plotted.
KEYWORD PARAMETERS:
COLOUR1: Set this keyword to include colour coding in the plot
of SURFONE The default is no colour-coding.
COLOUR2: As for COLOUR1 but for SURFTWO. The default is to be
the same as COLOUR1.
COLDATA1: A variable or array of type byte containing the colour
data to be used when plotting a colour plot.
If COLDATA1 is a scalar then it is assumed to be an index to
a colour in COLMAP which is used to give a single colour to
the whole surface.
If COLDATA1 is a vector of at least three elements its first
three elements are treated as a rgb colour triple and used
to give a single colour to the whole surface.
If COLDATA1 is two-dimensional it is treated as an array of
colour indices of COLMAP and is used to give each data point
it's own colour. If COLDATA1 has different dimensions to
SURFONE, CONGRID is used to stretch or squeeze a copy of
COLDATA1 to fit.
If COLOUR1 is set but COLDATA1 is undefined or does not
satisfy any of the above conditions, a BYTSCL'ed version of
SURFONE is used to produce a plot coloured according to height.
COLDATA2: As for COLDATA1 but for SURFTWO.
SHADE1: Set this keyword to perform light shading for SURFONE.
SHADE = 0: no shading
SHADE = 1: shade everything
SHADE = 2: don't shade the grid
The default is no shading.
SHADE2: As for SHADE1 but for SURFTWO. The default is to be
the same as SHADE1.
GRID1: Set this keyword to apply grids to SURFONE.
GRID = 0: no grid
GRID = 1: overlay a grid on the surface
GRID = 2: use the grid as a mask
The default is no grid
GRID2: As for GRID1 but for SURFTWO. The default is to be
the same as GRID1.
CGRID1: The colour to use for overlaid grids on SURFONE. If CGRID
is a number it is treated as an index in the colour table
given by COLMAP. If CGRID is an three-element vector of
bytes it is treated as the rgb values for a colour. If it
is anything else or undefined the grid is plotted white.
CGRID2: As for CGRID1 but for SURFTWO. The default is to be
the same as CGRID1.
TRANSP1: The transparency factor for SURFONE, which determines how
much the hidden parts of SURFTWO show through SURFONE's
surfaces. TRANSP1 is converted to type FLOAT before use,
where 0.0 corresponds to an opaque surface and 1.0 mixes
equal parts of SURFONE and SURFTWO.
Note that if GRID1=2, the holes in the grid are already
completely transparent and TRANSP1 affects only the grid
lines.
The default is 0.0.
TRANSP2: As for TRANSP1 but for SURFTWO. The default is to be
the same as TRANSP1.
COLMAP: The colour map to use for plotting of the colour data.
If a number is given the corresponding inbuilt IDL colour
map is used. Otherwise COLMAP should be an array of three
byte vectors [red, green, blue] such as those returned by
the TVLCT, /get procedure. If COLMAP is not set, the
current colour map is used. Note that TWOSURF maintains
the current colour map even if a second colour map is
specified for the plot.
Because the z-buffer is only an 8bit device plotting
SURFONE and SURFTWO with different colours has to be done
by user manipulation of COLMAP and the arrays passed as
COLDATA1 and COLDATA2.
If either one of the surfaces has light shading applied
the background is set to [0,0,0] (black), otherwise the
background colour of COLMAP is used.
_EXTRA: Used to pass extra plot parameters to both SHADE_SURF and
SURFACE. _EXTRA provides a convenient way of passing
common parameters such as viewing angle and plot position.
Note that only keywords valid for both SHADE_SURF and
SURFACE can be used.
If EXTRA_SHADE is set, _EXTRA is ignored for the shaded
plots, similarly with EXTRA_SURF and surface plots.
Some keywords (eg, SHADES, COLOR, NODATA, NOERASE) will
interfere with the plotting done by ONESURF and lead to
unpredictable results.
_EXTRA is itself passed to SHADE_SURF and SURFACE using
the _EXTRA keyword, so keywords which expect a data value
to be changed (eg [XYZ]TICK_GET) will not work.
Useable keywords are: AX, AZ, MAX_VALUE, MIN_VALUE, SAVE,
[XY]TYPE, CHARSIZE, CHARTHICK, CLIP, DATA, DEVICE, FONT,
NOCLIP, NORMAL, POSITION, SUBTITLE, T3D, THICK, TICKLEN,
TITLE, [XYZ]CHARSIZE, [XYZ]GRIDSTYLE, [XYZ]MARGIN,
[XYZ]MINOR, [XYZ]RANGE, [XYZ]STYLE, [XYZ]THICK,
[XYZ]TICKFORMAT, [XYZ]TICKLEN, [XYZ]TICKNAME, [XYZ]TICKS,
[XYZ]TICKV, [XYZ]TITLE, ZVALUE.
EXTRA_SHADE: Used to pass extra plot parameters to the SHADE_SURF
procedure only. EXTRA_SHADE is passed to SHADE_SURF
using the _EXTRA keyword so keywords such as IMAGE
which expect a variable to be altered will not work.
As with _EXTRA, setting the SHADES keyword can lead
to unpredictable results. EXTRA_SURF should be an
anonymous structure.
EXTRA_SURF: Used to pass extra plot parameters to the SURFACE
procedure only. Restrictions are as for _EXTRA and
EXTRA_SHADE. If EXTRA_SHADE is set, but EXTRA_SURF
is not, EXTRA_SURF is made equal to _EXTRA, and vice
versa. COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
EXAMPLE:
SURFONE plotted as a shaded, coloured, partially transparent
surface with the colours corresponding to height and a black
grid, interlocking with SURFTWO, plotted as a shaded, coloured,
partially transparent surface also coloured according to height
but with different colours, and with an unshaded white grid:
image = twosurf(surfone, surftwo, $
colour1 = 1, $
coldata1 = 127b + bytscl(surfone)/2b, $
shade1 = 2, $
grid1 = 1, $
cgrid1 = [0,0,0], $
transp1 = 0.3, $
colour2 = 1, $
coldata2 = 127b - bytscl(surftwo)/2b, $
shade2 = 2, $
grid2 = 1, $
cgrid2 = [250,250,250], $
transp2 = 0.6, $
colmap=25)
For further examples see the SURFDEMO procedure MODIFICATION HISTORY:
Part of Struan's Surface Tutorial:
http://www.sljus.lu.se/stm/IDL/Surf_Tips/
Written by: Struan Gray, Sljusfysik, Lunds Universitet, 970305.
970313 SMG - added _extra, extra_surf and extra_shade keywords
for better control of graphics keywords.
Source: src/idl_cvs/type.pro
NAME:
TYPE
VERSION:
3.0
PURPOSE:
Finds the type class of a variable.
CATEGORY:
Programming.
CALLING SEQUENCE:
Result = TYPE(X)
INPUTS:
X
Arbitrary, doesn't even need to be defined.
OPTIONAL INPUT PARAMETERS:
None.
KEYWORD PARAMETERS:
None.
OUTPUTS:
Returns the type of X as a long integer, in the (0,9) range.
OPTIONAL OUTPUT PARAMETERS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
Extracts information from the SIZE function.
MODIFICATION HISTORY:
Created 15-JUL-1991 by Mati Meron.
Source: src/idl_cvs/unsetup_ps.pro
NAME:
unsetup_ps
PURPOSE:
close a postscript file (opened by setup_ps) and re-set system
variables for previous device.
CATEGORY:
Printing, Cross-platform Printing of Plots
CALLING SEQUENCE:
UNSETUP_PS, name, PRINTER=printer
INPUTS:
(Optional)
name - name of file without extenstion (defaults to IDL)
(extention will always be .ps)
KEYWORD PARAMETERS:
Inputs:
PRINTER - printer to send file to (only the string before the
first blank is used). The printer may have been
specified in the call to SETUP_PS, else the default
is used printer.
NOTE: if PRINTER='postscript', file will not be sent
to a printer
NOHEADER - if set, -h is inserted in lpr command
OUTPUTS:
none
CALLING EXAMPLE:
printer = 'picasso color printer' ; or
printer = 'postscript color ' ; or
printer = 'b143 Laserwriter in B143' ; or
printer = 'default printer' ;
setup_ps,'myplot', PRINTER=printer
plot,indgen(11) ; any number of plot commands
unsetup_ps ; send to printer and return to X
RELATED ROUTINES:
setup _ps
MODICATION HISTORY:
30-Oct-2009 changed NoHeader string on lp command to "-o nobanner"
05-Feb-03 added keyword NoHeader
12-Feb-99 If printer = 'postscript' or 'file', don't send to
a printer. If printer = 'default', send to the
default printer (i.e., none specified)
Write file in the login area.
27-Jan-99 adapt for SunOS; change y.margin settings [BD]
14-Oct-97 Written by Bill Davis
Source: src/idl_cvs/unsetup_tek.pro
NAME:
unsetup_tek
PURPOSE:
undo system variables from setup_tek call.
CATEGORY:
Printing, Cross-platform plotting
CALLING SEQUENCE:
UNsetup_tek
INPUTS:
(Optional)
name - name of file without extenstion (defaults to idl)
(extention will always be .tek)
KEYWORD PARAMETERS:
OUTPUTS:
none
CALLING EXAMPLE:
setup_tek
plot,indgen(11) ; any number of plot commands
unsetup_tek ; send to printer and back to X
RELATED ROUTINES:
setup_tek
LIMITATIONS
If using the CH_ crosshair routines, will need to call the following
after this routine:
IDL> CH_SET, yourGraph, NewX=!x,NewY=!y,NewP=!p
MODICATION HISTORY:
13-Feb-06 add XTC calls
08-May-01 call CH_SET, if user calling cross-hair routines
26-Oct-00 Written by Bill Davis
Source: src/idl_cvs/unsetup_xpc.pro
NAME:
unsetup_xpc
PURPOSE:
Close plots file opened with setup_xpc, and send to the X-windows Plot Controller
(XPC) by figuring out next file in the sequence it is looking for.
CATEGORY:
Printing, Cross-platform plotting
CALLING SEQUENCE:
UNsetup_xpc
INPUTS:
(Optional)
name - name of file without extenstion (defaults to idl)
(extention will always be .tek)
KEYWORD PARAMETERS:
OUTPUTS:
none
CALLING EXAMPLE:
setup_xpc
PLOT, indgen(11) ; any number of plot commands
XYOUT, .2, .3, 'This is a Label'
unsetup_xpc ; send to printer and back to X
RELATED ROUTINES:
setup_xpc
LIMITATIONS
If using the CH_ crosshair routines, will need to call the following
after this routine:
IDL> CH_SET, yourGraph, NewX=!x,NewY=!y,NewP=!p
NOTE:
This, in conjunction with unsetup_xpc, is supposed to be a replacement for XPC.
MODICATION HISTORY:
18-Nov-2009 Written by Bill Davis
Source: src/idl_cvs/usesigmath.pro
NAME:
useSigMath
PURPOSE:
parse an MDSplus TDI string, substituting Brian Nelson's Signal Math TDI
routines for +,-,* and /, so timebases get adjusted, if necessary.
CATEGORY:
MDSplus
CALLING SEQUENCE:
IDL> newTDI = useSigMath( tdi )
INPUTS:
tdi = a TDI string in which any signals are preceded by '\'
OUTPUTS:
newTDI - math operations -, +, * & / are replaced by Brian Nelson's SigMath
functions sigsub, sigadd, sigmul and sigdiv.
EXAMPLE:
print, useSigMath('(\engineering::ip1+\engineering::ip2)/2')
SIGADD(\engineering::ip1,\engineering::ip2)/2
print, useSigMath('\wf::ip-\wf::ipf4/\wf::ipf5')
SIGDIV(SIGSUB(\wf::ip,\wf::ipf4),\wf::ipf5) NOTE ORDER OF OPERATIONS IS LEFT TO RIGHT
print, useSigMath('1000*\wf::ip-\engineering::ip1')
SIGSUB(1000*\wf::ip,\engineering::ip1)
print, useSigMath('(\engineering::ip1/1000 - \wf::ip)')
SIGSUB(\engineering::ip1/1000,\wf::ip)
print, useSigMath('1000*\wf::ip-\engineering::ip1')
SIGSUB(1000*\wf::ip,\engineering::ip1)
print, useSigMath('\wf::ip-bcsmooth(\engineering::ip1/1000)')
SIGSUB(\wf::ip,bcsmooth(\engineering::ip1/1000))
print, useSigMath('1000*\wf::ip-(\engineering::ip1+\engineering::ip2)/2')
SIGSUB(1000*\wf::ip,SIGADD(\engineering::ip1,\engineering::ip2)/2)
print, useSigMath('abs(bcsmooth(\engineering::ip1/1000)-\wf::ip)')
(abs(SIGSUB(bcsmooth(\engineering::ip1/1000),\wf::ip)))
print, useSigMath('\wf::ip-\wf::ip[0]')
LIMITATIONS:
Without brackets expressions will be evaluated from left to right.
The SigMath routines do not correct for different units, like Amps and KiloAmps.
Signals are only recognized when they begin with a backslash.
MODIFICATION HISTORY:
04-Aug-2008 made to work (i.e., not use Sigmath) with '\wf::ip-\wf::ip[0]'
WRITTEN 10-Aug-2007 by Bill Davis
Source: src/idl_cvs/usingxwindows.pro
NAME:
usingXwindows
PURPOSE:
Prompt user for switching Plot device to X.
CATEGORY:
Widgets, X-windows
CALLING SEQUENCE:
IDL> OK = usingXwindows()
COMMON BLOCKS:
NONE
USE:
Called in case a user was using Tektronix graphics, or the Postscript
device and forgot to SET_PLOT,'X' before using widgets, etc.
MODIFICATION HISTORY:
Aug-00 Written [BD]
Source: src/idl_cvs/vaxis.pro
NAME:
vaxis
PURPOSE:
shell around AXIS procedure that sees if number of minor y tick
marks need to be reduced, and if the number of y tick labels need
to be cut in half.
CATEGORY:
Plotting
CALLING SEQUENCE:
IDL> vaxis, /yaxis
INPUTS:
if /yaxis not set, will just call AXIS routine with whatever inputs are passed
KEYWORD PARAMETERS:
Optional:
yminor - as in plot command
yrange - as in plot command
ystyle - as in plot command
yTickFormat - defaults to 'LabelEveryOtherTick'
debug - if set, will print things and stop in routine
OUTPUTS:
none
COMMON BLOCKS:
vplot_local
EXAMPLE:
IDL> a=mk_color()
IDL> x=findgen(100)
IDL> y=sin(x/8*4)*exp(x/30)
IDL> pos=[.1,.77,.9,.9]
IDL> plot,x,y,ystyle=8, pos=pos, yTickFormat='LabelEveryOtherTick', yminor=2
IDL> vaxis, yaxis=1,/debug ;;; , yTickFormat='LabelEveryOtherTick'
NOTES:
15-Aug-2013 fixed large major Y tick marks
WRITTEN 29-Oct-2007 By Bill Davis, PPPL.
Source: src/idl_cvs/vcomp.pro
NAME:
vcomp
PURPOSE:
"visually compress" (resample) an array for faster plotting of lines.
All data spikes should be retained.
Will return y points for each x -- the min & max values.
IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs
CATEGORY:
Plotting
CALLING SEQUENCE:
VComp, inTime, inData, outTime, outData, NFINAL=4096
KEYWORDS
Optional:
NFINAL - # of points to "compress" to. Defaults to estimated
# of pixels on x axis
COMMON BLOCKS:
none
EXAMPLE:
IDL> vcomp, inTime, inData, outTime, outData, NFINAL=4096
NOTES:
assumes equally spaced data, but might be OK for some cases.
LIMITATIONS:
This doesn't work precisely when:
1) only points are drawn, rather than connecting lines,
2) the X values are not monotonically increasing, or
3) even if X intervals are not constant (although errors would probably be subtle).
MODIFICATION HISTORY:
26-Jul-2004 NINT() introduced a bug in some cases; now fixed
17-May-2004 Bug fixed: not going to full time range
22-Apr-2004 If POS being used, x.margin irrelevant, so assume 0
Written 10-Nov-99 by Bill Davis
Source: src/idl_cvs/vectorsurf.pro
NAME:
vectorsurf
PURPOSE:
Shows a fancy way to plot irregulary spaced data from x,y & z vectors.
CATEGORY:
2-D Plotting, Example
CALLING SEQUENCE:
vectorsurf, x, y, z
INPUTS:
tag - MDSplus tag or node name in
KEYWORD PARAMETERS
Input:
DRAWXSIZE = drawXsize
DRAWYSIZE = drawYsize
BG_COLOR = bg_color
OUTPUTS:
none
EXAMPLE:
IDL> x=[4,6,1,7,1,8,5,2,4]
IDL> y=[3,3,1,6,4,5,6,8,1]
IDL> z=sqrt((x-3)^2+(y-2)^2)+randomn(seed)+2
IDL> vectorsurf, x, y, z
MODIFICATION HISTORY:
05-Sep-97 Written by Bill Davis
from IDL's d_mathstat.pro in the IDL 5.0 release
Written by: DC, RSI, 1995
Source: src/idl_cvs/vgds_title.pro
NAME:
vgds_title
PURPOSE:
write a plot title with shot date and time and NSTX label
CATEGORY:
Plotting
CALLING SEQUENCE:
IDL> vgds_title, mytitle, ishot
INPUTS:
mytitle = whatever you want as the main plot title.
ishot = shot number.
KEYWORD PARAMETERS:
Keywords:
noShot - if set, do not plot shot number
noTime - if set, do not plot time
TopMargin - in characters, extra space to shift down the characters
HLP - When set, help information is printed.
OUTPUTS:
none
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> !Y.OMARGIN=[0,1]
IDL> plot,indgen(100)
IDL> vgds_title, 'This is my title', 100523
NOTES:
You'll probably want a little more room at the top of your plots, e.g.
IDL> !Y.OMARGIN=[0,1]
MODIFICATION HISTORY:
21-Sep-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/viewtext.pro
NAME:
viewtext
PURPOSE:
View a string, or string array, of text in a scrollable text widget.
DESCRIPTION:
CATEGORY:
Widgets
CALLING SEQUENCE:
viewtext, text [, KEYWORDS]
INPUTS:
text : String (scalar, 1-D or 2-D array) of text to be displayed.
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS:
EXIT = Label for exit button. Default is 'Dismiss'.
FONT = Font to use for the text. Default is '8x13'.
GROUP = Group Leader.
TITLE = Title of widget.
XSIZE = Width of text. Default is 80 characters.
YSIZE = Length of text. Default is 40 lines.
OUTPUTS:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
23-Feb-2005 if LASTPRINTER in private common defined, use that.
pop dialog box on which printer HARDCOPY went to.
3-Feb-03 /FIT keyword and made resizable.
08-Jun-00 Added support for VMS (Bill Davis)
Written by Doug Loucks, Lowell Observatory, May, 1993.
1/7/94, DWL, Added Hardcopy button.
8/25/94, DWL, Minor mods.
96/07/02, MWB, changed YSIZE default to 40 lines.
Source: src/idl_cvs/vplot.pro
NAME:
vplot
PURPOSE:
Just like plot, except it calls vcomp to "visually compress"
an array for faster delivery of graphs at the expense of CPU time.
All data spikes should be retained.
CATEGORY:
Plotting
CALLING SEQUENCE:
vplot, time, data, _extra=_extra
KEYWORDS
Just like for plot (except you need both X & Y)
xIsHHMM - plot x axis as time in HH:MM format (assume time in hours)
xWithSeconds - plot x axis as time in HH:MM:SS format (assume time in hours)
COMMON BLOCKS:
vplot_local
EXAMPLE:
IDL> vplot, time, data, title='whatever', xrange=[0,2]
NOTES:
VComp assumes equally spaced data, but might be OK for some cases.
Use oVPlot for overplotting.
LIMITATIONS:
This is compuationally intense, so is not appropriate for
all applications, but for I/O-bound plotting can speed up 10x or more.
Will return y points for each x -- the min & max values.
IF nFinal GE N_ELEMENTS(inData)*2 will just return inputs
MODIFICATION HISTORY:
05-Jul-2011 If axes are small, reduce number of tick marks, but use defaults
if close. If aspect ratio is long, adjust ticklengths for vertical
and horizontal axes.
14-Apr-2010 create window if none in use, so can do scaling. [BD]
16-Apr-2009 Removed xTickFormat='betterTickLabels' when want HH:MM..
11-Feb-2008 fixed bug for pingplot.pro
30-Oct-2007 improve number of tick marks, and length.
08-May-2006 added logic if _extra contains range, but both equal
03-Mar-2006 add xIsHHMM keyword
26-Jul-04 make so plots "nice" range, like IDL default, if
15-Apr-04 handle when no additional paramters entered
add keyword for xtick_get (seem to need to specify explicitly)
Written 20-May-01 by Bill Davis
Source: src/idl_cvs/vt100.pro
NAME:
VT100
PURPOSE:
Define the TEK and VT100 commands for use in IDL. Especially
useful for MAC users who use Versaterm or users who otherwise
want to do Tektronix plots while connected to their UNIX
platform of choice.
CATEGORY:
Misc
CALLING SEQUENCE:
VT100
INPUT PARAMETERS:
NONE
OPTIONAL INPUT PARAMETERS:
NONE
KEYWORDS:
NONE
OUTPUTS:
NONE
COMMON BLOCKS:
NONE
SIDE EFFECTS:
NONE
RESTRICTIONS:
If you want to use the TEK command, you need to issue the VT100
command first.
PROCEDURE:
CODE TYPE: modeling, analysis, control
CODE SUBJECT: operation, handling, edge, rf, transport, equilibrium
EASE OF USE: can be used with existing documentation
OPERATING SYSTEMS: UNIX of all flavors
EXTERNAL CALLS: NONE
RESPONSIBLE PERSON: Ray Jong
DATE OF LAST MODIFICATION: 01/19/99
MODIFICATION HISTORY:
Created by Michael D. Brown, LLNL
Source: src/idl_cvs/watchevents.pro
NAME:
watchevents
PURPOSE:
Widget to monitor occurrence of MDSplus events.
If all events do not happen before next occurance of first event,
send e-mail.
CATEGORY:
Events, MDSplus
CALLING SEQUENCE:
IDL> watchevents, events=['NSTX_SOC', 'my_event' ]
IDL> watchevents, emailTo=['vlad@pppl.gov, joeshmoe@pppl.gov'], $
events=['NSTX_ACQ_DONE', 'CAM1_DONE', $
'CAM2_DONE','CAM3_DONE','CAM4_DONE' ]
to get all MPTS-relevant events:
IDL> watchevents,/shot,/show,add=['NSTX_ABC', 'MPTS_FORCEFIT', $
'NSTX_ABS','NSTX_KLC','TS_RAW_READY']
INPUTS:
none.
KEYWORD PARAMETERS:
(optional)
TEST - if set, appends TEST to all events
EVENTS_WANTED - Character array of events to watch for.
defaults to ['NSTX_SOC', 'CAM1_DONE',
'CAM2_DONE','CAM3_DONE','CAM4_DONE' ]
GROUP_LEADER - Group_Leader ID
NOCLEAR - if set, will not clear events when first event is recognized
PRINT - if set, will print messages when events are recognized
SHOWSHOTS - if set, will display shot numbers declared with the events
TIME - if set, will display time-of-day when event was declared
add_events - if set, will add these event(s) to the default
BIG - if set, fonts are big
WALL - if set, events of interest for display wall, and big font
OUTPUTS:
none.
NOTES:
The time of day will be printed for the first event, and the other times
will be cleared. Then the time difference will be printed as mm:ss,
so :12 would mean it came 12 seconds after the first event.
TESTING
IDL> watchevents, EVENTS_WANTED=['MY_TEST_EVENT_1','MY_TEST_event_2'], $
/Shots
and from a VMS computer:
IDL> SetMDSShotEvent,'MY_TEST_EVENT_1', 999999
COMMON BLOCKS:
none
ROUTINES USED:
MK_COLOR, usingXwindows, MDSEVENT
EXAMPLE:
IDL> watchevents
LIMITATION:
Shot numbers are only returned when running on VMS currently.
NOTES:
As the events are declared, the boxes turn color.
When the first event in the list is recognized, the other boxes are
set to yellow (unless /noClear was set). Shot numbers declared with
the events may optionally be displayed.
The status fields are initially the background color.
A program calling this routine, might want to save !D.WINDOW
before the TV commands and restore it immediately afterwards.
MODIFICATION HISTORY:
08-Sep-08 removed mdsconnect.
10-Jun-05 Converted from Monevents.pro for Vlad.
03-Feb-04 added wall keyword
10-Feb-03 added keyword add_event [BD]
14-Jun-01 Default to showing time
20-Jul-00 Written by Bill Davis, PPPL
Source: src/idl_cvs/webdisplay.pro
NAME:
webdisplay
PURPOSE:
Display web pages from IDL for Help, or other purposes.
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> webdisplay, url
INPUTS:
url = URL to display.
KEYWORD PARAMETERS:
OUTPUTS:
NONE
COMMON BLOCKS:
NONE
MODIFICATION HISTORY:
06-Jan-03 At PPPL, will find "hidden" netscape on Linux
16-Apr-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/webplotsum.pro
NAME:
webplotsum
PURPOSE:
Plot vs. time a summary of a shot in a small frame
Ip, D-alpha, stored energy, NB & RF power are plotted.
CATEGORY:
Plotting
CALLING SEQUENCE:
IDL> webplotsum, shot
INPUTS:
shot - shot # (defaults to current shot)
KEYWORD PARAMETERS:
Optional Keywords:
tois - times of interest at which a dashed vertical line will be drawn
xsize -
ysize -
verbose -
debug -
labelShot -
signames -
pos -
minIP -
x1 -
y1 -
xfrac -
yFrac -
charsize -
charThick -
thick -
xmargin -
widthFactor - if set, ysize = xsize * widthFactor
noLoad - if set, do not load a color table, even if colorsearch
returns a bad status
markTime - time at which to draw a vertical dashed line on graph
OUTPUTS:
NONE
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> webplotsum, 119923
NOTES:
Used in weblogplot.pro, amoung others
MODIFICATION HISTORY:
20-Oct-2010 for MSE calibration, check for beam data, so can have
time include it, even if plasma current is too low
17-Aug-2010 compute X tick length based on position array
27-May-2010 fixed bug when last signals not there, was returning before
plotting.
07-Apr-2010 tweaked tick length & number of minor tick marks
02-Apr-2010 added lColor keyword for index color of dashed line
18-Dec-2009 add keyword noLoad and don't use mk_color if not necessary
29-Sep-2009 display Pnb and Prf, if present
07-Apr-2009 use \pnb+\prf if \ptot not there.
13-Mar-2008 handle missing ptot
04-Mar-2008 Written by Bill Davis, PPPL, for Stan Kaye
Source: src/idl_cvs/weekday.pro
NAME:
WEEKDAY
PURPOSE:
Compute weekday given year, month, day.
CATEGORY:
Dates
CALLING SEQUENCE:
wd = weekday(y,m,d,[nwd])
INPUTS:
y, m, d = Year, month, day (Like 1988, 10, 31). in
KEYWORD PARAMETERS:
OUTPUTS:
wd = Returned name of weekday. out
nwd = optional Weekday number. out
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
R. Sterner. 31 Oct, 1988.
Johns Hopkins University Applied Physics Laboratory.
RES 18 Sep, 1989 --- converted to SUN
Copyright (C) 1988, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
Source: src/idl_cvs/wfmdsshotevent.pro
NAME:
wfMDSshotEvent
PURPOSE:
Wait for an MDSplus event, with shot number coming in
CATEGORY:
MDSplus, Events
CALLING SEQUENCE:
wfMDSshotEvent, event, shotnum, [,/QUIET][,STATUS=istat]
INPUT PARAMETERS:
event = name of an MDSplus event to wait for.
RETURNED PARAMETERS:
shotnum - whatever data was passed when the event was set.
for MDSplus events, except for nstx_acq_started
Keywords (Optional):
ASCII - if set, will assume data block contains ascii representation of numbers
NOCONNECT - if set, will not try to connect to an MDSplus server
SERVER - if not set, will connect to default server in OpenMDSshot
QUIET = prevents IDL error if MDSplus command fails
STATUS = return status, low bit set = success
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
PROCEDURE:
Makes a call to MDSplus shared image library
procedure MDS$WTEVENT and checks for errors.
MODIFICATION HISTORY:
11-Nov-2008 Default to no mdsconnect [BD]
02-Nov-2008 Return -1 if error from mdsvalue. Have an option not to
connect.
09-Mar-2007 Added ASCII keyword which is needed on sflip PC
08-Jul-2005 Added support for Windows
31-May-05 include server keyword
06-Apr-05 use MdsValue( 'WFEVENT($)'... instead. [BD]
24-May-01 If on Unix, connect to VMS if not already [BD]
06-Nov-00 Made same version work on VMS & Unix [BD]
copied from mds$wfevent.pro, so could have the same name on vms & unix
VERSION 1.0, CREATED BY T.W. Fredian, April 22,1991
debug version 7/14/05 PR syntax error in if/endif structure
Source: src/idl_cvs/where_arr.pro
NAME:
where_arr
PURPOSE:
Return the subscripts where a given set of values equal the values
in the input array. It is basically an expansion of IDL where in
which the condition to match can be an array.
CATEGORY:
Strings, Searching
CALLING SEQUENCE:
ss = where_arr(full_arr, sub_arr)
ss = where_arr(a, b)
ss = where_arr(a, b, count)
ss = where_arr(a, b, count, /notequal) - invert sense
ss = where_arr(a, b, count, /map_ss)
INPUT:
full_arr- The complete array which is to be searched
sub_arr - The subset array of the values to search "full_arr" of
KEYWORD PARAMETERS:
notequal - if set, return indices where values are NOTEQUAL
map_ss - If set, then return the index in the "sub_arr" where
first occurance of the element exists in the "full_arr"
The length of the output is the same as "full_arr"
OUTPUT:
returns the subscripts where "sub_arr" occurrs in "full_arr". If
there are no matches, return a -1.
OPTIONAL OUTPUT:
count - The number of matches
HISTORY:
Written 30-Apr-91 by M.Morrison
1-Jul-94 (SLF) - add NOTEQUAL keyword
14-Nov-97 (MDM) - Added /MAP_SS keyword
09-Mar-98 (JSN) - change loop from integer to long
Source: src/idl_cvs/which.pro
NAME:
WHICH
PURPOSE:
Like Unix which, prints the path of an IDL routine.
CATEGORY:
Utility
CALLING SEQUENCE:
Which, Name
INPUTS:
Name: The string containing the name of the procedure.
If no '.' in name, ".pro" is appended.
Under Unix, Name may be "*" to get information on
first routine to satisfy match.
KEYWORDS:
PRINT: If set, this keyword sends the output of WHICH to the
default printer. Under Unix, if PRINT is a string, it is
interpreted as a shell command used for output with
the documentation from WHICH providing standard input
(i.e. PRINT="cat > junk").
OUTPUT: returns full path of file found;
will return null string if none found
QUIET: If set, no printing to IDL session is done
UNIX KEYWORDS:
DIRECTORY: The directory to search. If omitted, the current directory
and !PATH are used.
MULTI: If set, this flag allows printing of more than one file if the
requested module exists in more than one directory in the path
and the current directory.
VMS KEYWORDS:
FILE: If this keyword is set, the output is left in the file
"userlib.doc", in the current directory.
PATH: An optional directory/library search path. This keyword uses
the same format and semantics as !PATH. If omitted, !PATH is
used.
OUTPUTS:
Documentation is sent to the standard output unless /PRINT
is specified.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Output is produced on terminal or printer.
RESTRICTIONS:
The DIRECTORY and MULTI keywords are ignored under VMS. The
FILE and PATH keywords are ignored under Unix.
EXAMPLE:
To obtain documentation for the User's Library function DIST, enter:
Which, 'DIST', output=fullpathname
For a graphical interface to WHICH, see the procedure XDL.
MODIFICATION HISTORY:
13-Apr-99 Allow findind files on VMS if not in libraries [BD]
Converted from IDL DOC_LIBRARY by Bill Davis, March, 1999
optionally return path in keyword OUTPUT. Added QUIET keyword.
allow extentions other than .pro
allow uppercase finds.
Written, DMS, Sept, 1982.
Added library param, Jul 1987.
Unix version, DMS, Feb, 1988.
New VMS version, DMS, Dec. 1989
Wrapper procedure to call the correct version
under Unix and VMS, AB, Jan 1990
Added support for DOS, SNG, Dec, 1990
Added support for Macintosh, DJE, Nov, 1994
Source: src/idl_cvs/whichcomputer.pro
NAME:
whichComputer
PURPOSE:
Return name of Linux computer you are running on.
First uses enironmental variable HOST, then uname -n
CATEGORY:
System
CALLING SEQUENCE:
IDL> computerName = whichComputer( )
INPUTS:
none required
KEYWORD PARAMETERS:
var - Environmental variable to check for computer name.
(defaults to 'HOST'). If HOST not defined, will still work on Linux
debug - if set, debug output will be printed
OUTPUTS:
computerName - name of computer (best not to have domain included)
EXAMPLE:
NOTES:
MODIFICATION HISTORY:
07-Apr-2010 Written by Bill Davis, PPPL
Source: src/idl_cvs/whiteout.pro
NAME:
whiteout
PURPOSE:
white-out a portion of the color table
-- defaults to the 5 lowest locs.
CATEGORY:
Colors, Graphics
CALLING SEQUENCE:
IDL> whiteout
INPUTS:
NONE
KEYWORD PARAMETERS:
Optional Keywords:
loc - index within color table to start whiting out (Default=0)
nlocs - number of locations to whiteout (Default=5
OUTPUTS:
NONE (color table changed)
LIMITATIONS:
Reloading color table will undo this.
MODIFICATION HISTORY:
May-2006 Written by Bill Davis, PPPL
Source: src/idl_cvs/widget_bottom.pro
NAME:
WIDGET_BOTTOM
PURPOSE:
Move a widget to the bottom of the screen or base widget.
CATEGORY:
Widgets.
CALLING SEQUENCE:
WIDGET_BOTTOM, ID
INPUTS:
ID ID of the widget to be centered.
KEYWORD PARAMETERS:
PARENT ID of an existing widget over which the input widget
should be centered.
OUTPUTS:
None.
EXAMPLE:
base = widget_base()
label = widget_label(base, value='Hello world')
WIDGET_BOTTOM, base
widget_control, base, /realize
MODIFICATION HISTORY:
Created by Bill Davis 14-Apr-06. Added yborder and xborder.
Based on WIDGET_BOTTOM Written by: Liam.Gum...@ssec.wisc.edu
Source: src/idl_cvs/withrankof.pro
NAME:
WithRankOf
PURPOSE:
Return a list of MDSplus signals with a certain rank
(that contain data)
CATEGORY:
MDSplus
CALLING SEQUENCE:
sigs=withrankof( rank )
INPUTS:
rank - integer rank of signal desired
KEYWORD PARAMETERS:
filter - wildcard specification to find signal names with desired rank
signalnames - if present, use these, and ignore filter
OUTPUTS:
sigs - MDSplus signal names with
EXAMPLE:
IDL> stat=mdsopen('passivespec',101964)
IDL> scalarNames = withrankof(0)
COMMON BLOCKS:
none
NOTES:
Only returns signals with data in them.
LIMITATIONS:
An MDSplus shot file must be open first.
MODIFICATION HISTORY:
31-Jan-07 add keyword to pass in signalnames
20-Jan-00 Written by Bill Davis
Source: src/idl_cvs/wordarray.pro
NAME:
WORDARRAY
PURPOSE:
Convert text string or string array to a 1-d array of words.
CATEGORY:
Strings
CALLING SEQUENCE:
wordarray, instring, outlist
INPUTS:
instring = string or string array to process. in
KEYWORD PARAMETERS:
Keywords:
IGNORE=string of characters to ignore (array allowed).
These characters are removed before processing.
Ex: wordarray,in,out,ignore=',;()'
wordarray,in,out,ignore=[',',';','(',')']
DELIMITERS = word delimiter characters, like IGNORE.
/WHITE means include white space (spaces,tabs) along
with the specified delimiters.
OUTPUTS:
outlist = 1-d array of words in instring. out
COMMON BLOCKS:
NOTES:
Words are assumed delimited by given delimiters
(defaults are spaces and/or tabs)
Non-delimiters are returned as part of the words.
Delimiters not needed at the front and end of the strings.
See commalist for a near inverse.
MODIFICATION HISTORY:
R. Sterner, 29 Nov, 1989
BLG --- Modified June 22,1991 to include tabs as delimiters
R. Sterner, 11 Dec, 1992 --- fixed to handle pure white space.
R. Sterner, 27 Jan, 1993 --- dropped reference to array.
R. Sterner, 1998 Apr 1 --- Added DELIMITER. Modified IGNORE.
Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
Source: src/idl_cvs/writecamavg.pro
NAME:
writecamavg
PURPOSE:
For camera files that exist for a particular shot, check for
\CAMERAS::TOP.FC_n.RAWDATA:FRAMES_MAX and \CAMERAS::TOP.FC_n.RAWDATA:FRAMES_AVG
(tags \PH7_n_FMAX and \PH7_n_FAVG) and write them if need be.
CALLING SEQUENCE:
IDL> writecamavg, camera, year=year, shot1=shot1, shot2=shot2
INPUTS:
camera = integer from 1-7
KEYWORDS:
year - if shot1 and shot2 not entered, use this. (Defaults to current year)
shot1
shot2
tree - defaults to 'cameras'
checkDir - if set, will work from a list of the expected directory, rather
than calling FindCamFiles for every file (recommended)
writeMax - if not = 0, will try write max intensity vs. time waveforms
writeAve - if not = 0, will try write ave intensity vs. time waveforms
force - if=1, will write maxInt and aveInt, even if they are in the tree
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
EXAMPLE:
IDL> writeCamAvg, 2, year=2010, /checkDir, /debug
; rewrite max for some shots:
IDL> writeCamAvg, 7, shot1=139025, shot2=140569, /force, writeAve=0, /checkDir, /debug
IDL> writeCamAvg, 2, shot1=140528, shot2=140569, /checkDir, /verb
MODIFICATION HISTORY:
---------------------
27-Jul-2011 option to just use a file_search of conventional directory when checking
for files (keyword CheckDir)
25-Jul-2011 Written by Bill Davis
Source: src/idl_cvs/writelog.pro
NAME:
writeLog
PURPOSE:
Provide a writeLog for IDL routines to be used by others
CATEGORY:
Utility
CALLING SEQUENCE:
IDL> writeLog, logfile, msg, logWindowID=logWindowID
INPUTS:
logfile - logfile for output (DEFAULT='logfile.txt')
msg - string to put in log
KEYWORD PARAMETERS:
time - if set then add time stamp to the output message
nLines - lines for each message (def=1, meaning no blank lines)
verbose - if set, will echo message to screen with print command
OUTPUTS:
none
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> writeLog, 'mylogfile.txt', 'All is well', /time, /verbose
NOTES:
used in some auto-restart programs for nstxops
MODIFICATION HISTORY:
20-Mar-2007 print blank lines when /verbose. Write every line
of msg on separate line
14-Aug-2006 just return if log file not writable
07-Dec-2005 added nLines keyword
Oct-2005 Written by Bill Davis, PPPL
Source: src/idl_cvs/write_generic.pro
NAME:
write_generic
PURPOSE:
write an image to the appropriate type of file, based on
file extension
CATEGORY:
Files, Graphics
CALLING SEQUENCE:
IDL> write_generic, filename, data2D [, R,G,B]
INPUTS:
filename - file name to read in
can be type 'jpg','tif','tif','bmp','jpeg,'png', 'ppm', 'pgm', or 'gif'
KEYWORD PARAMETERS:
Optional inputs:
extension - the file extension, eg., 'jpg'
quality - jpeg quality [0-100, default is 75]
order - JPEG/JFIF images are normally written in top-to-bottom order.
If the image array is in the standard IDL order (i.e., from
bottom-to-top) set ORDER to 0, its default value. If the image
array is in top-to-bottom order, ORDER must be set to 1.
OUTPUTS:
2-D data array from file out
COMMON BLOCKS:
NONE
MODIFICATION HISTORY:
25-Feb-2009 added RGB keyword
18-Oct-2007 added quality keyword
25-Apr-2007 added colortable keyword (not used!?!)
21-Feb-2007 added ppm file type
19-Apr-2006 replaced keywords with args R,G,B
15-Oct-2004 Written by Bill Davis, PPPL
Source: src/idl_cvs/write_in_box.pro
NAME:
WRITE_IN_BOX
PURPOSE:
Writes a text message within a box in a graphics window.
CATEGORY:
Graphics
Explanation : This procedure writes a short text message within a box-shaped
area in a graphics window. The message may be split at word
boundaries into several lines, and the character size and
orientation may be adjusted for the text to fit within the box.
CALLING SEQUENCE:
IDL> WRITE_IN_BOX, X1, X2, Y1, Y2, TEXT
Inputs : X1, X2 = X coordinates of the box limits.
Y1, Y2 = Y coordinates of the box limits.
TEXT = ASCII text string containing the message.
Opt. Inputs : None.
Outputs : None.
Opt. Outputs: None.
Keywords : DATA = If set, then the coordinates are in data units.
This is the default.
DEVICE = If set, then the coordinates are in device units.
NORMAL = If set, then the coordinates are in normalized
units.
MAXCHARSIZE = The maximum character size to use in displaying
the message. If not passed, then determined from
!P.CHARSIZE.
COLOR = Color to use to display the text. The default is
!COLOR.
ALIGNMENT = Controls the alignment of the text in the box. A
value of 0 means to left justify the text, 0.5
means center it (default), and 1 stands for right
justification.
Calls : None.
Common : None.
Restrictions: X2 must be greater than X1, and Y2 must be greater than Y1.
Side effects: The appearance of the displayed message may not be optimal if
any words are separated by multiple blanks, or by tab
characters.
Category : Planning, Science.
Prev. Hist. : None.
Written : William Thompson, GSFC, 7 July 1993.
Modified : Version 1, William Thompson, GSFC, 7 July 1993.
Version 2, William Thompson, GSFC, 24 September 1993.
Added ALIGNMENT keyword based on code provided by Jim
Pendleton, GRO/OSSE NU.
Version 3, William Thompson, GSFC, 21 September 1994
Added STRTRIM call.
Version : Version 3, 21 September 1994
Source: src/idl_cvs/write_mpeg.pro
+
NAME:
WRITE_MPEG
PURPOSE:
Write a sequence of images as an mpeg movie
CATEGORY:
animation
CALLING SEQUENCE:
WRITE_MPEG,'movie.mpg',ims
INPUTS:
ims: sequence of images as a 3D array with dimensions [sx, sy, nims]
where sx = xsize of images
sy = ysize of images
nims = number of images
OPTIONAL INPUTS:
KEYWORD PARAMETERS:
delaft: if set delete temporary array after movie was created
you should actually always do it otherwise you get
problems with permissions on multiuser machines (since
/tmp normally has the sticky bit set)
rep: if given means repeat every image 'rep' times
(as a workaround to modify replay speed)
OUTPUTS: None
OPTIONAL OUTPUTS:
COMMON BLOCKS:
SIDE EFFECTS:
creates some files in TMPDIR which are only removed when
the DELAFT keyword is used
RESTRICTIONS:
depends on the program mpeg_encode from University of
California, Berkeley, which must be installed in /usr/local/bin
PROCEDURE:
writes a parameter file based on the dimensions of the image
array + the sequence of images in ppm format into a
temporary directory; finally spawns mpeg_encode to build the
movie
EXAMPLE:
IDL> s=openmdsshot('efit',112800)
IDL> data3d=mdsvalue('\efit01::psirz')
IDL> write_mpeg, 'efit_112800.mpg', bytscl(congrid(data3d,65*8,65*8,128))
or
IDL>write_mpeg,'test.mpg',reform([[dist(100)],[dist(100)],[dist(100)]],100,100,3)
MODIFICATION HISTORY:
15-Jul-04 warn if file not 3d [BD]
Mon Nov 18 13:13:53 1996, Christian Soeller
grabbed original from the net and made slight modifications
Source: src/idl_cvs/write_text.pro
NAME:
write_text
PURPOSE:
Write data to a text file
CATEGORY:
files
CALLING SEQUENCE:
IDL> write_text, filename, data, data2, data3, data4, data5, data6
INPUTS:
filename - filename for output (DEFAULT='outfile.txt')
data - array of numbers
data2, data3, etc., are optional.
KEYWORD PARAMETERS:
header - text lines to put at the beginning of file
tabs - if set, columns will be delimited by a tab characater
verbose - if set, will echo message to screen with print command
OUTPUTS:
none
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> write_text, 'myfilename.txt', findgen(100)
to write two columns with 1 header line:
IDL> write_text, 'myfilename.txt', time, data, header='Hello World!'
NOTES:
MODIFICATION HISTORY:
24-Apr-2009 option to write up to 6 columns of data
12-Jun-2008 Written by Bill Davis, PPPL
Source: src/idl_cvs/xanimjpeg.pro
NAME:
XanimJpeg
PURPOSE:
animate jpegs (or other image files) in a VCR-like widget,
which can make an MPEG Movie.
CATEGORY:
Animation, MPEG, jpegs
KEYWORDS:
jpegDir - directory containing files to animate
ext - extension of files to animate (DEFAULT='jpg')
showTime - if set, try to show time on image
times - times of images in msec
increment - for file list, ie., to skip frames, set > 1
maxFrames - max # of frames to load (to many can cause an X-window problem)
prefix - prefix of files for search. Default='*'
byteScale - if set, will scale individual frames from 0-255
minVal - if this and byteScale set, will use this as minimum value
maxVal - if this and byteScale set, will use this as maximum value
ctb - color table to load (not sure makes a difference) DEFAULT=3
mag - magnification factor for images
EXAMPLE:
IDL> xanimjpeg, jpegDir='~bdavis/ShockWaveOutput/Output'
IDL> jpegDir='/p/gyro/wgutten/gyro-9.0wg/sim/NSTX_120968A02_560/nonlin/ra60/franklin_runs/x80y60_n8r200ob8v6/jpeg_files/'
IDL> xanimjpeg, jpegDir=jpegDir, prefix='frame06', maxframes=10
IDL> xanimjpeg, jpegDir='~bdavis/DustTracking/Data/130388/Cam2_NO'
NOTE:
this routine requires substantial "X memory" so, Exceed on a Mac,
may need more memory; an X-terminal may give a "toolkit error".
MODIFICATIONS:
13-Jul-2010 use XIA & other features
WRITTEN by Bill Davis
Source: src/idl_cvs/xaxisw.pro
NAME:
xAxisW
PURPOSE:
Widget to set some X Axis values via the system variable !X
CATEGORY:
Graphics, Widgets
CALLING SEQUENCE:
IDL> xAxisW
INPUTS:
input = whatever.
KEYWORD PARAMETERS:
Optional Keywords:
UPDATECALLBACK - a routine to call after axis system variable is set
GROUP_LEADER - This widget is destroyed if it's GL is destroyed
OUTPUTS:
The system variable !X is changed out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> xAxisW, UPDATECALLBACK='myAxisUpdating'
NOTES:
MODIFICATION HISTORY:
29-Apr-08 check for routine being compiled (vs. needing to be found)
added a "Refresh" button which, if a proper plotting routine
is provided, will replot with any changed settings.
08-Dec-04 Removed callback test because of compiling on PC
22-Jan-01 Added Default and Auto Scale buttons [BD]
20-Sep-00 Added TickLen & GridStyle fields [BD]
30-Mar-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/xcdedit.pro
NAME:
XcdEdit
PURPOSE:
A table editor modified from XVAREDIT for ppcc c.d file.
CATEGORY:
Widgets
CALLING SEQUENCE:
XcdEdit, filename
INPUTS:
filename = The file to be edited.
KEYWORD PARAMETERS:
NAME = The NAME of the variable. This keyword is overwritten with the
structure name if the variable is a structure.
GROUP = The widget ID of the widget that calls XcdEdit. When this
ID is specified, a death of the caller results in a death of
XcdEdit.
X_SCROLL_SIZE = The X_SCROLL_SIZE keyword allows you to set
the width of the scrolling viewport in columns.
Default is 4.
Y_SCROLL_SIZE = The Y_SCROLL_SIZE keyword allows you to set
the height of the scrolling viewport in rows.
Default is 4.
OUTPUTS:
VAR= The variable that has been edited, or the original when the user
Quits from the file menu.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Initiates the XManager if it is not already running.
RESTRICTIONS:
None known.
PROCEDURE:
Create and register the widget and then exit.
If the user selects "save", the values in the editor are written
to the file passed in, otherwise, they are ignored.
MODIFICATION HISTORY:
Written by: Steve Richards, February, 1991
Modified: September 96, LP - rewritten with TABLE widget
Converted from XcdEdit.pro by Bill Davis, Oct. 1998
07-Oct-98 BD Took out check for "commit" because it was always wrong.
Source: src/idl_cvs/xcolors.pro
NAME:
XCOLORS
PURPOSE:
The purpose of this routine is to interactively change color tables
in a manner similar to XLOADCT. No common blocks are used so
multiple copies of XCOLORS can be on the display at the same
time (if each has a different TITLE). XCOLORS has the ability
to notify a widget event handler, an object method, or an IDL
procedure if and when a new color table has been loaded. Brewer
color tables can also be accessed from this program, if the file
fsc_brewer.tbl can be found somewhere in your IDL path.
AUTHOR:
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
CATEGORY:
Widgets, Object, Command line.
CALLING SEQUENCE:
XCOLORS
INPUTS:
None.
KEYWORD PARAMETERS:
BLOCK: If this keyword is set, the program will try to block the
IDL command line. Note that this is only possible if no other
widget program is currently blocking the IDL command line. It
is much more reliable to make XCOLORS a modal widget (see the MODAL
keyword), although this can generally only be done when XCOLORS
is called from another widget program.
BREWER: Set this keyword if you wish to use the Brewer Colors, as explained
in this reference: http://www.dfanning.com/color_tips/brewer.html. The
Brewer color table file, fsc_brewer.tbl must be found somewhere in your
IDL path for this option to be available. The file can be downloaded here.
http://www.dfanning.com/programs/fsc_brewer.tbl
Note that if this file is found, the Brewer colors are automatically added
to the program as an option. In this case, the BREWER keyword just makes sure
this is the initial user choice.
BOTTOM: The lowest color index of the colors to be changed.
COLORINFO: This output keyword will return either a pointer to
a color information structure (if the program is called in
a non-modal fashion) or a color information structure (if the program
is called in modal or blocking fashion). The color information
structure is an anonymous structure defined like this:
struct = { R: BytArr(!D.Table_Size), $ ; The current R color vector.
G: BytArr(!D.Table_Size), $ ; The current G color vector.
B: BytArr(!D.Table_Size), $ ; The current B color vector.
NAME: "", $ ; The name of the current color table.
INDEX: 0, $ ; The index number of the current color table.
TYPE: "", $ ; The type of color table (e.g, BREWER or IDL).
REVERSED: 0B } ; Set to 1 if the color table is reversed.
If a pointer to the structure is obtained, you will be responsible
for freeing it to prevent memory leakage:
XColors, ColorInfo=colorInfoPtr
Print, "Color Table Name: ", (*colorInfoPtr).Name
Ptr_Free, colorInfoPtr
Note that that Name field will be "Unknown" and the Index field will
be -1 until a color table is actually selected by the user. You are
responsible for checking this value before you use it.
When called in modal or blocking fashion, you don't have to worry about freeing
the pointer, since no pointer is involved:
XColors, /Block, ColorInfo=colorInfoData
Help, colorInfoData, /Structure
Print, "Color Table Name: ", colorInfoData.Name
DATA: This keyword can be set to any valid IDL variable. If
the variable is defined, the specified object method or notify
procedure will be passed this variable via a DATA keyword. This
keyword is defined primarily so that Notify Procedures are compatible
with the XLOADCT way of passing data. It is not strictly required,
since the _EXTRA keyword inheritance mechanism will allow passing
of *any* keyword parameter defined for the object or procedure that is
to be notified.
DRAG: Set this keyword if you want colors loaded as you drag
the sliders. Default is to update colors only when you release
the sliders. Use of this keyword is greatly discouraged.
_EXTRA: This keyword inheritance mechanism will pick up and
pass along to any method or procedure to be notified and keywords
that are defined for that procedure. Note that you should be sure
that keywords are spelled correctly. Any mis-spelled keyword will
be ignored.
FILE: A string variable pointing to a file that holds the
color tables to load. The normal colors1.tbl file is used by default.
GROUP_LEADER: The group leader for this program. When the group
leader is destroyed, this program will be destroyed.
INDEX: The index of the color table to start up. If provided, a color
table of this index number is loaded prior to display. Otherwise,
the current color table is used. Set this keyword if you wish
to have the index number of the event structure correct when
the user CANCELs out of the progam.
MODAL: Set this keyword (along with the GROUP_LEADER keyword) to
make the XCOLORS dialog a modal widget dialog. Note that NO
other events can occur until the XCOLORS program is destroyed
when in modal mode.
NCOLORS: This is the number of colors to load when a color table
is selected.
NOSLIDERS: If this keyword is set, the color stretch and color gamma
sliders are not displayed. This would be appropriate, for example,
for programs that just load pre-defined color tables.
NOTIFYID: A 2-column by n-row array that contains the IDs of widgets
that should be notified when XCOLORS loads a color table. The first
column of the array is the widgets that should be notified. The
second column contains IDs of widgets that are at the top of the
hierarchy in which the corresponding widgets in the first column
are located. (The purpose of the top widget IDs is to make it
possible for the widget in the first column to get the "info"
structure of the widget program.) An XCOLORS_LOAD event will be
sent to the widget identified in the first column. The event
structure is defined like this:
event = {XCOLORS_LOAD, ID:0L, TOP:0L, HANDLER:0L, $
R:BytArr(!D.TABLE_SIZE < 256), G:BytArr(!D.TABLE_SIZE < 256), $
B:BytArr(!D.TABLE_SIZE < 256), INDEX:0, NAME:""}
The ID field will be filled out with NOTIFYID[0, n] and the TOP
field will be filled out with NOTIFYID[1, n]. The R, G, and B
fields will have the current color table vectors, obtained by
exectuing the command TVLCT, r, g, b, /Get. The INDEX field will
have the index number of the just-loaded color table. The name
field will have the name of the currently loaded color table.
Note that XCOLORS can't initially tell *which* color table is
loaded, since it just uses whatever colors are available when it
is called. Thus, it stores a -1 in the INDEX field to indicate
this "default" value. Programs that rely on the INDEX field of
the event structure should normally do nothing if the value is
set to -1. This value is also set to -1 if the user hits the
CANCEL button. (Note the NAME field will initially be "Unknown").
Typically the XCOLORS button will be defined like this:
xcolorsID = Widget_Button(parentID, Value='Load New Color Table...', $
Event_Pro='Program_Change_Colors_Event')
The event handler will be written something like this:
PRO Program_Change_Colors_Event, event
; Handles color table loading events. Allows colors be to changed.
Widget_Control, event.top, Get_UValue=info, /No_Copy
thisEvent = Tag_Names(event, /Structure_Name)
CASE thisEvent OF
'WIDGET_BUTTON': BEGIN
; Color table tool.
XColors, NColors=info.ncolors, Bottom=info.bottom, $
Group_Leader=event.top, NotifyID=[event.id, event.top]
ENDCASE
'XCOLORS_LOAD': BEGIN
; Update the display for 24-bit displays.
Device, Get_Visual_Depth=thisDepth
IF thisDepth GT 8 THEN BEGIN
WSet, info.wid
...Whatever display commands are required go here. For example...
TV, info.image
ENDIF
ENDCASE
ENDCASE
Widget_Control, event.top, Set_UValue=info, /No_Copy
END
NOTIFYOBJ: A vector of structures (or a single structure), with
each element of the vector defined as follows:
struct = {XCOLORS_NOTIFYOBJ, object:Obj_New(), method:''}
where the Object field is an object reference, and the Method field
is the name of the object method that should be called when XCOLORS
loads its color tables.
ainfo = {XCOLORS_NOTIFYOBJ, a, 'Draw'}
binfo = {XCOLORS_NOTIFYOBJ, b, 'Display'}
XColors, NotifyObj=[ainfo, binfo]
Note that the XColors program must be compiled before these structures
are used. Alternatively, you can put this program, named
"xcolors_notifyobj__define.pro" (*three* underscore characters in this
name!) in your PATH:
PRO XCOLORS_NOTIFYOBJ__DEFINE
struct = {XCOLORS_NOTIFYOBJ, OBJECT:Obj_New(), METHOD:''}
END
Or, you can simply define this structure as it is shown here in your code.
"Extra" keywords added to the XCOLORS call are passed along to
the object method, which makes this an alternative way to get information
to your methods. If you expect such keywords, your methods should be defined
with an _Extra keyword.
If you set the /OBJECT_DATA keyword, write your XColors notification
routine with an XCOLORS_INFO keyword. This will return the same
structure defined for the COLORINFO keyword above to your object method.
NOTIFYPRO: The name of a procedure to notify or call when the color
tables are loaded. If the DATA keyword is also defined, it will
be passed to this program via an DATA keyword. But note that *any*
keyword appropriate for the procedure can be used in the call to
XCOLORS. For example, here is a procedure that re-displays and image
in the current graphics window:
PRO REFRESH_IMAGE, Image=image, _Extra=extra, WID=wid
IF N_Elements(wid) NE 0 THEN WSet, wid
TVIMAGE, image, _Extra=extra
END
This program can be invoked with this series of commands:
IDL> Window, /Free
IDL> TVImage, image, Position=[0.2, 0.2, 0.8, 0.8]
IDL> XColors, NotifyPro='Refresh_Image', Image=image, WID=!D.Window
Note that "extra" keywords added to the XCOLORS call are passed along to
your procedure, which makes this an alternative way to get information
to your procedure. If you expect such keywords, your procedure should
be defined with an _Extra keyword as illustrated above.
OBJECT_DATA: Set this keyword if you wish color information to be
supplied to your object notification method via an XCOLORS_DATA
keyword. This keyword is ignored unless the NOTIFYOBJ keyword is
also used. The color information is supplied as a structure and is
defined in the COLORINFO keyword definition above.
REVERSE: If this keyword is set, the color table is reversed and the
Reverse Color Table button is set on.
TITLE: This is the window title. It is "Load Color Tables" by
default. The program is registered with the name 'XCOLORS:' plus
the TITLE string. The "register name" is checked before the widgets
are defined. If a program with that name has already been registered
you cannot register another with that name. This means that you can
have several versions of XCOLORS open simultaneously as long as each
has a unique title or name. For example, like this:
IDL> XColors, NColors=100, Bottom=0, Title='First 100 Colors'
IDL> XColors, NColors=100, Bottom=100, Title='Second 100 Colors'
XOFFSET: This is the X offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
YOFFSET: This is the Y offset of the program on the display. The
program will be placed approximately in the middle of the display
by default.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Colors are changed. Events are sent to widgets if the NOTIFYID
keyword is used. Object methods are called if the NOTIFYOBJ keyword
is used. This program is a non-blocking widget.
RESTRICTIONS:
None.
EXAMPLE:
To load a color table into 100 colors, starting at color index
50 and send an event to the widget identified at info.drawID
in the widget heirarchy of the top-level base event.top, type:
XCOLORS, NCOLORS=100, BOTTOM=50, NOTIFYID=[info.drawID, event.top]
MODIFICATION HISTORY:
Written by: David W. Fanning, 15 April 97. Extensive modification
of an older XCOLORS program with excellent suggestions for
improvement by Liam Gumley. Now works on 8-bit and 24-bit
systems. Subroutines renamed to avoid ambiguity. Cancel
button restores original color table.
23 April 1997, added color protection for the program. DWF
24 April 1997, fixed a window initialization bug. DWF
18 June 1997, fixed a bug with the color protection handler. DWF
18 June 1997, Turned tracking on for draw widget to fix a bug
in TLB Tracking Events for WindowsNT machines in IDL 5.0. DWF
20 Oct 1997, Changed GROUP keyword to GROUP_LEADER. DWF
19 Dec 1997, Fixed bug with TOP/BOTTOM reversals and CANCEL. DWF.
9 Jun 1998, Fixed bug when using BOTTOM keyword on 24-bit devices. DWF
9 Jun 1998, Added Device, Decomposed=0 for TrueColor visual classes. DWF
9 Jun 1998, Removed all IDL 4 compatibility.
21 Oct 1998, Fixed problem with gamma not being reset on CANCEL. DWF
5 Nov 1998. Added the NotifyObj keyword, so that XCOLORS would work
interactively with objects. DWF.
9 Nov 1998. Made slider reporting only at the end of the drag. If you
want continuous updating, set the DRAG keyword. DWF.
9 Nov 1998. Fixed problem with TOP and BOTTOM sliders not being reset
on CANCEL. DWF.
10 Nov 1998. Fixed fixes. Sigh... DWF.
5 Dec 1998. Added INDEX field to the XCOLORS_LOAD event structure. This
field holds the current color table index number. DWF.
5 Dec 1998. Modified the way the colorbar image was created. Results in
greatly improved display for low number of colors. DWF.
6 Dec 1998. Added the ability to notify an unlimited number of objects. DWF.
12 Dec 1998. Removed obsolete Just_Reg keyword and improved documetation. DWF.
30 Dec 1998. Fixed the way the color table index was working. DWF.
4 Jan 1999. Added slightly modified CONGRID program to fix floating divide
by zero problem. DWF
2 May 1999. Added code to work around a Macintosh bug in IDL through version
5.2 that tries to redraw the graphics window after a TVLCT command. DWF.
5 May 1999. Restore the current window index number after drawing graphics.
Not supported on Macs. DWF.
9 Jul 1999. Fixed a couple of bugs I introduced with the 5 May changes. Sigh... DWF.
13 Jul 1999. Scheesh! That May 5th change was a BAD idea! Fixed more bugs. DWF.
31 Jul 1999. Substituted !D.Table_Size for !D.N_Colors. DWF.
1 Sep 1999. Got rid of the May 5th fixes and replaced with something MUCH simpler. DWF.
14 Feb 2000. Removed the window index field from the object notify structure. DWF.
14 Feb 2000. Added NOTIFYPRO, DATA, and _EXTRA keywords. DWF.
20 Mar 2000. Added MODAL, BLOCK, and COLORINFO keywords. DWF
20 Mar 2000. Fixed a slight problem with color protection events triggering
notification events. DWF.
31 Mar 2000. Fixed a problem with pointer leakage on Cancel events, and improved
program documentation. DWF.
17 Aug 2000. Fixed a problem with CANCEL that occurred only if you first
changed the gamma settings before loading a color table. DWF.
10 Sep 2000. Removed the requirement that procedures and object methods must
be written with an _Extra keyword. DWF.
5 Oct 2000. Added the File keyword to LOADCT command, as I was suppose to. DWF.
5 Oct 2000. Now properly freeing program pointers upon early exit from program. DWF.
7 Mar 2001. Fixed a problem with the BLOCK keyword. DWF.
12 Nov 2001. Renamed Congrid to XColors_Congrid. DWF.
14 Aug 2002. Moved the calculation of NCOLORS to after the draw widget creation
to fix a problem with !D.TABLE_SIZE having a correct value when no windows had
been opened in the current IDL session. DWF.
14 Aug 2002. Fixed a documentation problem in the NOTIFYID keyword documentation
that still referred to !D.N_COLORS instead of the current !D.TABLE_SIZE. DWF.
27 Oct 2003. Added INDEX keyword. DWF.
29 July 2004. Fixed a problem with freeing colorInfoPtr if it didn't exist. DWF.
5 December 2005. Added NOSLIDERS keyword and performed some small cosmetic changes. DWF.
27 Sep 2006. Fixed a problem in which XCOLORS set device to indexed color mode. DWF.
14 May 2008. Added ability to read the Brewer Color Table file, if available. DWF
8 July 2008. Small change in how the program looks for the Brewer file. DWF.
1 October 2008. Added a button to switch from either BREWER color tables to IDL
color tables, depending upon which is showing currently. The button ONLY appears
if the file fsc_brewer.tbl can be found somewhere in the IDL distribution. DWF.
7 October 2008. Whoops! The 1 Oct change wasn't as simple as that. Fixed problems with
destroy and restarting the program with respect to keywords that are set, etc. DWF.
12 October 2008. Changed license to BSD Open Software License. DWF.
21 October 2008. Found a problem with MODAL operations that I fixed. However, that
led to problems with how I was switching from IDL to Brewer colors and visa versa,
so I changed that mechanism, too.
21 October 2008. Added OBJECT_DATA keyword so that I can get additional information
about the state of the color table tool into object methods. DWF.
12 April 2009. Add REVERSE keyword and Reverse Color Table button. DWF.
28 April 2009. In looking for a Brewer color table file, I replaced all FILE_WHICH
commands with FIND_RESOURCE_FILE commands. DWF.
Source: src/idl_cvs/xeasyanim.pro
NAME:
XeasyAnim
PURPOSE:
animate 3-D array and optionally make MPEG Movie
CATEGORY:
Animation, MPEG
KEYWORDS:
nreps - number of frames to repeat when creating mpeg (1 means no dups)
xSize -
ySize -
rate -
MAX_COLORS_TO_USE -
magnification -
xpos -
ypos -
colortable - color table for movie
ctbFile - color table file (for personal color tables)
noLoad - if set, do not load any color table
SCALEEACHFRAME -
bottom - if set, then position window at bottom of screen
despeckle -
XWIN -
YWIN -
STDEV_MULT
ctbfile - color table file (for personal color tables)
EXAMPLE:
IDL> Array3D_In = [DIST(200,200),DIST(200,200)*1.2,DIST(200,200)*1.4]
IDL> Array3D_In = bytscl(reform( Array3D_In, 200, 200, 3 ))
IDL> XEasyAnim, Array3D_In, /bottom
you may wish to the following:
IDL> dum=MK_COLOR(N_NONFIXED=ncolors)
IDL> Array3D = BYTSCL( Array3D, TOP=ncolors )
IDL> XEasyAnim, Array3D
Modifications:
12-May-2008 added noLoad and ctbFile keywords
02-Aug-2007 add gamma keyword [BD]
02-May-06 added nreps keyword
14-Apr-06 added xpos & ypos keywords
06-Mar-02 Added printing, resizing of array, added despeckling [BD]
Source: src/idl_cvs/xfont_4.pro
NAME:
XFONT_4
PURPOSE:
XFONT_4 is a modal widget for selecting and viewing an X Windows font.
CATEGORY:
Widgets, Fonts
CALLING SEQUENCE:
Selected_font = XFONT_4()
INPUTS:
No explicit inputs.
KEYWORD PARAMETERS:
GROUP: The widget ID of the widget that calls XFONT_4. When this
ID is specified, a death of the caller results in a death
of XFONT_4.
PRESERVE: If set, XFONT_4 saves the server font directory in common
blocks so that subsequent calls to XFONT_4 start-up much
faster. If not set, the common block is cleaned.
OUTPUTS:
A string containing the font name. If nothing is selected, or
the CANCEL button is pressed, a null string is returned.
COMMON BLOCKS:
XFONT_4_COM.
SIDE EFFECTS:
Initiates the XManager if it is not already running.
Resets the current X Window font.
RESTRICTIONS:
The current X window font is manipulated without being restored.
PROCEDURE:
Create and register the widget and then exit.
MODIFICATION HISTORY:
Modified from a template written by: Hans-Joachim Bothe, CreaSo GmbH,
November, 1991, by DMS, RSI, November, 1992.
1 July 1995, AB, Fixed sizing of toggle buttons.
Source: src/idl_cvs/xia.pro
NAME:
XIA
PURPOSE:
Display an animated sequence of images using X-windows Pixmaps.
The speed and direction of the display can be adjusted using
the widget interface.
CATEGORY:
Animation, Image display, widgets.
CALLING SEQUENCE:
To initialize:
XIA, SET = [Sizex, Sizey, Nframes]
To load a single image:
XIA, IMAGE = Image, FRAME = Frame_Index
To load a single image that is already displayed in an existing window:
XIA, FRAME = Frame_index, $
WINDOW = [Window_Number [, X0, Y0, Sx, Sy]]
(This technique is much faster than reading back from the window.)
To display the animation after all the images have been loaded:
XIA [, Rate]
To close and deallocate the pixmap/buffer (which also takes place
automatically when the user presses the "Done With Animation"
button or closes the window with the window manager):
XIA, /CLOSE
OPTIONAL INPUTS:
Rate: A value between 0 and 100 that represents the speed of the
animation as a percentage of the maximum display rate.
The fastest animation is with a value of 100 and the slowest
is with a value of 0. The default animation rate is 100.
The animation must be initialized using the SET
keyword before calling XIA with a rate value.
KEYWORD PARAMETERS:
BOTTOM: If set, window will be at bottom of screen or parent window
CLOSE: Set this keyword to delete the offscreen pixwins and Widget,
freeing storage.
CYCLE: If set, cycle. Normally, frames are displayed going either
forward or backwards. If CYCLE is set, reverse direction
after the last frame in either direction is displayed.
Provide this keyword with the SET keyword.
FRAME: The frame number when loading frames. This keyword only has
an effect when used in conjunction with the SET keyword.
FRAME must be set to a number in the range 0 to Nframes-1.
GROUP: The widget ID of the widget that calls XIA. When
this ID is specified, the death of the caller results in the
death of XIA.
IMAGE: A single image to be loaded at the animation position given
by FRAME. The keyword parameter FRAME must also be specified.
KEEP_PIXMAPS: If TRUE, XIA doesn't destroy the animation
pixmaps when it is killed. Calling it again without
going through the SET and LOAD steps will cause the same
animation to play without the overhead of creating
the pixmaps.
BLOCK: Set this keyword to have XMANAGER block when this
application is registered. By default the Xmanager
keyword NO_BLOCK is set to 1 to provide access to the
command line if active command line processing is available.
Note that setting BLOCK for this application will cause
all widget applications to block, not only this
application. For more information see the NO_BLOCK keyword
to XMANAGER.
ORDER: Set this keyword to display images from the top down instead
of the default bottom up. This keyword is only used when
loading images.
MODAL: If set, then XIA runs in "modal" mode, meaning that
all other widgets are blocked until the user quits
XIA.
MPEG_FILENAME: Set this keyword equal to a string for the desired
MPEG filename. If not set, idl.mpg is used.
MPEG_CLOSE: Set this keyword to write the MPEG file.
NREPS - number of frames to repeat when creating mpeg (1 means no dups)
SHOWLOAD: Set this keyword (in conjunction with the SET keyword) to
display each frame and update the frame slider as frames are
loaded.
SET: This keyword initializes XIA. SET should be equated
to a 3-element integer vector containing the following
parameters:
Sizex, Sizey: The width and height of the images to be
displayed, in pixels.
Nframes: The number of frames in the animated sequence
(since XIA is an animation routine,
Nframes must be at least 2 frames).
TITLE: A string to be used as the title of the widget. If this
keyword is not specified, the title is set to "XIA"
This keyword has an effect only when used in conjunction with
the SET keyword).
TRACK: If set, the frame slider tracks the current frame. Default
is not to track. Provide this keyword with the SET keyword.
WINDOW: When this keyword is specified, an image is copied from an
existing window to the animation pixmap. When using X
windows, this technique is much faster than reading
from the display and then calling XIA with a 2D
array.
The value of this parameter is either an IDL window
number (in which case the entire window is copied),
or a vector containing the window index and the rectangular
bounds of the area to be copied, for example:
WINDOW = [Window_Number, X0, Y0, Sx, Sy]
XOFFSET: The horizontal offset, in pixels from the left of the frame,
of the image in the destination window.
YOFFSET: The vertical offset, in pixels from the bottom of the frame,
of the image in the destination window.
OUTPUTS:
No explicit outputs.
COMMON BLOCKS:
XIA_COM: a private common block.
SIDE EFFECTS:
A pixmap and widget are created.
RESTRICTIONS:
Only a single copy of XIA can run at a time.
PROCEDURE:
When initialized, this procedure creates an approximately square
pixmap or memory buffer, large enough to contain Nframes of
the requested size. Once the images are loaded, using the
IMAGE and FRAME keywords, they are displayed by copying the images
from the pixmap or buffer to the visible draw widget.
EXAMPLE:
Enter the following commands to open the file ABNORM.DAT (a series
of images of a human heart) and animate the images it contains using
XIA. For a more detailed example of using XIA,
see the example in the "Using IDL Widgets" chapter of "IDL Basics".
Read the images into the variable H by entering:
OPENR, 1, FILEPATH('abnorm.dat', SUBDIR = 'examples/data')
H = BYTARR(64, 64, 16)
READU, 1, H
CLOSE, 1
H = REBIN(H, 128, 128, 16)
XIA, SET=[128, 128, 16], /SHOWLOAD
FOR I=0,15 DO XIA, FRAME = I, IMAGE = H[*,*,I]
XIA
MODIFICATION HISTORY:
02-May-06 added nreps keyword
14-Apr-06 added xpos & ypos, bottom & right keywords
02-Aug-01 modified XInterAnimate to have printing [Bill Davis]
Source: src/idl_cvs/xpc.pro
NAME:
XPC
PURPOSE:
This function allows to interactively pick a plot file.
It will be plotted in a separate gv window.
CATEGORY:
Widgets.
CALLING SEQUENCE:
XPC
KEYWORD PARAMETERS:
scratchDir - defaults to /u/$USER/tmpdir (or value of $TMPDIR)
programs running on different computers will have differnt
areas. This must be the same used by the plotting-control
software, setup_xpc.pro.
NODELETE - if set, files in sractchDir (from previous invocation) are
not deleted when application is started.
TITLE: A scalar string to be used for the window title.
GROUP: The widget ID of the widget that calls xpc. When this
ID is specified, a death of the caller results in the death of
the xpc widget application.
NFILES - # of files to show at one time in window (def=10)
filter - search filter for plots to show in window (def=XPC_*.ps)
psPlotFile - file with plotting application keeps plotting
(def=scratchDir+'/GV2plot.ps')
psApp - file plotting application (def="gv")
appSwitch - switch for file plotting application (def="--watch")
updateTime - time in seconds between checks to see if list needs refreshed (def=0.5)
ext - file extensions to look for (def='ps')
OUTPUTS:
Copies selected file to /GV2plot.ps, which "gv --watch" is
looking for to plot.
OPTIONAL ENVIRONMENTAL VARIABLES:
USER - username.
TMPDIR - default to '$USER/.XPC'
XPC_SCRATCH - directory for postscript files; defaults to $TMPDIR/XPC_scratch/
XPC_SCRATCH_NFILES - if not found, defaults to 10 files (these are postscript
filesand are not deleted when the program exits)
PROCEDURE:
a program that plots like:
IDL> setup_xpc
IDL> plot, indgen(111)
IDL> ...
IDL> unsetup_xpc ; graphics won't show up until this is called
setup_xpc will startup XPC, if not running, which will, in turn, startup gv
if it is not running on the same computer. Unfortunately, it is not easy to tell
if XPC is running on the same computer in another IDL process.
the postscript file written to in the above example is GV2buffer.ps (by
default). When XPC sees one of these, it copies it to GV2plot.ps, so gv
automatically replots it, and renames it to XPC_nnn.ps, where nnn is one
more than the highest number of the files XPC_*.ps.
NOTES:
You probably want the following line in your ~/.Xresources file to get the gv
program to refresh ever 1/2 second (default is every 1 second):
gv.watchFileFrequency: 501
this will make gv check for file changes ever 501 ms, rather than 1000 ms.
The Help display will tell you how to get color buttons in this widget.
RESTRICTIONS:
xpc only works on Linux/Unix systems where gv is in the PATH.
Only one copy per user can be running on a computer, since it uses
/local/$USER/tmpdir for the scratch files (though this can be be overridden
by setting the ENVIRONMENTAL variable XPC_SCRATCH).
MODIFICATION HISTORY:
20-Aug-2013 exclude searches for gv that include libexec
09-Jul-2011 don't use /local, so can be used from different computers
18-Nov-2009 Written by Bill Davis for Eric Fredrickson
Source: src/idl_cvs/xsectionw.pro
NAME:
xsectionw
PURPOSE:
Widget to display an image and x-y plots of cross-sections.
Color palettes may be loaded, adjusted and saved.
Images can be saved as 'jpg','tif','tif','bmp','jpeg,'png', 'ppm',
'pgm', or 'gif'
CATEGORY:
Image Processing, 2-D Plotting, Files, Graphics
CALLING SEQUENCE:
IDL> xsectionw[[, image], x, y]
INPUTS:
image - a 2D array. If missing, and Keyword Filename not
specified, a dialog box will appear allowing browsing
for a TIFF image.
x & y are optional inputs for x & y axes. Must be same dimension as image.
KEYWORD PARAMETERS:
(optional)
filename - file to read (can be type 'jpg','tif','tif','bmp',
'jpeg,'png','ppm', 'pgm', or 'gif')
xvals - optional values for X axis
yvals - optional values for Y axis
title - title to display at top of plot (Defaults to filename, if relevant)
xsize - horizontal size of window (default is 0.75 of screen, but > 800)
ysize - vertical size of window
xoffset - initial horizontal offset of the widget (DEFAULT=0)
yoffset - initial vertical offset of the widget (DEFAULT=30)
INTERP - if magnification set, INTERP=1 will cause interpolation,
rather than pixel replication.
max_colors - # used by display (Default is 256)
NOLOAD - if set, do not load color table
colorTable - color table to use. Default is 03 (Hot Metal)
NoCont - if set, no contours are drawn (default)
file - color table file (for personal color tables)
(other keywords to th_image_cont.pro may be included)
GROUP_LEADER - Group_Leader ID
OUTPUTS:
none.
COMMON BLOCKS:
none
ROUTINES USED:
MK_COLOR, usingXwindows, NWORDS, FLIP
EXAMPLE:
IDL> xsectionw, dist(200,200)
For serious testing of zooming, etc.:
IDL> x=findgen(120)/120
IDL> y=findgen(50)*!PI
IDL> d=sin(x*6+1)#cos(y/20+2)
IDL> d[20:30,*]=-2
IDL> d[*,35:40]=.5
IDL> d=d*1000
IDL> d=d-min(d)
IDL> th_image_cont,d,x,y
IDL> xsectionw,d,x,y
NOTES:
If you specify max_colors to be something other than 256, and
want to change color tables, you need to do something like:
IDL> dum=MK_COLOR( table=3 )
Using XLOADCT, etc. won't work well, since it loads 256 colors.
MODIFICATION HISTORY:
23-Sep-2013 increase left margin when y-axis has exponents. Added
/drag to xcolors call, so colors updated when drag slider
22-Oct-2010 Fixed a couple of bugs opening new images
05-Jan-2010 Default to just red component for true color images, but COMPONENT
keyword added to override this.
18-Aug-2009 fixed bug in zooming
24-Jun-2009 added xrange, yrange, and zrange keywords
30-Sep-2008 just use channel 0 of 24-bit images
14-Jul-2008 Handle 24-bit color images (poorly, but doesn't bomb)
25-Apr-07 Added more modify color table options, and option to save color table.
Support more kinds of image files. Can set background color from menu.
Can save image or window to files. Added Median Smoothing opt
25-May-06 added noload keyword
02-May-06 fixed x-y plot axis limits when zoomed in
12-Apr-06 added x & y keywords, and made to work with resizing and drawing box
03-Feb-03 Option to force lines to black or white
11-Dec-01 Written by Bill Davis, PPPL
Source: src/idl_cvs/xvaredit.pro
NAME:
XVAREDIT
PURPOSE:
This routine provides an editor for any IDL variable.
CATEGORY:
Widgets
CALLING SEQUENCE:
XVAREDIT, VAR
INPUTS:
VAR = The variable that is to be edited.
KEYWORD PARAMETERS:
NAME = The NAME of the variable. This keyword is overwritten with the
structure name if the variable is a structure.
GROUP = The widget ID of the widget that calls XVarEdit. When this
ID is specified, a death of the caller results in a death of
XVarEdit.
X_SCROLL_SIZE = The X_SCROLL_SIZE keyword allows you to set
the width of the scrolling viewport in columns.
Default is 4.
Y_SCROLL_SIZE = The Y_SCROLL_SIZE keyword allows you to set
the height of the scrolling viewport in rows.
Default is 4.
OUTPUTS:
VAR= The variable that has been edited, or the original when the user
selects the "Cancel" button in the editor.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Initiates the XManager if it is not already running.
RESTRICTIONS:
None known.
PROCEDURE:
Create and register the widget and then exit.
If the user selects "accept", the values in the editor are written
to the variable passed in, otherwise, they are ignored.
MODIFICATION HISTORY:
Written by: Steve Richards, February, 1991
Modified: September 96, LP - rewritten with TABLE widget
07-Oct-98 BD Took out check for "commit" because it was always
wrong.
Source: src/idl_cvs/xy2rmrsep.pro
NAME:
XY2RmRsep
PURPOSE:
transform pixel locations (say, from a Fast 2-D Camera image)
to distance from the Separatrix and distance along field line
parallel to flux lines
CATEGORY:
Plasma Analysis
CALLING SEQUENCE:
IDL> XY2RmRsep, shot, time, RmRsep, DistAlong
INPUTS:
shot = NSTX or CMOD shot number
time = time in seconds after shot for which values are desired
KEYWORD PARAMETERS:
Inputs:
fit - EFIT/LRDFIT indication, e.g., EFIT02
timeOffset - time to add to input time to be consistant with EFIT time
show - if set, plot, separatrix, and distance values
nx = # of pixels in X direction (default=64)
ny = # of pixels in Y direction (default=64 if shot # for CMOD, else 80)
cm - if set, distances will be in centimeters, rather than pixels
verbose - if set, will print many informational messages
debug - if set, debug output will be printed
Outputs:
status - if odd, then success
OUTPUTS:
RmRsep - distance from the Separatrix in pixels
DistAlong - distance along field line from lower left, in pixels
EXAMPLE:
IDL> time = .2 ; in seconds
IDL> shot = 1100824017
IDL> shot = 138234
IDL> XY2RmRsep, shot, time, RmRsep, DistAlong
MODIFICATION HISTORY:
WRITTEN 21-Jun-2012 by Bill Davis, PPPL, for Stewart Zweben
Source: src/idl_cvs/xyanim.pro
NAME:
xyanim
PURPOSE:
Animate a series of X-Y plots.
Makes an animation in a XINTERANIMATE window. An MPEG file
can then be saved, or the movie can be played with VCR-like
controls
CATEGORY:
Animation
CALLING SEQUENCE:
IDL> xyanim, Radii, YvsT, times, xSize=xSize, ySize=ySize
INPUTS:
Radii - 1-D array of Radii (for example)
YvsT - 2-D array of Independent axis vs. time
times - times for which an x-y plot will be made (defaults to 1/frame)
KEYWORD PARAMETERS:
Keywords:
xSize - x size of resulting output frame (default=400)
ySize - y size of resulting output frame (default=xSize)
OUTPUTS:
just the XinterAnimate window. MPEGs can be made from that widget.
COMMON BLOCKS:
NONE
EXAMPLE:
See /u/bdavis/cvs/idl_cvs/testxyanim.pro
MODIFICATION HISTORY:
12-Jun-01 Written by Bill Davis, PPPL
Source: src/idl_cvs/x_complain.pro
NAME: X_COMPLAIN
PURPOSE: Pops up a one line complaint.
CATEGORY:
MDS-Widgets
CALLING SEQUENCE:
X_COMPLAIN,message
INPUTS:
message - text to display
COMMON BLOCKS:
None.
SIDE EFFECTS:
PROCEDURE:
MODIFICATION HISTORY:
Source: src/idl_cvs/yaxisw.pro
NAME:
yAxisW
PURPOSE:
Widget to set some Y Axis values via the system variable !Y
CATEGORY:
Graphics, Widgets
CALLING SEQUENCE:
IDL> yAxisW
INPUTS:
input = whatever.
KEYWORD PARAMETERS:
Optional Keywords:
UPDATECALLBACK - a routine to call after axis system variable is set
GROUP_LEADER - This widget is destroyed if it's GL is destroyed
OUTPUTS:
The system variable !Y is changed out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> yAxisW, UPDATECALLBACK='myAxisUpdating'
NOTES:
If an application overrides !Y.* parameters, or specifies them on
the plot command, changing settings with this widget will have no
affect.
MODIFICATION HISTORY:
29-Apr-08 check for routine being compiled (vs. needing to be found)
added a "Refresh" button which, if a proper plotting routine
is provided, will replot with any changed settings.
08-Dec-04 Removed callback test because of compiling on PC
22-Jan-01 Added Default and Auto Scale buttons [BD]
28-Sep-00 Correct the display of initial values [BD]
20-Sep-00 Added TickLen & GridStyle fields [BD]
30-Mar-99 Written by Bill Davis, PPPL
Source: src/idl_cvs/ymd2date.pro
NAME:
YMD2DATE
PURPOSE:
Convert from year, month, day numbers to date string.
CATEGORY:
Dates
CALLING SEQUENCE:
date = ymd2date(Y,M,D)
INPUTS:
y = year number (like 1986). in
m = month number (1 - 12). in
d = day of month number (1 - 31). in
KEYWORD PARAMETERS:
Keywords:
FORMAT = format string. Allows output date to be customized.
The following substitutions take place in the format string:
Y$ = 4 digit year.
y$ = 2 digit year.
N$ = full month name.
n$ = 3 letter month name.
m$ = 2 digit month number.
d$ = day of month number.
0d$ = day of month number with leading 0 if < 10.
W$ = full weekday name.
w$ = 3 letter week day name.
dateStr - alternate input, like '20070931'
OUTPUTS:
date = returned date string (like 24-May-1986). out
COMMON BLOCKS:
NOTES:
Notes:
The default format string is 'd$-n$-Y$' giving 24-Sep-1989
Example: FORMAT='w$ N$ d$, Y$' would give 'Mon
MODIFICATION HISTORY:
19-Mar-2010 fixed bug for $m meaning minutes in called routines
17-Aug-2009 added $m option so can get dates like 17-8-2009.
28-NOV-2007 Added DateStr keyword [ Bill Davis, PPPL ]
...
RES 18 Sep, 1989 --- converted to SUN
R. Sterner. 16 Jul, 1986.
Johns Hopkins University Applied Physics Laboratory.
Copyright (C) 1986, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
Source: src/idl_cvs/ymd2jd.pro
NAME:
YMD2JD
PURPOSE:
From Year, Month, and Day compute Julian Day number.
CATEGORY:
Dates
CALLING SEQUENCE:
jd = ymd2jd(y,m,d)
INPUTS:
y = Year (like 1987). in
m = month (like 7 for July). in
d = month day (like 23). in
KEYWORD PARAMETERS:
OUTPUTS:
jd = Julian Day number (like 2447000). out
COMMON BLOCKS:
NOTES:
MODIFICATION HISTORY:
R. Sterner, 23 June, 1985 --- converted from FORTRAN.
Johns Hopkins University Applied Physics Laboratory.
RES 18 Sep, 1989 --- converted to SUN
Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.
Source: src/idl_cvs/yrmonthday.pro
NAME:
yrmonthday
PURPOSE:
Return a string of YYYYMMDD from a date string.
CATEGORY:
Dates
CALLING SEQUENCE:
IDL> dateNumberString = yrmonthday(dateString)
INPUTS:
dateString = date in one of these formats:
'7-jun-2001'
'Mon Jan 14 15:22:05 2002'
'08Aug2002'
'Jun 30 2005'
(defaults to today)
OUTPUTS:
dateNumberString = 8-character string of numbers:
YYYYMMDD
KEYWORDS
time - returns time like 08:41:55
year - year number as string
month - month number as string
day - day number as string
EXAMPLE:
IDL> print,yrmonthday()
20020114
IDL> print,yrmonthday('5-jun-2001')
20010605
NOTES:
MODIFICATION HISTORY:
19-Nov-2009 fixed bug returning month number
31-Mar-06 allow form of 'Jun 30 2005' or 'June 30, 2005'
16-Nov-04 added time keyword
15-Jan-02 Allow for 2-digit years
14-Jan-02 Written by Bill Davis, PPPL
15-Aug-02 Modified for UNIX date format by Stan Kaye
Source: src/idl_cvs/zaxisw.pro
NAME:
zAxisW
PURPOSE:
Widget to set some Z Axis values via the system variable !Y
CATEGORY:
Graphics, Widgets
CALLING SEQUENCE:
IDL> zAxisW
INPUTS:
input = whatever.
KEYWORD PARAMETERS:
Optional Keywords:
UPDATECALLBACK - a routine to call after axis system variable is set
GROUP_LEADER - This widget is destroyed if it's GL is destroyed
OUTPUTS:
The system variable !Y is changed out
COMMON BLOCKS:
NONE
EXAMPLE:
IDL> zAxisW, UPDATECALLBACK='mzAxisUpdating'
NOTES:
If an application overrides !Z.* parameters, or specifies them on
the plot command, changing settings with this widget will have no
affect.
MODIFICATION HISTORY:
17-Oct-00 Written by Bill Davis, PPPL