#!/bin/bash
echo -n "SEG-Y file name: "
read _segyin
_jobid=$(hexdump -C -s 3200x -n 4 $_segyin | awk '{print $2 $3 $4 $5}')
_linenumber=$(hexdump -C -s 3204x -n 4 $_segyin | awk '{print $2 $3 $4 $5}')
_reelnumber=$(hexdump -C -s 3208x -n 4 $_segyin | awk '{print $2 $3 $4 $5}')
_tracesperrec=$(hexdump -C -s 3212x -n 2 $_segyin | awk '{print $2 $3}')
_auxtraces=$(hexdump -C -s 3214x -n 2 $_segyin | awk '{print $2 $3}')
_sampleinterval=$(hexdump -C -s 3216x -n 2 $_segyin | awk '{print $2 $3;}')
_samplespertrace=$(hexdump -C -s 3218x -n 2 $_segyin | awk '{print $2 $3;}')
_samplesperreel=$(hexdump -C -s 3220x -n 2 $_segyin | awk '{print $2 $3;}')
_filesize=$(stat -c%s $_segyin)
_formatcode=$(hexdump -C -s 3224x -n 2 $_segyin | awk '{print $2 $3;}')
_tracesortcode=$(hexdump -C -s 3228x -n 2 $_segyin | awk '{print $2 $3;}')
_feetmeters=$(hexdump -C -s 3254x -n 2 $_segyin | awk '{print $2 $3;}')
let decjobid=0x$_jobid
let declinenumber=0x$_linenumber
let decreelnumber=0x$_reelnumber
let dectracesperrec=0x$_tracesperrec
let decauxtraces=0x$_auxtraces
let decsampleinterval=0x$_sampleinterval
let decsamplespertrace=0x$_samplespertrace
let decsamplesperreel=0x$_samplesperreel
let dectracesortcode=0x$_tracesortcode
let decformatcode=0x$_formatcode
let decfeetmeters=0$_feetmeters
if [ $decformatcode = 3 ]; then
let _bytespersample=2
else
let _bytespersample=4
fi
let _bytespertrace=($decsamplespertrace*$_bytespersample)+240
let _minus=$_filesize-3600
let _numtraces=$_minus/$_bytespertrace
echo '************************'
echo 'Number of traces: '$_numtraces
if [ $decjobid != 0 ]; then
echo 'Job Id: '$decjobid
fi
if [ $declinenumber != 0 ]; then
echo 'Line number: '$declinenumber
fi
if [ $decreelnumber != 0 ]; then
echo 'Reel number: '$decreelnumber
fi
if [ $dectracesperrec != 0 ]; then
echo 'Traces per record: '$dectracesperrec
fi
if [ $decauxtraces != 0 ]; then
echo 'Number of aux traces per trace: '$decauxtraces
fi
if [ $decsampleinterval != 0 ]; then
echo 'Sample interval: '$decsampleinterval
fi
if [ $decsamplespertrace != 0 ]; then
echo 'Samples per trace: '$decsamplespertrace
fi
if [ $decsamplesperreel != 0 ]; then
echo 'Samples per reel: '$decsamplesperreel
fi
if [ $decformatcode = 1 ]; then
echo 'Format code: 4-byte IBM Floating Point'
fi
if [ $decformatcode = 2 ]; then
echo 'Format code: 4-byte, twos complement integer'
fi
if [ $decformatcode = 3 ]; then
echo 'Format code: 2-byte, twos complement integer'
fi
if [ $decformatcode = 4 ]; then
echo 'Format code: 4-byte, fixed point with gain'
fi
if [ $decformatcode = 5 ]; then
echo 'Format code: 4-byte IEEE floating point'
fi
if [ $decformatcode = 8 ]; then
echo 'Format code: 1-byte, twos complement integer'
fi
if [ $dectracesortcode = 1 ]; then
echo 'Trace sort code: 1 as recorded, no sorting'
fi
if [ $dectracesortcode = 2 ]; then
echo 'Trace sort code: 2 CDP ensemble'
fi
if [ $dectracesortcode = 3 ]; then
echo 'Trace sort code: Single code continuous profile'
fi
if [ $dectracesortcode = 4 ]; then
echo 'Trace sort code: Horizontally stacked'
fi
if [ $dectracesortcode = 5 ]; then
echo 'Trace sort code: 5 Common source point'
fi
if [ $dectracesortcode = 6 ]; then
echo 'Trace sort code: 6 Common receiver point'
fi
if [ $dectracesortcode = 7 ]; then
echo 'Trace sort code: 7 Common offset point'
fi
if [ $dectracesortcode = 8 ]; then
echo 'Trace sort code: 8 Common mid-point'
fi
if [ $dectracesortcode = 9 ]; then
echo 'Trace sort code: 9 Common conversion point'
fi
if [ $decfeetmeters = 1 ]; then
echo 'Measurement system: Meters'
fi
if [ $decfeetmeters = 2 ]; then
echo 'Measurement system: Feet'
fi
echo 'Dec filesize: '$_filesize' bytes'
echo '************************'
You should get something that looks like this:
SEG-Y file name: 102.sgy
************************
Number of traces: 41047
Line number: 102
Reel number: 1
Traces per record: 1
Sample interval: 2000
Samples per reel: 1024
Format code: 4-byte IBM Floating Point
Measurement system: Meters
Dec filesize: 9854992 bytes
************************
SEG-Y file name: R_22.sgy
************************
Number of traces: 10122
Job Id: 666
Line number: 22
Reel number: 1
Traces per record: 1
Sample interval: 4000
Samples per trace: 2000
Samples per reel: 2001
Format code: 2-byte, twos complement integer
Trace sort code: Horizontally stacked
Measurement system: Meters
Dec filesize: 42924156 bytes
************************
La dee da!!
No comments:
Post a Comment