Script reads MSEED file and returns record structure.
Whole MSEED file is loaded to memory and
the file is processed in memory.
Loops are vectorised as much as possible. This version is optimalized for speed and supports only subset of MSEED format.
Chunks in traces are assumed to be saved chronologicaly. Interlaced traces are not supported. All traces in the file are assumed to have just one encoding type. Usage of more than one encoding format in the file is not supported yet. Only DATAONLY blockett is supported yet.
Supported data encoding formats:
big endian, little endian
INT16, INT32, FLOAT32, DOUBLE, STEIM1,
Code is partially based on rdmmseed.m by
Franois Beauducel <firstname.lastname@example.org>
Institut de Physique du Globe de Paris.
Martin Mityska (2019). ReadMSEEDFast (https://www.mathworks.com/matlabcentral/fileexchange/46532-readmseedfast), MATLAB Central File Exchange. Retrieved .
Please let me know if you find any problems with the script (I don't check this site regularly). MSeed data can be quite versatile and your report can help to improve the code. (There is my email address in the profile.). Thanks, Martin.
Thank your for the code.
however i have 2 questions:
- Why opening the same seed file with rdmseed.m and ReadMSEEDFast.m does not give the same number of samples
datardmseed = cat(1,DAT(:).d);
dataFast = DATAFast.data;
See diff here:
- and I would like to recover the time vector but matlabTimeVector: [ ] is empty.
Thank you for any help
Replace lines 420-425 with the following memory pre-allocation optimization:
trace = zeros(length(find(~isnan(blockMatrix))),1);
timeVector = zeros(length(find(~isnan(blockMatrix))),1);
column = blockMatrix(~isnan(blockMatrix(:,i)),i);
column = cumsum([x0(i);column(2:numel(column))]);
timeVector(trn:trn+size(column,1)-1,1)=[mdate(i) + (0:(numel(column)-1))'./(double(sampleRateChunks(i)).*86400)];
trace(trn:trn+size(column,1)-1,1) = column;
then change the function's name to ReadMSEEDSuperFast :D
Very useful when you have gaps in the series
Thanks for all
Thanks for your contribution. Works very fast.
The idea is good.
you want to insert processing cases when the value of "sameChannelRows" empty
Bug fixed - the first blockett sequence number does not start with no 1 for some MSEED files. The first part of the record was missing in that case. Decoding is then started from the 1st blockett in the file.
Accidentally, the version for older Matlab was published. Corrected now - this is a version for Matlab R2014 and newer.
File with fixed bug loaded now.
Bug fixed - time stamps routine neglected fractions of seconds from MSEED block headers. Fractions of seconds added now.
matlabTimeVector field added.
Support for multiple logical volumes in MSEED file added.
Division changed to element-wise. Change of line 479.
Added bitcmpOld(A,N) function to mimic old funcionality of bitcmp(A,N) which is deprected now.
The former script was able to load 4096 bytes block size volumes only (recommended value according to IRIS specification). The new one fixes this issue. The block size check is peformed prior to the MSEED processing.
Inspired by: RDMSEED and MKMSEED: Read and write miniSEED files