SUSHW - Set one or more Header Words using trace number, mod and integer divide to compute the header word values or input the header word values from a file ... compute header fields sushw stdout key=cdp,.. a=0,.. b=0,.. c=0,.. d=0,.. j=..,.. ... or read headers from a binary file sushw stdout key=key1,.. infile=binary_file Required Parameters for setting headers from infile: key=key1,key2 ... is the list of header fields as they appear in infile infile= binary file of values for field specified by key1,key2,... Optional parameters (): key=cdp,... header key word(s) to set a=0,... value(s) on first trace b=0,... increment(s) within group c=0,... group increment(s) d=0,... trace number shift(s) j=ULONG_MAX,ULONG_MAX,... number of elements in group Notes: Fields that are getparred must have the same number of entries as key words being set. Any field that is not getparred is set to the default value(s) above. Explicitly setting j=0 will set j to ULONG_MAX. The value of each header word key is computed using the formula: i = itr + d val(key) = a + b * (i % j) + c * (i / j) where itr is the trace number (first trace has itr=0, NOT 1) Examples: 1. set every dt field to 4ms sushw outdata Again, it is possible to eliminate the multiple calls to both sushw and sushw, as in Example 4. Reading header values from a binary file: If the parameter infile=binary_file is set, then the values that are to be set for the fields specified by key=key1,key2,... are read from that file. The values are read sequentially from the file and assigned trace by trace to the input SU data. The infile consists of C (unformated) binary floats in the form of an array of size (nkeys)*(ntraces) where nkeys is the number of floats in the first (fast) dimension and ntraces is the number of traces. Comment: Users wishing to edit one or more header fields (as in geometry setting) may do this via the following sequence: sugethw < sudata output=geom key=key1,key2 ... > hdrfile Now edit the ASCII file hdrfile with any editor, setting the fields appropriately. Convert hdrfile to a binary format via: a2b < hdrfile n1=nfields > binary_file Then set the header fields via: sushw < sudata infile=binary_file key1 key2 ... > sudata.edited Caveat: If the (number of traces)*(number of key words) exceeds the number of values in the infile then the user may still set a single header field on the remaining traces via the parameters key=keyword a,b,c,d,j. Example: sushw < sudata=key1,key2 ... infile=binary_file [Optional Parameters] Credits: SEP: Einar Kajartansson CWP: Jack K. Cohen CWP: John Stockwell, added multiple fields and infile= options Caveat: All constants are cast to doubles.