Skip to main content

pyGDST

转换中科深源仪器产生的BIN文件为SAC,H5文件的工具包,支持1C/3C/4C仪器

A toolkit to read and convert seismic data of GDST (https://www.geodeepsensing.com/) sensors to H5 and SAC file format

依赖(Dependencies)

  • glob
  • numpy
  • obspy
  • h5py
  • tqdm

读取GDST仪器二进制文件 (Reading)

eg:

from pygdst import read_bin

dt = 0.002# sampling interval, s
file_header, data, block_headers = read_bin('./P320LINE/A0000102/24052808.BIN', dt=dt*1000)
# file_header : 512 x int32
# data        : recording of 1h
# block_headers : 每500个采样点的数据块头文件

转换单一仪器的文件为h5文件 (Convert recordings of a sensor to .H5)

eg:

from pygdst import bins2h5

dt = 0.002# sampling interval, s

bin_files = glob.glob(f'./P320LINE/A0000102/*.BIN')
new_file = './test.h5'
bins2h5(bin_files, new_file, dt=dt)

'''
f.create_dataset('data', data=data)
f.create_dataset('headers', data=headers)
f.create_dataset('Times',data=t_all)
f.create_dataset('dt',data=dt)
f.create_dataset('N_hours',data=nh)
f.create_dataset('chns',data=CHN_DEF[nc])
f.create_dataset('raw_files',data=np.array(bins_file, dtype='S'))
'''

将一天的记录转换为h5文件 (Convert recordings of all sensors in a day to .H5)

eg:

from pygdst import bins2h5

dt = 0.002# sampling interval, s

bins2h5_day('./root', './out/test_240620.h5', date='240620', header_file_pattern='./out/{name}_{date}.csv')

'''
把所有台站同一天的文件转成一个统一格式的,大H5文件

    './root': 原始文件根目录
    './out/test_240620.h5'    : 生成的h5文件名
    
    date       : 指定日期
    header_file_pattern: 头文件信息的写入位置, eg: 'path/{date}_{name}.csv'
    
    N_CHN      : 通道数
    dt         : 采样间隔, 单位ms, 
    DOWNSAMPLE_RATE:降采样率, 整数
    PATH_MARKER: 路径分割符号
    sn2name    : 仪器号转名称
'''

转换文件为sac文件 (Convert to .sac)

eg:

from pygdst import bins2sac

dt = 0.002# sampling interval, s
DW = 5 # 降采样5倍到0.01s采样

# files in a day
bin_files_aday = glob.glob(f'./P320LINE/A0000102/240528*.BIN')
sac_file = './test.sac'

bins2sac(bin_files_aday,sac_file,dt=dt, name='my_stat_name', DOWNSAMPLE_RATE=DW)

测试 test

eg:

from pygdst import test

test()

Release files for pygdst 0.1.2

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

Built distribution (wheel)

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

Release files / pygdst-0.1.2-py3-none-any.whl

Download URL pygdst-0.1.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d728a99c3ed3b1e1eb9a09d0db545b524942d68b5f58c6f70dd281787ce9111d
BLAKE2b-256 checksum
How to use checksums
9989b0baf8cb24d80ec94ec594fb3aa6f38ce6aa08f01362b6b243a8abcbe5d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

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