Revision History | |
---|---|
Revision 0.0 | 29 July 2005 |
First draft | |
Revision 0.1 | 29 August 2005 |
last Japanese version! | |
Revision 0.2 | May 2006 |
split with getsaxo | |
Revision 0.3 | April 2008 |
migration from DocBook 4.2 to Docbook 5.0 |
Table of Contents
In this document, we supposed that you followed Get SAXO recommendations.
Each IDL session using SAXO must always start with:
idl>
@init
The @ is equivalent to an include. It is used to execute a set of IDL commands that will be directly executed without any compilation (as it is the case for a procedure or a function). All variables defined and used in the @… file will still be accessible after the execution of the @… is finished (which is not the case for procedures and functions that ends with the return instruction).
$
cd
${HOME}/My_IDL/
$
idl
IDL Version 6.0, Mac OS X (darwin ppc m32). (c) 2003, Research Systems, Inc.
Installation number: 35411.
Licensed for personal use by Jean-Philippe BOULANGER only.
All other use is strictly prohibited.
idl>
@init
% Compiled module: KEEP_COMPATIBILITY.
% Compiled module: FIND.
% Compiled module: PATH_SEP.
% Compiled module: STRSPLIT.
% Compiled module: DEF_MYUNIQUETMPDIR.
We forget the compatibility with the old version
% Compiled module: DEMOMODE_COMPATIBILITY.
% Compiled module: ISADIRECTORY.
% Compiled module: LCT.
% Compiled module: RSTRPOS.
% Compiled module: REVERSE.
% Compiled module: STR_SEP.
% Compiled module: LOADCT.
idl>
As an IDL session using SAXO must always start with :
idl>
@init
, it could be convenient to define the environment variable IDL_STARTUP
to ${HOME}/My_IDL/init.pro
. In that way, init.pro
will automatically been executed when starting IDL. This can be done with the following command:
$
setenv
IDL_STARTUP
${HOME}/My_IDL/init.pro
$
export
IDL_STARTUP
=${HOME}/My_IDL/init.pro
idl>
n = 10
idl>
y = findgen(n)
idl>
plot, y
findgen stands for float index generator.
|
Using IDL plot command is quite inconvenient to save the figure as a postscript. In addition, positioning the figure on the window/page by using !p.position
, !p.region
and !p.multi
is often a nightmare. That's why we developed splot (like super-plot) which can be used in the same way as plot but is much more convenient to make postscript and position the figure.
idl>
splot, y
% Compiled module: SPLOT.
% Compiled module: REINITPLT.
% Compiled module: PLACEDESSIN.
% Compiled module: CALIBRE.
% Compiled module: GIVEWINDOWSIZE.
% Compiled module: GET_SCREEN_SIZE.
% Compiled module: TERMINEDESSIN.
Save the figure seen on the screen as a (real, not a screen capture) postscript in only one command.
idl>
@ps
% Compiled module: GETFILE.
% Compiled module: PUTFILE.
% Compiled module: OPENPS.
% Compiled module: XQUESTION.
Name of the postscript file? (default answer is idl.ps)
first_ps
% Compiled module: ISAFILE.
% Compiled module: XNOTICE.
% Compiled module: CLOSEPS.
% Compiled module: PRINTPS.
% Compiled module: FILE_WHICH.
% Compiled module: CW_BGROUP.
% Compiled module: XMANAGER.
If needed, the name of the postscript will automatically be completed with .ps. Just hit return, if you want to use the default postscript name: idl.ps .
|
Check that the “first_ps.ps
” file is now existing …
idl>
print, file_test(psdir + 'first_ps.ps')
1
idl>
help, file_info(psdir + 'first_ps.ps'), /structure
** Structure FILE_INFO, 21 tags, length=64, data length=63:
NAME STRING '/Users/sebastie/IDL/first_ps.ps'
EXISTS BYTE 1
READ BYTE 1
WRITE BYTE 1
EXECUTE BYTE 0
REGULAR BYTE 1
DIRECTORY BYTE 0
BLOCK_SPECIAL BYTE 0
CHARACTER_SPECIAL
BYTE 0
NAMED_PIPE BYTE 0
SETUID BYTE 0
SETGID BYTE 0
SOCKET BYTE 0
STICKY_BIT BYTE 0
SYMLINK BYTE 0
DANGLING_SYMLINK
BYTE 0
MODE LONG 420
ATIME LONG64 1122424373
CTIME LONG64 1122424373
MTIME LONG64 1122424373
SIZE LONG64 4913
splot accepts the same keywords as plot (/ISOTROPIC, MAX_VALUE=value, MIN_VALUE=value, NSUM=value, /POLAR, THICK=value, /XLOG, /YLOG, /YNOZERO
), including the graphics keywords (BACKGROUND, CHARSIZE, CHARTHICK, CLIP, COLOR, DATA, DEVICE, FONT, LINESTYLE, NOCLIP, NODATA, NOERASE, NORMAL, POSITION, PSYM, SUBTITLE, SYMSIZE, T3D, THICK, TICKLEN, TITLE, [XYZ]CHARSIZE, [XYZ]GRIDSTYLE, [XYZ]MARGIN, [XYZ]MINOR, [XYZ]RANGE, [XYZ]STYLE, [XYZ]THICK, [XYZ]TICKFORMAT, [XYZ]TICKINTERVAL, [XYZ]TICKLAYOUT, [XYZ]TICKLEN, [XYZ]TICKNAME, [XYZ]TICKS, [XYZ]TICKUNITS, [XYZ]TICKV, [XYZ]TICK_GET, [XYZ]TITLE, ZVALUE
).
It can therefore be customized as much as you want. See this short example:
idl>
splot, y, y^2, linestyle = 2, thick = 2, title = 'y = x^2', /portrait
splot can be used to setup the graphic environment (!p
, !x
, !y
, !z
variables) needed by procedures like oplot
idl>
splot, y, yrange = [0, (n-1)^2], title = 'x and x^2'
idl>
oplot, y^2, color = 50, linestyle = 2
Use the keyword small to produce multi plots figures.
idl>
splot, y, y^2, title = 'y = x^2', psym = 2, small = [1, 2, 1]
idl>
splot, findgen(360)/36., findgen(360)*2.*!dtor, /polar $
idl>
, small = [1, 2, 2], /noerase
the small keyword is a 3 elements vector which defines how we divide the page and in which case we should make the plot: [number of columns, number of rows, case number]. The case numbering is starting at 1, from top to bottom and left to right.
| |
you must put /noerase otherwise the second plot will be done in a new window.
|
Following splot example, we provide scontour as a “super contour”.
idl>
z = dist(n)
% Compiled module: DIST.
idl>
scontour, z
% Compiled module: SCONTOUR.
% Compiled module: CHKSTRU.
scontour accepts the same keywords as contour (C_ANNOTATION=vector_of_strings, C_CHARSIZE=value, C_CHARTHICK=integer, C_COLORS=vector, C_LABELS=vector{each element 0 or 1}, C_LINESTYLE=vector, { /FILL | /CELL_FILL | C_ORIENTATION=degrees}, C_SPACING=value, C_THICK=vector, /CLOSED, /DOWNHILL, /FOLLOW, /IRREGULAR, /ISOTROPIC, LEVELS=vector, NLEVELS=integer{1 to 60}, MAX_VALUE=value, MIN_VALUE=value, /OVERPLOT, {/PATH_DATA_COORDS, PATH_FILENAME=string, PATH_INFO=variable, PATH_XY=variable}, TRIANGULATION=variable, /PATH_DOUBLE, /XLOG, /YLOG, ZAXIS={0 | 1 | 2 | 3 | 4}
), including the graphics keywords (except LINESTYLE, PSYM, SYMSIZE
).
It can therefore be customized as much as you want. See these short examples:
idl>
scontour, z, /fill, nlevels = 15, subtitle = 'nicer contour' $
idl>
, xtitle = 'x index', charsize = 1.5
It can be used in combination with contour to make more complex plots:
idl>
ind = findgen(2*n)/(2.*n)
idl>
scontour, z, levels = n*ind, c_orientation = 180*ind, c_spacing = 0.4*ind
idl>
contour, z, /overplot, c_label = rebin([1, 0], 2, n) , levels = n*ind $
idl>
, c_charthick = 2, c_charsize = 1.5, c_colors = 250*ind
rebin is used to build an array containing an alternation of 1 and 0 in order to label one contour every two contours.
|
scontour is compatible with the positioning method associated with the small
keyword. See for example the test file tst_basic.pro
:
idl>
tst_basic
tvplus is a enhanced version of tvscl and allow you to have a quick look and perform basic exploration of 2D arrays.
idl>
tvplus, dist(20)
left button : mouse position and associated array value
middle button: use it twice to define a zoom box
right button : quit
(x, y) = ( 5, 5), value = 7.07107
(x, y) = ( 12, 8), value = 11.3137
For more informations on tvplus, try:
idl>
xhelp, 'tvplus'
To see the source code of tvplus, try:
idl>
xfile, 'tvplus'
If you use an IDL 6.2 or later revision, you can simply get the help of any command by typing ?command_name
, for example:
idl>
?tvplus
This section briefly describes the main functionalities offered by SAXO to explore gridded data on regular or irregular grid.
As we focus in this section on the gridded data, we must first load the grid informations before reading and plotting the data. Loading the grid independently of the data allow you to reload the grid only when it is strictly necessary and not every time you access the data. In ${HOME}/SAXO_DIR/Tests/
, we provide several examples to load a grid.
Example of Levitus temperature on a regular 1x1 grid.
idl>
@tst_initlev
% Compiled module: INITNCDF.
% Compiled module: ISAFILE.
% Compiled module: UNIQ.
% Loaded DLM: NCDF.
% Compiled module: COMPUTEGRID.
% Compiled module: DOMDEF.
% Compiled module: INTER.
% Compiled module: TRIANGULE.
% Compiled module: TRIANGULE_C.
% Compiled module: UNDEFINE.
% Compiled module: TESTVAR.
% Compiled module: DIFFERENT.
% Compiled module: DEFINETRI.
This @tst_initlev command allows us to define:
jpi, jpj and jpk
glamt
gphit
gdept
glamf
gphif
gdepwtmask
e1t
e2t
e3t
triangles_list
idl>
help, jpi,jpj,jpk
JPI (LOCAL_COORD) LONG = 360
JPJ (LOCAL_COORD) LONG = 180
JPK (LOCAL_COORD) LONG = 33
idl>
help, glamt, gphit,glamf, gphif
GLAMT (LONGITUDES) FLOAT = Array[360, 180]
GPHIT (LATITUDES) FLOAT = Array[360, 180]
GLAMF (LONGITUDES) FLOAT = Array[360, 180]
GPHIF (LATITUDES) FLOAT = Array[360, 180]
idl>
help, gdept, gdepw
GDEPT (VERTICAL) FLOAT = Array[33]
GDEPW (VERTICAL) FLOAT = Array[33]
idl>
help, e1t, e2t, e3t
E1T (SCALE_FACTORS) FLOAT = Array[360, 180]
E2T (SCALE_FACTORS) FLOAT = Array[360, 180]
E3T (VERTICAL) FLOAT = Array[33]
idl>
help, tmask
TMASK (MASKS) BYTE = Array[360, 180, 33]
idl>
help, triangles_list
TRIANGLES_LIST (LIEES_A_TRIANGULE) LONG = Array[3, 128880]
idl>
tvplus, glamt*tmask[*,*,0]
idl>
tvplus, gphit*tmask[*,*,0]
We provide other initialization methods/examples
When the grid is really irregular (its abscissa and ordinate cannot be descried by a vector), loading the grid directly from the data forces us to make an approximation when computing the grid corners position and the cells size. In that case, it can be preferable to load the grid from the meshmask file created by OPA. As OPA use a Arakawa-C discretization, loading the grid from the meshmask will also define all parameters related to the U, V and F grids (glam[uv],gphi[uv], e[12][uvf]). Note that, when using a simple grid definition from the data itself (with initncdf
or computegrid
), adding the keyword /FULLCGRID leads also to the definition of all U, V and F grids parameters. There is the examples to load ORCA grids from OPA meshmask.
A quick presentation of horizontal plots and maps is shown in tst_plt. After loading any of the grid (for example with one of the above examples). Just try:
idl>
tst_plt
Beware, the command is tst_plt and not @tst_plt as tst_plt.pro
is a procedure and not an include.
See the results with
A quick presentation of vertical sections is shown in tst_pltz. After loading any of the grid (for example with one of the above examples). Just try:
idl>
tst_pltz
Beware, the command is tst_pltz and not @tst_pltz as tst_pltz.pro
is a procedure and not an include.
See the results with
A quick presentation of hovmoellers and time series is shown in tst_pltt. After loading any of the grid (for example with one of the above examples). Just try:
idl>
tst_pltt
Beware, the command is tst_pltt and not @tst_pltt as tst_pltt.pro
is a procedure and not an include.
See the results with