Skip to main content

Analyzing MiniSEED seismic data in MATLAB

For details on the usage, visit the earthinversion post: https://www.earthinversion.com/utilities/converting-mseed-data-to-mat-and-analyzing-in-matlab/

Output data structure

  • stats contains all the meta data information corresponding to each trace, and
  • data contain the time series data
mat_file.mat -> stats, data
stats -> stats_0, stats_1, ...
data -> data_0, data_1, ...

Usage

from miniseed2mat.miniseed2mat import convertmseed2mat
mseedfile = "myStream.mseed"
convertmseed2mat(mseedfile, output_mat=None)

Read mat file in MATLAB

clear; close all; clc;

wdir='./';

fileloc0=[wdir,'myStream'];
fileloc_ext = '.mat';
fileloc = [fileloc0 fileloc_ext];

if exist(fileloc,'file')
    disp(['File exists ', fileloc]);
    load(fileloc);
    
    all_stats = fieldnames(stats);
    all_data = fieldnames(data);
    
        
%     for id=1:length(fieldnames(data))
    for id=1
        stats_0 = stats.(all_stats{id});
        data_0 = data.(all_data{id});

        sampling_rate = getfield(stats_0,'sampling_rate');
        delta = getfield(stats_0,'delta');
        starttime = getfield(stats_0,'starttime');
        endtime = getfield(stats_0,'endtime');
        t1 = datetime(starttime,'InputFormat',"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        t2 = datetime(endtime,'InputFormat',"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        datetime_array = t1:seconds(delta):t2;

        %% plot time series
        fig = figure('Renderer', 'painters', 'Position', [100 100 1000 400], 'color','w');
        plot(t1:seconds(delta):t2, data_0, 'k-')
        title([getfield(stats_0,'network'),'-', getfield(stats_0,'station'), '-', getfield(stats_0,'channel')])
        axis tight;
        print(fig,['./',fileloc0, '_ts', num2str(id),'.jpg'],'-djpeg')

%         close all;
    end
end

Output Waveforms

Release files for miniseed2mat 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miniseed2mat 0.1.7
File Size Uploaded
miniseed2mat-0.1.7.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for miniseed2mat 0.1.7
File Interpreter ABI Platform
miniseed2mat-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 kB

Release files / miniseed2mat-0.1.7.tar.gz

Download URL miniseed2mat-0.1.7.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b9c6484303064ecd598c58695f9c1afaa00232de64a47611653d11d1658199e2
BLAKE2b-256 checksum
How to use checksums
6e1b707136ced164d344a7727dd7ce66e8a4dc344c3b009a7ba8e082c6bfb0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.5 Darwin/21.2.0

Release files / miniseed2mat-0.1.7-py3-none-any.whl

Download URL miniseed2mat-0.1.7-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d710c7a8c78aaebd15a65ba1d5e89074e93c4091f38c9b0fef9ce9445899bbf
BLAKE2b-256 checksum
How to use checksums
35837e74fe90f70445482e0db55b3c64015c9c57899a2076466f6edb1aedb153
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.5 Darwin/21.2.0

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page