Message Boards Message Boards


Read SEGY data in Mathematica?

Posted 4 years ago
13 Replies
10 Total Likes

Please I need code/software to read SEGY data in order to input to Mathematica

13 Replies

I don't know if this is helpful, but there is an R package called Rquake

that looks like it is built to to read in seg-y data. Mathematica has a good interface with the R Language via RLink:

So, although it may not be a trivial exercise to add in this package to R and then to interface with Mathematica using RLink, it may be simpler than trying to write some kind of seg-y parsing code in regular Mathematica.

Posted 4 years ago

If you mean the SEGY seismic data format I can recomend to use this project This package allows you to import and export seismic data into the Mathematica, to work with the trace headers and text headers. It supports both the data format floating-point and integer data. You can dowload repository and find some examples. The comments are on Russian but a think you can understand the code easily. If you would like to improve this project, can you tell us about your wishes and to participate in development.

Thank you Anton for sharing these codes with me. This is exactly what I need, to be able to read SEGY data into the Mathematica. However, I will appreciate if you could help with English version of step-by-step guide to use it. I am a new user of Mathematica. Thank you once again

Thank you for sharing this interesting body of work. I installed the package as per the instructions and am exploring the examples. As it happens the first one I tried, from the file "" has a minor issue. The code:

file = FileNameJoin[{"CustomImportExport", "Resources", 
data = CustomImport[file, "SEGY"];
traces = data["Traces"];Head[traces]  (* check the form of traces *) 


So the following ArrayPlot fails unless we take the second part of "traces", and now it works very nicely.

ArrayPlot[Transpose[traces[[2]]], AspectRatio -> 0.5, 
 ImageSize -> Large, PlotLegends -> Automatic, 
 FrameTicks -> Automatic, 
 PlotLabel -> "?????? Marmousi \n ?????? ????????? ?????????? ????"]

enter image description here

Hi Christopher! I am new to Mathematical, kindly highlight the steps to follow in order to read SEGY file into Mathematical.

Thank you

Thanks for finding the bug! I fixed this. In fact, there is a small inaccuracy in the documentation. Now you can use the function ArrayPlot like this:

data = CustomImport["path/to/file.segy", "SGY"]


More examples in the file CustomImportExport.nb

Dear Anton, I am working on velocity analysis (stacking velocity) using mathematica. However, I applied my code on the traces but it did not work. Of course I know why it did not work because my data has to be in CMP. Can the customExport expository do sorting? If not could you please advice on how to sort my data into CMP. Thank you.

Posted 4 years ago

First of all you need - download repository. Second - open and evaluate Installer.nb notebook. Third -you can create your own new notebook for working and evaluate


For import file evaluate next

dataIn = CustomImport["YourFileName.sgy", "SEGY"]

You can see and analyze headers of traces

dataIn["TraceHeaders", 1;;-1, {"gx", "gy"}]

in this string we can see coordinates of geophones. In this package SeismicUnix notation of headers is used. In next string you can get the values of first trace

dataIn["Traces", 1]

You can plot data (Seismic section or Gathers) by the way Christopher showed. If you have questions - please write!

Thank you Anton, I have been able to do that successfully.

Thank you Anton. I was able to load the data successfully but the ArrayPlot did not work. Kindly highlight to me how to do the plotting after loading the SEGY data.

It was a small mistake in the documentation. Try this:

data = CustomImport["path/to/file.segy", "SGY"]


(* data["Traces"][] - returns array of numbers *)

Or you can download latest version of the package (I updated this several days ago) and code from the ExampleOfUse will be work.

Please see advanced dedicated post @Kirill Belov kindly contributed:

Working with SEGY file format for storing geophysical data

Hi people! I am trying to understand what some commands does in Mathematica but I do not understand yet. I have attached the code to this write u[. I know what each of the terms means but I need to understand what each command does. I want to know how the command will perform each function.

Thank you.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract