#! /bin/sh
# Making segy data for little Endian machines

if
	[ ! -f oz25.F -o ! -f oz25.H ]
then
	echo "See the README file for accessing the required data" 1>&2; exit 1
fi

# Since we are on a "Little Endian" machine (PC), we must swap bytes
# Add header and set header fields for future processing convenience.
# Notes:
#	n1 in graphics programs corresponds to SEG-Y field ns
#	d1 in graphics programs corresponds to SEG-Y field dt/10^6
#		but CWP has also added a float d1 field
#	f1 in graphics programs corresponds to SEG-Y field delrt/10^3
#		but CWP has also added a float f1 field
#	n2 in graphics programs corresponds to CWP SEG-Y field ntr
#	CWP has added d2 and f2 fields

# Remark: this way is perhaps easiest to read:
#swapbytes <oz25.F |
#suaddhead ns=2000 |
#sushw key=dt a=2000 |
#sushw key=d1 a=.002 |
#sushw key=delrt a=2 |
#sushw key=f1 a=.002 |
#sushw key=ntr a=97 |
#sushw key=d2 a=.050 |
#sushw key=f2 a=-2.400 |
#sushw key=offset a=-2400 b=50 |
#sushw key=gx a=-2400 b=50 >data.su

# But once you know what you want, this way is more efficient:
swapbytes <oz25.F |
suaddhead ns=2000 |
sushw key=dt,d1,delrt,f1,ntr,d2,f2 a=2000,.002,2,.002,97,.050,-2.400 |
sushw key=offset,gx a=-2400,-2400 b=50,50 >data.su

exit 0

