A common need is to browse through several datasets, perhaps to locate a specific one, or to determine which are acceptable for further processing. The following presents images of a series of NDFs using the display task of KAPPA. The title of each plot tells you which NDF is currently displayed.
foreach file (*.sdf)
display $file:r axes style="'title==$file:r'" accept
sleep 5
end
sleep pauses the process for a given
number of seconds, allowing you to view each image. If this is too
inflexible you could add a prompt so the script displays the image
once you press the return key.
set nfiles = `ls *.sdf | wc -w`
set i = 1
foreach file (*.sdf)
display $file:r axes style="'title==$file:r'" accept
# Prompt for the next file unless it is the last.
if ( $i < $nfiles ) then
echo -n "Next?"
set next = $<
# Increment the file counter by one.
@ i++
endif
end
The first lines shows a quick way of counting the number of files. It
uses ls to expand the wildcards, then
the command wc to count the number of words. The back quotes
cause the instruction between them to be run and the values generated
to be assigned to variable nfiles.
You can substitute another visualisation command for display
as appropriate. You can also use the graphics database to plot more
than one image on the screen or to hardcopy. The script $KAPPA_DIR/multiplot.csh does the latter.
C-shell Cookbook