Coverage for C: \ Users \ peaco \ OneDrive \ Documents \ GitHub \ mth5 \ mth5 \ io \ miniseed \ miniseed.py: 40%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-10 00:01 -0800

1# -*- coding: utf-8 -*- 

2""" 

3 

4Created on Wed Sep 30 10:20:12 2020 

5 

6:author: Jared Peacock 

7 

8:license: MIT 

9 

10""" 

11# ============================================================================= 

12# Imports 

13# ============================================================================= 

14from pathlib import Path 

15 

16from obspy import read as obspy_read 

17 

18from mth5.timeseries import RunTS 

19 

20 

21# ============================================================================= 

22# read seismic file 

23# ============================================================================= 

24def read_miniseed(fn): 

25 """ 

26 Read a miniseed file into a :class:`mth5.timeseries.RunTS` object. Uses 

27 `Obspy` to read the miniseed. 

28 

29 :param fn: full path to the miniseed file 

30 :type fn: string 

31 :return: RunTS object 

32 :rtype: :class:`mth5.timeseries.RunTS` 

33 

34 """ 

35 

36 # obspy does not use Path objects for file names 

37 if isinstance(fn, Path): 

38 fn = fn.as_posix() 

39 obs_stream = obspy_read(fn) 

40 run_obj = RunTS() 

41 run_obj.from_obspy_stream(obs_stream) 

42 

43 return run_obj