/* ufh script to fix up record headers AFTER doing spatial interpolation using transp | [ temporal interpolator of your choice ] | transp Basically we have to re-prep the data record by record */ func Begin() /* set up some initial values: in a future release of ufh you will be able to bring some of these values in on command line arguments */ { terp = 2.; /* number traces interpolated between */ oldgrp = 12.5; newgrp = oldgrp / terp; offset = 3160.; /* offset of first trace */ } func OnLineHeader() /* we're really not changing anything here */ { TraceLength = LH.NumSmp; /* store number samples per trace */ RecLength = LH.NumTrc; /* store number traces per record */ output(LH); /* output line header unchanged */ } func OnTrace() /* operate on each trace sequentially */ { /* After the interpolation operation the old headers all lie in the first part of each record. We have to build new header values based the old ones. Basically we store the first trace's header values (di, gi, si), read in the next, compute the difference, and then figure out what 1/2 (or 1/3, or 1/4, ..., depending on the inerpolation) that difference is. That will be new increment for the interpolated record. */ trcnum = Tr.TrcNum; /* get sequential trace number of each rec */ curstat = Tr.StaCor; statics [trcnum] = curstat; /* store old static values in a vector */ if ( trcnum == 1) { /* store first trc headers */ gi1st = Tr.RecInd; di1st = Tr.DphInd; si1st = Tr.SrcLoc; } else if ( trcnum == 2 ) { /* get second trc header values */ gi2nd = Tr.RecInd; di2nd = Tr.DphInd; si2nd = Tr.SrcLoc; dgi = (gi2nd - gi1st) / terp; /* calc interpolated difference */ ddi = (di2nd - di1st) / terp; dsi = (si2nd - si1st) / terp; gi = gi1st + dgi; /* interpolated header values for trc 2 */ di = di1st + ddi; si = si1st + dsi; Tr.RecInd = gi; /* put values in header mnemonics */ Tr.DphInd = di; Tr.SrcLoc = si; } else { /* for rest of record compute new header values */ gi = gi1st + dgi * (trcnum - 1); di = di1st + ddi * (trcnum - 1); si = si1st + dsi * (trcnum - 1); Tr.RecInd = gi; /* put values in header mnemonics */ Tr.DphInd = di; Tr.SrcLoc = si; } /* Next we fix up the statics by interpolation. The original static values are stored in the "statics" vector in sequential order. We want to pick these values one by one and stuff them in the headers of the original traces (i.e. every "terp" traces. This is done in the first "if" block. */ if ( trcnum%terp != 0 ) { indx = nint( (trcnum + 1)/terp ); oldstat = statics [ indx ]; Tr.StaCor = oldstat; /* put static in hdr */ } /* The next "if" block is the interpolated trace (here we assume terp=2, call gutowski at research for a more general version). We take the previous "old" static and the next original static and for terp=2 calc the average value */ else { nextstat = statics [ indx + 1 ]; Tr.StaCor = ( nextstat + oldstat )/terp; /* put static in hdr */ } /* Compute new trace distances using new group interval and offset of first trace. Note that below we assume trc 1 is the far offset and count DOWN from that value. If trc 1 was the near offset we would have to count UP and the "-" sign would become a "+" */ dist = offset - newgrp * (trcnum - 1); udist = abs ( dist ); /* calc unsigned trc dist */ Tr.DstUsg = udist; /* put values in header mnemonics for distance */ Tr.DstSgn = dist; output(Tr); /* out put modified header and trace */ } func End(){ } /* Run this script as follows: Either ufh interp_hdrs.ufh < indata > outdata Or process ... | ufh interp_hdrs.ufh > outdata Or anycombo of pipes or re-directs */