Skip to main content

Analyzing MiniSEED seismic data in MATLAB

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

miniseed2mat-0.1.7.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

miniseed2mat-0.1.7-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file miniseed2mat-0.1.7.tar.gz.

File metadata

  • Download URL: miniseed2mat-0.1.7.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.5 Darwin/21.2.0

File hashes

Hashes for miniseed2mat-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b9c6484303064ecd598c58695f9c1afaa00232de64a47611653d11d1658199e2
MD5 289338531ad6184e5e1e7506bf4f018d
BLAKE2b-256 6e1b707136ced164d344a7727dd7ce66e8a4dc344c3b009a7ba8e082c6bfb0ea

See more details on using hashes here.

File details

Details for the file miniseed2mat-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: miniseed2mat-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.5 Darwin/21.2.0

File hashes

Hashes for miniseed2mat-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6d710c7a8c78aaebd15a65ba1d5e89074e93c4091f38c9b0fef9ce9445899bbf
MD5 33f7dc0767fe5680e732fb0122011bd1
BLAKE2b-256 35837e74fe90f70445482e0db55b3c64015c9c57899a2076466f6edb1aedb153

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page