08-17-2021 05:33 AM
I am engaged in seismic research, and my seismic waveform data is in SAC (Seismic Analysis Code) format. I am not good at file parsing, can anyone help me analyze SAC, or provide examples. VI
I want to convert SAC files into txt files. Or parse the value of the XYZ axis and the content in the header from the file.
Thanks.
Attach the file I want to parse~
----------------------------------------------------------------------------------------
Solved! Go to Solution.
08-17-2021 08:46 AM - edited 08-17-2021 08:48 AM
Hi koukileo,
@koukileo wrote:
I am engaged in seismic research, and my seismic waveform data is in SAC (Seismic Analysis Code) format. I am not good at file parsing, can anyone help me analyze SAC, or provide examples. VI
There are some links with descriptions of that file format, but your files don't fit with those descriptions (IMHO)…
This is all I got with some reasonable plots:
08-17-2021 08:53 AM
You answered your own question. Click on the Link you included to "Semantic Analysis Code", and read the section "SAC Data File Format". It tells you exactly how to write a routine (in LabVIEW) to open, parse, and structure the data in the file. Pay attention to the fact that (depending on the SAC File format) most of the Floats are Sgls, where the LabVIEW default is Dbls (but the newer SAC format has 22 variables where additional precision is required as Dbls).
It may sound like a tortuous job, but taking a well-defined (binary) file structure and writing a routine in LabVIEW to read it, parse it, and turn it into a (structured) LabVIEW dataset is not that difficult (I've done it several times). Look for "structured data" and employ TypeDefs (such as Clusters for "mixed-type Data" and Arrays for "repetetive sets of identically-structured Data").
Bob Schor
08-17-2021 09:01 AM - edited 08-17-2021 09:01 AM
08-17-2021 11:29 AM
@Bob_Schor wrote:
You answered your own question. Click on the Link you included to "Semantic Analysis Code", and read the section "SAC Data File Format". It tells you exactly how to write a routine (in LabVIEW) to open, parse, and structure the data in the file. Pay attention to the fact that (depending on the SAC File format) most of the Floats are Sgls, where the LabVIEW default is Dbls (but the newer SAC format has 22 variables where additional precision is required as Dbls).
It may sound like a tortuous job, but taking a well-defined (binary) file structure and writing a routine in LabVIEW to read it, parse it, and turn it into a (structured) LabVIEW dataset is not that difficult (I've done it several times). Look for "structured data" and employ TypeDefs (such as Clusters for "mixed-type Data" and Arrays for "repetetive sets of identically-structured Data").
Bob Schor
I'm going to say this is one of the more fun things to do in LabVIEW.