The edit panel is used for editing the headers or samples of a SEGY file or files.
Any edit operations are reflected in the current file(s) immediately. A new file is not created by any edit function.
An comprehensive undo function can rescue users from mistakes and can restore a file to its original state or to any intermediate edit step.
The edit byte box sets the start byte of the value(s) to be edited.
The number of bytes is determined by the format selected in the format panel, 2 bytes for 16 bit integer, 4 for 32 bit integer and floating point etc.
The edit byte can be set by typing the byte number in the box, or by double clicking on the desired byte location in the display window.
For example to edit the shotpoint number in a standard SEGY file set the edit byte to 17 and the format to 32 bit integer. To edit an IEEE floating point value the format must first be set to
IEEE float otherwise the results will be very wrong.
NOTE: In the data sample view the byte number is a sample number starting at 1 for the first
sample in the trace. In all other views it is a start byte location.
The contents box displays the value of the edit byte location in the selected format.
To alter a value simply overwrite the value in the box and click on the "Overwrite" button. The overwrite function is used to alter single values in the binary header or an individual trace.
All multi trace edits are performed over the trace range set in the "Start Trace-End Trace" boxes.
The default is the entire trace range for each file. Traces outside the range will not be affected by any edit operations.
Edits can be performed on the current file, as shown in the display window, or all the selected files in the working set list.
Files in the list must be selected to be included in multi-file edits. By un-selecting files in the working set dialog box the user can restrict edits to groups of similar files.
The default is to only edit the current file. To edit all selected files click on the "All selected files" radio-button.
Note that this option will remain selected until it is reset to "Current File only". The user is warned whenever a multi-file edit is attempted.
Multi file edits on large groups of files can take some time, the program will not respond to input until all files are edited.
When doing multi-file edits ensure that the edit byte for all selected files is in the same format.

Trace header edits alter the selected edit byte in the selected format for all traces in the edit trace range.
Edits are performed on the current file or all selected files.
To alter a value on the current trace only use the "Overwrite" button.
The standard CSEG SEGY format specifies that the shotpoint number should be written in bytes 17-20 in 32 bit integer. It should be scaled by 1000 to accomodate fractional shotpoint numbers.
This edit function gets the shotpoint location and format from the
SegyTool defaults.
The trace range is scanned and duplicate shotpoints are set to zero.
Each shotpoint is multiplied by 1000 and all zero values are interpolated. At least 2 non-zero
shotpoint numbers must be present.
Note that this function will not work properly on floating point shotpoint numbers.
These values must first be converted to 32 bit integer using the "Reformat" function.
These functions perform operations on the trace header XY coordinates. Select the desired function from the above dialog.
Copy XYs to alternate byte locations


Calculate and insert XYs in 3D trace headers
NAD (North American Datum) conversions


This function will set the edit byte to zero for all traces in the edit range as defined by the values in the "Start Trace" "End Trace" boxes.
This function is used to delete bad values in a header location or to prepare for interpolation of sparse values.
This function will interpolate between non-zero values for all traces in the range. Live values will be extrapolated at each end of the range if necessary.
Before interpolating the range is scanned and duplicate values are zeroed so shotpoint
sequences such as 101,101,102,102,103,103 are interpolated correctly.
This option works for all formats.

This function will change the format of the selected byte location. For example if the shotpoint number is in 32 bit integer you can reformat it to IEEE float.
Select the new format from the drop-down list on the reformat dialog
The display format MUST be set to the current format for this option, that is, if you are reformating from 32 bit integer to IEEE float the view format must be set to 32 bit integer.
Note that floating point values converted to 16 or 32 bit integer will lose their decimal component. Note also that the maximum value that can be represented by an 8 bit integer is +- 127 and the maximum for a 16 bit integer is +- 32767.
Fractional floating point values such as .01, .15, .004 will all resolve to zero when converted to any integer format. The current values should be examined carefully and possibly scaled before using this option.
Reformating values with a range greater or less than the max value of an integer will result in completely erroneous data.

This function inserts 3D inline and xline numbers in the trace headers in the users choice of byte location and format.
Use the dialog box to set the start and end inline and xline as well as the format and byte locations for each.
The inline number can also be thought of as the line number and the xline number as the trace number for each line.
The CSEG standard specifies that inline and values should be 32 bit integers with the inline number in bytes 17-20 and the xline in bytes 21-24.
Note that this function assumes a "square" 3D, that is one with a constant number of
xlines per inline. It will not work properly for "unpadded" 3Ds.
Write number of samples, sample rate in trace headers
Some software packages require that the number of samples and sample rate be encoded in each trace header.
The SEGY standard specifies that the number of samples is written as a 16 bit integer in bytes 115-116. The sample rate in micro-seconds is written in bytes 117-118 as a 16 bit integer.
This function writes the number of samples and sample rate from the binary header in each trace header in the above locations.
Save header items to alternate locations

This function will save four trace header fields to alternate byte locations. This function can be used to save critical information before editing the original data.
The default fields are shotpoint, CDP, X and Y .
The fields can be written in an alternate format from the originals.

This option is used to import XY coordinates from an text file and insert them into the
appropriate trace headers.
SegyTool attempts to import XYs for all selected files in the working set. The top portion of the import dialog lists the files from the working set.
Individual files can be selected or unselected for survey import using the check boxes to the left of each file path.
The line box will contain the matching line name from the survey text file.
If there is no matching line during import the file is ignored even if it is selected.
The bottom portion of the dialog displays the survey text file information.
There are three recognized formats for the ASCII file
Standard SEGP-1 format, with or without comment lines
A blank delimited format of one shot per line with fields separated by one or more blanks.
The fields must be in the order of: line shot x y
A comma delimited format identical to the above except the fields are separated by commas.
line,shot,x,y.
Before opening the survey file use the "Format" drop down list to select the format of the survey file.
Also set the shotpoint and XY format from the lists. The shotpoint format should be set to the format of the shotpoint in the trace headers.
Set the shotpoint scalar to match the scale of the shotpoints in the trace header to the shotpoints in the survey file. If the shotpoints in the header are scaled by 1000
use that value in the scalar box.
The XY format is the format used to write the XYs in the headers.
For standard SEGP-1 files the XY scalar should be set to 0.1 to convert the decimetres
in the survey file to metres.
Click on the "File" button to bring up a file browser and select the survey text file. The file is scanned and a list of lines in the survey file with the coresponding shotpoint ranges is displayed in the lines box.
SegyTool wil attempt to match line names in the survey file with SEGY file names in the file list.
If a match is found the line name is entered in the corresponding line box next to
the file path. If no match is found the user must assign the survey line names
to the corresponding SEGY file names.
To do this highlight a line name in the Survey line list box and click on the "Assign" button for the matching SEGY file. Use this method to assign survey lines to any unmatched SEGY files or to override any erroneous matches.
When all assignments have been made click on the "Import" button. SegyTool will
import the XYs inserting coordinates for each input line and shotpoint into
the corresponding SEGY file and trace by matching shotpoint numbers.
The XYs are then interpolated over all the traces in the file.
Files in the working set that are un-selelected or have no assigned line name will be ignored.

This option is used to import values from a text file and insert them into the appropriate trace header. These values can be elevations, static shifts, fold etc.
The user controls the byte location and format of the values placed in the headers.
This option works similarly to the XY import described above. Values can be imported into multiple SEGY files at once.
The input text file must be in one of the following formats
Space delimited Linename Key_Value Input_Value.
Comma delimited Linename,Key_Value,Input_Value
The input, or user, value is the value to be inserted into the trace headers. It must, of course, be a numeric value but can be integer or floating point.
The key value is a number that will match a corresponding value in the trace header. This value is used to assign the input values to the proper trace.
The Key value can be a trace number, CDP number, or shotpoint. There need not be a key value for every trace. Input values willl only be inserted at traces
that match the key values. If necessary the user can manually interpolate the input values after importing them.
Select the format of the ASCII file from the drop down list, then click on the file button and select the input text file. The file will be scanned and a list of lines and their key value range will be added to the "Lines in file" drop down list.
The function will attempt to automatically match the line name from the input text file to the appropriate SEGY file. If no match can be made the user can select the line that matches the current SEGY file and click the "Assign" button next to the SEGY file name.
Set the byte location and format of the key value in the SEGY trace headers.
Set the preferred byte location and format for the input values. The formats of the
key and input values need not be the same as the current view format.
Click on the import button and the values will be imported into the traces that match the key values.
A SeisX / SeisWare SEGY file has the peak, average, and RMS sample value for each trace encoded in the trace header. The corresponding values for the entire file are encoded in the
binary header.
The values represent the largest, average, and RMS data samples and are calculated over a user defined window when the file is imported into SeisX / SeisWare or created by SegyTool.
The values are used by SeisX / SeisWare to properly scale trace displays. If the values are incorrect due, for instance, to strong amplitudes in the shallow protion of the trace, the window for calculating the values must be changed.
The only method in SeisX to change the window is to re-import the file. This function allows the user to define a new window, recalculate the values and write them in the appropriate header locations. Then the file need only be detached and re-attached in SeisX.
This function will write CDP numbers starting at one and incrementing by one for all traces defined in the start to end boxes.
The CDPs are written in bytes 21-24 in 32 bit integer format.
Search and replace header values

This function will search and replace values in the edit byte location if they are greater than, less than, equal to, or not equal to, a user defined value.
Values are replaced by a value set by the user. In the above example any header value greater than 137000 will be replace by zero.
This function is useful for the rare occurence where the trace headers contain huge invalid numbers interspersed sparsely with valid values such as shotpoints.
This function will remove the invalid header values allowing the user to properly interpolate the valid header values.

This function will write trace flags in bytes 29-30 of the trace header.
The samples for each trace are scanned for non zero values.
For traces with any non-zero samples the default flag is 1, for dead traces, that is all samples are zero, the default flag is 2. These values should not normally be changed.

This function is, at present, restricted to Encana users.
It is used to apply a shift to the X Y coordinates in the trace headers to bring them to the ATS 2.6 standard.
The shifts are imported from a text file that must be in one of the following formats.
Space delimited Linename shotpoint X_shift Y_shift
Comma delimited Linename,shotpoint,X_shift,Y_shift
Pipe delimited Reference ID|Linename|shotpoint|X_shift|Y_shift
As in the Import XY dialog the selected working set files are listed at the top of the dialog with a select check box, an assign button, and a linename box. Files selected in the working set can be unselected by clicking the checkbox. Any unselected file will be ignored during the import. Also any file that doesn't have an assigned linename will be ignored.
First set the input file format from the drop down list then click in the file browser and select the input text file.
The file will be scanned and the list of linenames and their shotpoint range will be added to the Lines drop-down list. If the wrong format was selected simply change it and the file will be re-scanned.
The function will attempt to match the linenames in the text file with the file name of the SEGY file. If a match is found the line name is entered in the corresponding line box next to the file path.
If no match is found the user must assign the shift file line names to the corresponding SEGY file names. To do this highlight a line name in the line list box and click on the "Assign" button for the matching SEGY file.
When all assignments have been made click on the "Import" button. SegyTool will first copy the existing X Y coordinates from their current byte location to byte 89-92 for the X and 93-96 for the Y.
The shifts are read into memory and interpolated so that there is a shift for every trace in the file. The shifts are then applied to the XY coordinates in the corresponding trace headers.
Finally the "ATS2.6" flag is written in the binary header to flag the file as having the ATS shift applied. If a file is already flagged as ATS2.6 the user will be warned and given the option to skip the shift import for that file.

This function will read in tidal depths from a text file, match the time stamps embedded in the text file with the time stamps written in the SEGY trace headers and, if a match is found, calculate a two-way static correction which is then written in the trace header..
The format of the text file is fixed, see an example below.

The user can define the byte locations and formats for the SEGY header values as well as the velocity for computing the static correction.
Note that the static is only computed and written in the header. It is not applied to the trace. .
The window to search for a match between the time stamps in the shift file and the times in the SEGY trace headers can
be set. If the window is set to one minute only traces with time stamps that match within plus or minus one minute
from a time stamp in the shift file will be assigned a static shift.
This operation works on the currently selected SEGY file only.
Trace header arithmetic operations

This function will perform arithmetic, (add, subtract, multiply, and divide) operations on the contents of two trace header locations.
Select the byte locations and formats for the two header values. Select the byte location and format to store the result of the operation. The output
can be stored in one of the two locations selected for the operation. Click the "OK" button to perform the operation.
Note the definition of the arithmetic operation as defined on the dialog. For instance the first header value is subtracted FROM the second header value.
The first header value is divided into the second.
This function will copy from one byte location to another. For instance, copying shotpoints from an obscure byte location such as 181 to byte 17.
To copy set the edit byte to the byte location to be copied FROM. Enter the copied TO byte location in the box next to the "Copy to" button.
Be sure the view format is correct for the byte location to be copied.
Click on the button and the header values will be copied to the new byte location. The values at the original byte location are unchanged.
This function will multiply each header value at the edit byte location by a user specified value.
The scalar can be integer or floating point. If a floating point scalar is applied to an integer header value the value will be rounded off.
This feature can be used, for instance, to scale header XYs from decimetres to metres. Simply enter the scalar in the box next to the "Scale by" button and press the button. All non-zero header values will be scaled.
This function is similar to the scale by function described above except the user specified value is added to the header value. Postive or negative values can be entered.
Use this feature to add a constant bias to a coordinate value.

The undo function allows the user to step back through previous edits in case of an error.
In the above example, if the bias value was incorrect clicking on the line "Scale byte 221 by 10.0" will restore the current file to the state it was in before the bias button was clicked.
Whenever an edit button is clicked all the trace headers are written to a temporary disk file. To undo an edit SegyTool reads the trace headers that were saved at the time of the last "good" edit and replaces the current headers.
Clicking on "Original" will restore the file to the state it was in before any
edits were perfomed. The Undo button affects only the current file, however each file in the working list can have edits undone.
To undo the edits on multiple files you must either step through each file in the working list and click on undo, or click on the "Undo All" button.
The Undo All function will reset ALL selected files to their original state losing all edits.
Note that you must have write privilege in the directory where the undo file resides. If the temporary files cannot be written the user will be warned and undo will be disabled.
If SegyTool terminates abnormally the undo file will not be deleted. The file is written in the directory containing the first SEGY file selected by the user. The file name is something like
"SegyTool_History_09022003_0256.tmp". The string 09022003_256 denotes the date and time the file was created, in this case September 2, 2003 at 2:56.
Any old undo files should be deleted. They cannot be accesed by SegyTool.

This function allows the user to save the contents of the Undo dialog for this file to a text file or the EBCDIC header.
Note that this operation saves the undo history as listed in the undo dialog. It does not save the trace headers that the Undo function creates and cannot be used to recreate a previous version of a SEGY file in a later SegyTool session. It only saves a record of what operations were performed on a SEGY file.
If saving the history to the EBCDIC header the user can define the row and column to insert the history. This can be done manually or by clicking on the appropriate point in the EBCDIC header.
After saving the history the user has the option to reset the file history so that all previous history is lost.
Saving the trace headers for each edit takes time and uses disk space, (240 bytes per trace). On very large files this may not be desirable. Unchecking this option will disable the Undo function.
It is suggested that any edits done with Undo disabled should be done with care and on a file that can be restored easily.
SegyTool may disallow Undo on very large files if there is insufficient memory to save the headers. The formula for determining if there is sufficient
memory is if the number of traces times 240 exceeds half the amount of allocated RAM for the Java virtual machine
undo will not be allowed. Also if the number of traces times 240 exceeds 2 gigabytes undo will not be allowed. The amount of allocated RAM is determined at startup by the flag:
-Xmx256m
which would allocate 256 megabytes of RAM and would be used in the startup command as:
java -Xmx256m -jar /apps/SegyToo/SegyTool.jar /apps/SegyTool
Consult your IT people before setting the amount of RAM to allocate to the Java VM.

Any byte location in the binary header can be edited.
The header locations for sample rate (17-18, 19-20), number of samples (21-22, 23-24) and sample format (25-26) should be edited with care since these fields will affect how the file is read by SegyTool and other software.
If these values are changed the file must be reloaded so that SegyTool can recognize the changes. To quickly reload the file click on the "Reload current file" button on the top left button bar.
As with trace headers edits can be performed in any format. SeisX files have binary headers with
short integer, long integer, and IEEE float values.
To edit these values set the view format to match the value being edited.
All edits are performed by overwriting the value in the Edit box and clicking
on the "Overwrite" button.
Edit operations in the right hand panel affect only the current file.
The Undo function is turned off. To undo simply overwrite the edit byte with
the original value.
The functions on the left hand panel can be applied to multiple files and the
Undo function works.

SeisX / SeisWare files contain an ASCII description field in the last 80 bytes of the EBCDIC header.
There is also a line name in bytes 301-320 of the binary header. Either or both of these can be edited with this function.
SeisX files can be converted between SeisX versions 3.xx and 4.xx.
The only differences between the two versions are:
The SeisX flag in bytes 399 - 400. For version 3.xx the flag is 91, for version 4.0 it is 92.
The format code in bytes 25-26. Version 3.xx uses a 1 for IEEE float and a 6 for IBM float which is contrary to the CSEG stamdard.
Version 4.0 conforms to the CSEG standard of a 6 denoting IEEE float and a 1 for IBM.
This feature is exclusive to Encana.
The flag is the text string "ATS2.6" written in bytes 77-82 in the binary header. If the flag is in the header it will appear in the ATS box. If not the box is blank.
To manually set the flag click on the "Set ATS" button. This will, of course, only set the flag, not alter the XY coordinates.
Conversely if the flag is set and the user wishes to remove it the button will read
"Clear ATS". Once again the XYs are not touched.
The EPSG (European Petroelum Survey Group) codes are used by Devon Canada and Encana to embed coordinate reference information into SEGY files.
There is an EPSG code for virtually any coordinate reference system in the world. For instance the code for UTM zone 11 north NAD 27 is 26711.
The code is written in 32 bit integer in bytes 161-164 of the binary header. Select the appropriate code from the drop down list and it will be inserted.
.

A feature used by Encana to write or alter a unique lineid in bytes 1-12 of the binary header. The LineId can be entered manually by the user, or a subset of the
internal line name written in bytes 301-320 of the binary header or the file name can be used. Finally a subset of the SEGY file name up to the first dot can be used for the Line Id.
This operation can be performed on the current file or all selected files.

The EBCDIC header consists of text data written in either EBCDIC or ASCII. The default is EBCDIC. If the text appears unintelligible in one format try selecting the other.
Headers can be converted from EBCDIC to ASCII or vice-versa. To convert from EBCDIC to ASCII set the view format to EBCDIC. Ensure that the file is readable, you must be in the format that the file is currently written in. Click on the "Write ASCII" button and the header is converted to ASCII. The text will appear garbled until the view format is changed to ASCII.
This conversion can be performed on the current file or all selected files.
Use with care, converting an EBCDIC header to EBCDIC or and ASCII header to ASCII will completely corrupt the header text. Fortunately there is an Undo function identical to the one in the trace header edit panel.
The header can be edited like a text file. Text can be entered, deleted, or cut and pasted the same as in Wordpad or Notepad. To copy text use "Ctrl c", to paste use "Ctrl v".
To save actually write edits to the header click on either "Write EBCDIC" or "Write ASCII" depending on the format of the header. If you do not click on a
write button your edits will be lost when you change header views.
Edit EBCDIC for multiple files
The "Multi-file Edit" function allows the user to insert the same text into the
EBCDIC header of all selected SEGY files.
Enter the text to be inserted, or paste the text from an ASCII source.
In the EBCDIC header window click on the starting line and column for inserting the text. Click the "Fill" button to set the insertion row and column. The row / column values can also be entered manually.
The text will be inserted starting at the selected column of the selected row. Multi-line text will all be inserted at the same column.
There is a maximum line length of 80 characters and a maximum of 40 lines.
Click the "Write" button to insert the text into all selected lines
in the currently selected view format, EBCDIC or ASCII.
At the top of the main display window there is a checkbox to write a flag in the EBCDIC header if the file is altered. This option can be enabled in the defaults file.
If selected, whenever the SEGY file is altered the flag "SGT" is written in the EBCDIC header in columns 1 to 3 of the last row.
The flag can be manually set or removed by clicking on the appropriate button.
Note that this flag is never written in a SeisX SeisWare formatted file because of the description field which is written in the last row of the header.
Write line name in EBCDIC header
This function will write a line name, selected from a list by the user, into the EBCDIC header at a predefined location.
This function is intended to run on all selected files in the working set. The user can deselect files if desired.
The file name to line name matches are defined in a text file supplied by the user. The file can be comma or space delimited and can consist of several fields besides the file or line name. Leading and trailing white space is ignored.
There are two ways to match line names to file names.
The first reads a single line name field and tries to match the line name to each file name in the upper list up to the first dot. Then for each file name that was not matched the file name and line name are compared to see if the file name starts with the line name. In this way the file name "ABC-001_MIG.sgy" would match the line name "ABC-001".
The text file could look something like the following. You would define the file as space delimited and read the line name from field 5
The second method requires that the file names match exactly including the file extension. The corresponding line name for each file name is then assigned.
The text file must consist of a minimum of two fields, the file name and line name. Other fields will be ignored.
A file might look like the following. You would define the as space delimited with the file name in field 1 and the line name in field 2.
Line names from the text file can be manually assigned to file names with the"Assign" buttons. Any files without matching line names
will be de-selected.
The user can manually assign the row and column that make up the insertion point in the EBCDIC header or select it by clicking in the header and clicking the
"Fill" button.
This operation can be reversed using the "Undo" or "Undo All" buttons.
This is another function that is exclusive to Encana.
Clicking this button brings up a dialog box with boxes to enter the Reference ID and the Line name. Click on the "Write" button and the reference ID is written in the EBCDIC header
in bytes 85-93 and the line name in bytes 94-113 as defined in the Encana SEGY standard.
Data samples can be edited by setting the edit sample number, (not a byte location).
Enter the new value in the contents box, and click "Overwrite". This method can be
used to delete spikes in data.
There is no undo and the edit is performed only on the current file and trace.
This function will replace the sample in the edit contents box with a sample interpolated between the two adjacent samples.
The edit sample can be set using the "Show" button in the
Sample Display (Histogram) dialog. A quick way to get rid of a spike.

This function will zero all the samples for the trace range defined in the start and end trace boxes.
NOTE: This function is performed on the current file only and cannot be undone.

This function will replace "bad" samples in the current file. Bad samples are those with amplitudes over a user defined threshold or samples that are interpreted by SegyTool
as not being valid floating point numbers (NAN, Not a Number).
The bad samples can be replaced by a constant, user defined value, or with a value interpolated
between, or extrapolated from, adjacent "good" values.
NOTE: This function is performed on the current file only and cannot be undone.