入门

对于Hi-net数据的新用户,强烈建议你至少一次手动从Hi-net申请并下载数据并尝试使用 win32tools 处理数据,以确保你理解Hi-net数据申请、下载、处理的整个流程,并了解Hi-net网站设计的不友好和诸多限制。

现在开始吧。

启动Python

Run python (or ipython if you have it), and make sure you’re using Python 3.8 or above:

$ python
Python 3.11.6 | packaged by conda-forge | (main, Oct  3 2023, 10:40:35) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

创建一个客户端

HinetPy 中的类 Client 提供了多个方法帮助你获取波形数据。

>>> from HinetPy import Client
>>> client = Client("username", "password")  # use your own account.

备注

你需要一个Hi-net账户以获取Hi-net台网的波形数据。

做一些检查

doctor() 检查是否一切正常:

>>> client.doctor()
[2019-06-14 16:11:47] INFO: You're using the latest release (v0.6.3).
[2019-06-14 16:11:46] INFO: Hi-net web service is NOT updated.
[2019-06-14 16:11:47] INFO: catwin32: /home/user/bin/catwin32.
[2019-06-14 16:11:47] INFO: win2sac_32: /home/user/bin/win2sac_32.

恭喜你!你正在使用HinetPy的最新版本,且Hi-net网站在这个版本HinetPy发布之后没有再更新,这意味着HinetPy依然可以正常工作。并且,catwin32win2sac_32 在你的PATH中。一切看起来都正常。

台网代码

Hi-net网站提供了来自于多个组织或台网的地震波形数据,比如Hi-net、F-net和V-net。每个台网有唯一的台网代码。为了申请指定台网的波形数据,你必须首先知道台网代码。使用 info() 以了解更多信息。

>>> client.info()
0101   : NIED Hi-net
0103   : NIED F-net (broadband)
0103A  : NIED F-net (strong motion)
010501 : NIED V-net (Tokachidake)
010502 : NIED V-net (Tarumaesan)
...
0701   : Tokyo Metropolitan Government
0702   : Hot Spring Research Institute of Kanagawa Prefecture
0703   : Aomori Prefectural Government
0705   : Shizuoka Prefectural Government
0801   : ADEP
>>> client.info("0101")  # get more information about NIED Hi-net (0101)
== Information of Network 0101 ==
Name: NIED Hi-net
Homepage: http://www.hinet.bosai.go.jp/
Starttime: 20040401
No. of channels: 2336

现在我们知道Hi-net开始于2004-04-01,总共有2336个通道(约780个台站)。

备注

强烈建议Fnet用户使用 FnetPy 获取Fnet数据,因而HinetPy无法正确处理F-net的仪器响应。

台站

你可以调用 get_station_list() 以查看Hi-net和F-net台网的台站信息(目前仅支持查看这两个台网的台站信息)。

>>> stations = client.get_station_list("0101")
>>> for station in stations:
...     print(station)
...
0101 N.WNNH 45.4883 141.885 -159.06
0101 N.SFNH 45.3346 142.1185 -81.6
0101 N.WNWH 45.2531 141.6334 -130.6
0101 N.WNEH 45.2303 141.8806 -174.6
0101 N.SFSH 45.2163 142.2254 -96.6
...

Hi-net/F-net有很多台。如果你只需要申请其中某些台站的数据,你可以选择你需要的台站。Hi-net网站提供了一个网页界面以筛选台站,通常建议值接使用这一网页界面。如果你想要在申请的过程中动态选择台站,你可以使用 select_stations()

>>> # select only two stations of Hi-net if you know the station names
>>> client.select_stations("0101", ["N.AAKH", "N.ABNH"])
>>>
>>> # select Hi-net stations in a box region
>>> client.select_stations(
...     "0101", minlatitude=36, maxlatitude=50, minlongitude=140, maxlongitude=150
... )
>>>
>>> # select Hi-net stations in a circular region
>>> client.select_stations("0101", latitude=36, longitude=139, minradius=0, maxradius=3)
>>> # select all Hi-net stations
>>> client.select_stations("0101")