Matlab codes to read and write miniSEED files
François Beauducel (2021). RDMSEED and MKMSEED: Read and write miniSEED files (https://github.com/IPGP/mseed-matlab), GitHub. Retrieved .
Dear François Beauducel,
Thank you for the code. It is very helpful for me who is not familiar with the seismic file able to see the data. I have one question, it seems the time conversion seems a bit off. The day is correct, but the the hh:mm:ss seems a bit off, I have 1010 data points in a day, somehow all data are in seconds from 0 to 20, (00:00:00 to 00:00:20) rather than evenly occupy 24hours. Thank you
Dear François Beauducel
Hello, thank you very much for the code. It is a life savior. Sadly, I'm unable to have a reading successfully. Every time I run the code, I get many warnings and MATLAB freezes. I'm trying to read a mseed file with data from 64-channels CUSP-Me accelerometers in the 3 dimensions.
The output of rdmseed is a structure of original data blocks, as recorded in the miniseed file. You seems to have 350 data records, each contains generally a maximum of 4096 samples (depends on your file and the compression type), that is a 100 or 125 Hz sampling rate for 1 h data... right? To produce a vector of data samples, you must concatenate data record for each channel. As your file has 3 components, you can follow what is explained in the doc:
[X,I] = rdmseed(f);
c = length(I); % number of channels
for n = 1:c
k = I(n).XBlockIndex; % indexes of data blocks for channel n
Hi. I have a question on usage: When I run rdmseed from the command line, I get the GUI, choose a file, and I get a gorgeous plot of my one-hour-long, three component data. Works great! However.....
I need a matlab variable of the data. When I try
a.t is the time and a.d is the data.
They are only ~350 samples each. Am I missing something?
can you share your file wiith me please?
Dear François Beauducel
Thank you for your comment. But, I'm receiving the wrong calculations. In the previous version of rdmseed.m was not any problem.
Dear Sagynbek Orunbaev,
You can ignore this warning. It tells the data file does not strictly respect the SEED encoding standard, i.e., the checksum of each data block. It might be simply a carelessness of the digitizer manufacturer.
When I use rdmseed.m I'm receiving a warning like "Warning: Problem in STEIM1 sequence # 002556 [2015-154 07:22:01.7700]: data integrity check failed"
Works well on Raspberry Shake data. It is slower than ReadMSEEDFast, but accurately presents the time, whereas ReadMSEEDFast truncates the seconds.
Thanks for the nice code! Is there an easy way to write all components (NEZ) to one mseed file? Thank you, JW
SEED standard recommends big-endian encoding. I might add an option to set little-endian...
Does 'mkmseed" work for little-endian byte ordering? Do I need to edit the code to make it work on PCs? Thanks.
Thank you so much Beaudecel for the help and this program.
Just a reminder that miniseed data are always rawdata, mostly with count unit. There is 2 ways to convert the data to physical unit :
1. apply the full instrumental response (will correct most of the sensor frequency weakness);
2. apply only the sensitivity factor (supposes a flat response of the sensor).
First solution needs the complete description of instrument and digitizer, including possible digital filters. This is usually described in the metadata as the "dataless" file. I have not implemented this function yet in Matlab; best way is to use sac software to do so.
Second solution is easier. You just have to find the sensitivity factor in count/(m/s2) or count/g and divide your data D.d by this factor. Look at the sensor specifications / datasheet. If you don't find it you might compute an approximation by dividing the digitizer dynamic range (e.g. 24 bits) by the acceleration range of the instrument (e.g., ± 2 g), that is 2^24/4 = 4194304 count/g.
Can we change seed data (counts) into g or m/sec2 against time step?? Anyone help me
If you get most of your data ok after reading, it means that some data records in your data file have problems, usually due to the digitizer itself during the recording. But if no data came out at all, it probably means you don't use the correct format, endianness or encoding.
Hope this helps.
Hello, Thank you for your code.
But, when I read a miniSEED file, there are warnings "Data Integrity check failure ~~ ".
Could you let me know what is problem ?
After importing the miniseed files, just export the matrix in a .txt file... for multiplexed files, please read the doc. For simple one-channel file, do for example:
How could I get the time series (eg in .txt file) from this code?
I am working on a faster version... wait for few weeks the new version !
This program really works fine. However, it is a bit slow when reading in miniSEED day files with 100 or 200 Hz sampling rate. Is there any way to speed it up?
I can't download it. Can you send it to my mailbox? My mailbox is firstname.lastname@example.org,Thanks very much。
Thank you so much for this, it helps a lot.
Just a quick question: Is there a way I can convert the plotted data into a table, like in CSV format? Thank you!
Thanks a lot, this is important program
Great work! I'm wondering the unit of output data (say X.d)? Counts or ??
Hi there, the rdmseed program I have works great! Does anyone know how to get it to read a SEED Volume file?
Thank you, this is a very useful tool.
Sorry I forget to say thank you to your answer, I have follow you suggestion and it work perfect, it is a very powerful tool!
Wonderful tool to red mseed or seed files.
The output's options ar so great and efficients.
Thank you Dr. Beaudecel.
Yes, the Steim encoding is only for integer values (counts), usually it is used to store raw data like digitizer outputs.
In your case you have 2 solutions:
A. use another encoding adapted to floating point numbers (like IEEE float32 or float64), without compression. But some miniseed readers might not read it...
B. or as you suggest, multiply your data by a coefficient, for instance 1e6, so you will have a 1 µV resolution.
I would like to use this program to generate mseed files with Steim1/2 encoding, but my sensor provides me +/-500mv value so when the mkmseed function cast D to int32, I have only -1,0 or 1. Is there a coefficient to apply when you want to work with steim 1/2?
Hi Guys, I am looking for a function to read seed files contains a large number of earthquake stations, any one can help me???
Thank you François Beauducel.
The best way to convert miniseed to SAC is outside Matlab using the IRIS tool mseed2sac: https://seiscode.iris.washington.edu/projects/mseed2sac
which works for Windows/Linux/Mac.
Install this code and from Matlab, call it using the system() function.
i want to convert mseed to sac in matlab. can every body help me plz
I am sorry, it is my bad. I just realize that it is not same value. it is date vector / datenum. Thank you very much.
The time vector is in datenum Matlab format (see datenum for description). You must apply the command:
after plotting the data to have time labels (see datetick function).
Hi. Very good work. I've tried with my file and it was plotted very good. But I encounter problem here. The x-axis in the figure show the right label, but in the time vector variable show N-sample by 1 matrix with the same value which is 7.4e5. I try another encoding format but still the same. Do you have any suggestion? Thank you very much.
The problem detected by Robert is solved. Number of plotted channels in multiplexed files is now limited to 20 subplots, with a warning message. For larger number of channels, please use the functional form [X,I]=rdmseed(...) to load and plot what you want (see help).
Hello, when running the a miniSEED file from the NCEDC, I recieve the error "Error using cat. Dimensions of matrices being concatenated are not consistent" (Line 284) Does anyone have any advice or help to offer? Thanks!
works intuitively for the first run. thanks.
Extremely useful and very fast. An essential tool!
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!