Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~aoftm/src/aoftm_unpack
Дата изменения: Mon Jul 26 06:34:43 1999
Дата индексирования: Tue Oct 2 01:30:48 2012
Кодировка:

Поисковые слова: п п п п п п п
# SCRIPT TO UNPACK AOFTM DATA FROM TAPE OR UNIX FILE
#
# This script reads AOFTM data from tape or UNIX file in 2 bit or 8 bit
# form, converts to single bytes, and pipes the data stream to stdio.
# An ascii header file is also created.
#
# To read data from tape, type 'aoftm_unpack T (nfile)', where nfile
# is the file number of the header you wish to access. If no argument is given,
# the header will be read from the tape's current position. Note: the
# environment variable TAPE must be defined.
#
# To read data from a UNIX file, type 'aoftm_unpack F hdrname dataname', where
# hdrname and dataname are the names of the header and data files located
# in data_dir. The environment variable data_dir must be defined.
#
# MAM 10 Mar 1997

#??????????????????????????????????????????????????????????????????????????????????#
# DEFAULT VALUES FOR VARIABLES - EDIT THIS SCRIPT HERE TO CHANGE THESE VALUES #
# #
set nbufs_to_skip = 0 # number of buffers at beginning of file to skip #
set nbufs_to_read = all # number of buffers to read (set nbufs_to_read for all) #
# #
#??????????????????????????????????????????????????????????????????????????????????#

unalias bc

echo Will skip $nbufs_to_skip buffers.
echo Will read $nbufs_to_read buffers.

set this_file = "aoftm_unpack"

set starttime = `date`
set hostname = `hostname`

if ($#argv < 1) then
echo No Arguments!
echo Usage: aoftm_unpack T (to read from tape)
echo aoftm_unpack F (to read from UNIX file)
exit 1
endif

set input_dev = $1
set tapenum = 0

echo $input_dev

if ($1 == 'T') then

if ($#argv > 1) then # POSITIONING TAPE CORRECTLY #
set nfile = `echo "($2-1)*2" | bc`
mt rew
mt fsf $nfile
else
echo Reading from current tape position!
endif

read_hdr << EOD
$input_dev
EOD

else

if ($#argv < 3) then
echo Usage: 'aoftm_unpack F hdrname dataname'
exit 1
endif

set hdrname = $2
set dataname = $3

echo headername $hdrname
echo dataname $dataname

read_hdr << EOD
$input_dev
$data_dir/$hdrname
EOD

endif

set fmjd = `grep MJD header | awk '{print $2}'`
set mjd = `echo "$fmjd/1" | bc`
set nscan = `grep Nscan header | awk '{print $2}'`

echo MJD = $mjd
echo NSCAN = $nscan

set prefix = $mjd"."$nscan

set nbufs = `grep Nbufs header | awk '{print $2}'`
set nbits = `grep Nbits header | awk '{print $2}'`
set nfft = `grep Nfft header | awk '{print $2}'`

if ($nbufs_to_read != 'all') then
set nbufs = $nbufs_to_read
endif

if ($input_dev == 'T') then # UNPACK DATA AND SEND TO STDIO #
ao_unpack << EOD > /dev/null # REPLACE /dev/null WITH COMMAND #
$input_dev # OR FILENAME #
$nbufs
$nbufs_to_skip
$nbits
$nfft
EOD
else
ao_unpack << EOD > /dev/null
$input_dev
$data_dir/$dataname
$nbufs
$nbufs_to_skip
$nbits
$nfft
EOD
endif

echo aoftm_unpack FINISHED
exit 0