Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.openFileDialog1.ShowDialog() != System.Windows.Forms.DialogResult.OK)
     {
         return;
     }
     SEGYlib.SEGYFile sf = new SEGYlib.SEGYFile();
     foreach (var f in openFileDialog1.FileNames)
     {
         if (sf.Open(f) == 1)
         {
             if (sf.isSEGY())
             {
                 listBox1.Items.Add(f);
             }
         }
         sf.Close();
     }
 }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.folderBrowserDialog1.Description = "Enter the destination for the corrected SEGY file";
            if (this.folderBrowserDialog1.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            // read throught input file and make corrections to trace positions as needed
            sf            = new SEGYlib.SEGYFile();
            inputSEGYfile = this.openFileDialog1.FileName;
            sf.Open(this.openFileDialog1.FileName);
            if (!sf.isSEGY())
            {
                sf.Close();
                return;
            }

            string outputFileName = this.folderBrowserDialog1.SelectedPath + System.IO.Path.DirectorySeparatorChar.ToString() + System.IO.Path.GetFileNameWithoutExtension(inputSEGYfile) + "fix.sgy";


            SEGYlib.SEGYFile sf2 = new SEGYlib.SEGYFile();
            sf2.Open(outputFileName);

            sf2.FileHeader = sf.FileHeader.Copy();
            sf2.Write(sf2.FileHeader);

            while (sf.ReadNextTrace())
            {
                SEGYlib.SEGYTrace tr = sf.currentTrace;

                SEGYlib.SEGYTrace newTr = tr.Copy();
                newTr.TraceHeader.scalarToBeAppliedToAllCoordinates *= -1;
                newTr.sourcePositionX = newTr.sourcePositionX / 10;
                newTr.sourcePositionY = newTr.sourcePositionY / 10;

                sf2.Write(newTr);
            }

            sf.Close();
            sf2.Close();
        }