5.0

5.0 | 7 ratings Rate this file 84 Downloads (last 30 days) File Size: 16.7 KB File ID: #28803
image thumbnail

Read and write multiplexed miniSEED file

by

 

23 Sep 2010 (Updated )

Imports and exports data files in seismological format "mini-SEED"

| Watch this File

File Information
Description

The Standard for the Exchange of Earthquake Data (SEED) is an international standard format for the exchange of digital seismological data. SEED was designed for use by the earthquake research community, primarily for the exchange between institutions of unprocessed earth motion data. It is a format for digital data measured at one point in space and at equal intervals of time. The SEED format consists of Volume Control Headers, Abbreviation Control Headers, Station Control Headers, Time Span Control Headers and finally Data Records. In complement to “Dataless” SEED volumes, exists the “Data-only” volume called Mini-SEED (see http://www.iris.edu for further information).
The purpose of these functions is to read and write miniSEED data files directly from Matlab, avoiding intermediate format conversion (like SAC or other formats for which many functions exist), having a full control on headers and formats.
rdmseed: reading miniSEED file
Each data record is imported into a structure array, allowing to adress data blocks and header fields individually (useful for multi-channel files), just as concatenating all data with a simple cat(1,X.d) function. Time stamps are also converted into Matlab datenum format. The function reads miniSEED "data-only" using the two mostly used compression formats Steim-1 and Steim-2. General FDSN formats have also been implemented (ASCII, 16/24/32-bit integers, IEEE floats and doubles), and GEOSCOPE multiplexed old formats (24-bit, 16/3 or 16/4-bit gain ranged). All these formats should work but some of them have not been tested using real data. I also partly coded Steim-3 format but without a clear description and any file example... Since I never met any data file using this format, I don't know if it's really useful.
The function detects also automatically big/little-endian coded files.
Known Blockettes are 1000, 1001, 100, 500 and 2000. If there is no Blockette 1000 (which is mandatory in SEED format...), default 4096-byte record length, big-endian and Steim-1 compression are used. These values can be set using additional arguments.

Using extra output argument, some analysis can be done on the data stream (detection of gaps and overlaps), and channel components are detected. Without any output arguments, or with an additionnal 'plot' input argument, the function plots the imported data in a new figure (works also in case of multi-channel file).

Steim-1/2 compression decoding strategy has been deeply optimized for Matlab. The proposed method, as vectorized as possible, is about 30 times faster than a 'C-like' loops coding... which is still 10 times slower than the same C-compiled program, but, well, this is the Matlab's other side of the coin!

mkmseed: writing miniSEED file

The function allows to export a data vector D to miniSEED file, giving origin date and time (for monotonic data) and sampling rate, or a time vector. Header information is specified using the filename string with conventional naming "Network.Station.Location.Channel". Output file names will have appended ".Year.Day" and multiple file may be produced if data exceed a day.

Data encoding format can be specified (16/32-bit integers, IEEE float/double, Steim-1/2, Geoscope 16/3-4). If not, it will depend on the class of variable D. Binary file is big-endian coded, and default record length is 4096 bytes (this may be changed using input argument).

Type "doc rdmseed" or "doc mkmseed" for detailed usage.

Acknowledgements

This file inspired Read Mseed Fast.M.

Required Products MATLAB
MATLAB release MATLAB 8.3 (R2014a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
29 Aug 2014 Dicky

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.

29 Aug 2014 François Beauducel

Thanks Dicky,
The time vector is in datenum Matlab format (see datenum for description). You must apply the command:

datetick('x')

after plotting the data to have time labels (see datetick function).

29 Aug 2014 Dicky

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.

31 May 2014 François Beauducel

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).

30 May 2014 Robert Chase

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!

24 Dec 2012 Natalya  
30 Nov 2011 Petr Kolar

works intuitively for the first run. thanks.

27 Oct 2011 Jonathan Berger  
19 Jul 2011 Del Bohnenstiehl  
22 Nov 2010 Dupont Aurelien

Extremely useful and very fast. An essential tool!

05 Oct 2010 Forrest Brett  
Updates
04 Oct 2010

- add input formats for GEOSCOPE multiplexed old data files
- additional output argument with gap and overlap analysis
- create a plot when no output argument are specified
- optimize script coding (30 times faster STEIM decoding!)

22 Jul 2011

- Validation of ASCII encoding format (logs)
- Blockettes are now stored in substructures below a single field X.BLOCKETTES
- Add import of blockettes 500 and 2000
- Accept multi-channel files with various data coding

20 Oct 2011

Complementary function mkmseed.m allowing to write mini-SEED file.

25 Oct 2011

mkmseed: add Steim-1 and Steim-2 encoding formats.

23 Apr 2012

Correction of a bug with little-endian file coding and Steim-1/2 data encoding.

26 Dec 2012

adds a verbose mode (option)

25 Oct 2013

- fix warning problem in R2013b (bitcmp)
- better header test to guess big/little-endian coding
- adds option 'be' to force big-endian read

17 Mar 2014

- Improved endianness automatic detection (see comments).
- Accepts mixed little/big endian encoding in a single file.
- minor fixes.

07 May 2014

rdmseed:
 - applies the time correction to X.t (if needed)
 - Geoscope 16/4 format passed real data archive tests

mkmseed:
 - accepts time vector T and detects data blocks (gaps and overlaps)
 - adds GEOSCOPE 16/3-4 bit gain ranged coding

09 May 2014

fix a bug in time correction reading

02 Jun 2014

RDMSEED:
- applies the time correction to StartTime (if needed)
- new option to disable time correction
- fixes a problem when plotting multiplexed channels (thanks to Robert Chase)

01 Jul 2014

fixes 24-bit uncompressed format reading.

Contact us