ymaeda_opentoolsの目的別ガイド

地震データの基本的な処理

(Guide of ymaeda_opentools by purposes: Basic treatments of seismic data)


◆はじめに (Introduction)

ymaeda_opentoolsは火山地域における地震波形データの解析を主な用途として 開発したものです。 そのため地震データの基本的な解析を行うツールが揃っています。
The package ymaeda_opentools has been developed for the analyses of seismic waveform data in volcanic regions. Therefore it consists of tools for basic seismic data analyses.

但し、ymaeda_opentoolsにはグラフィカルな機能はありません。 そのため例えば
といった処理には別のソフトウェアを用いる必要があります。 ymaeda_opentoolsの多くのツールでは データファイルから数値データを読み込み、解析を行い、 結果を別のデータファイルとして出力します。
However, ymaeda_opentools does not include graphical data analyses; for example, These works have to be done by other softwares. Most tools of ymaeda_opentools read numerical data from a data file, perform an analysis, and output the result as another data file.

グラフィカルな処理を行うためのソフトウェアとして、特に以下の3つを推奨します。
The following three softwares are recommended for the graphical processings.


ymaeda_opentoolsでは(win_dataサブパッケージのrun_winコマンドを除いて) これらのソフトウェアとの依存関係はありません。 したがってこれらのソフトウェアをインストールしなくとも ymaeda_opentoolsを単体で動かすことは可能ですが、 ymaeda_opentoolsに渡す入力データの準備や 出力された解析結果の確認が困難になります。
There is no dependency between these softwares and ymaeda_opentools, except for run_win command in win_data sub package. Therefore ymaeda_opentools can be used standalone; however, without these softwares, preparation of the input data for ymaeda_opentools and checking the results would be difficult.

以下、ymaeda_opentoolsを用いて出来ることをいくつか紹介します。
Below, some of the data analyses that can be done by ymaeda_opentools are introduced.


◆データ形式を変換する (Converting data formats)

地震波形データの代表的なファイル形式にWIN形式とSAC形式があります。 また、地震波形データはサンプル時刻と振幅値の組合せですので テキストファイルで表現することもできます。 ymaeda_opentoolsを用いると地震波形データを WIN形式からSAC形式に、更にテキストファイルに簡単に変換できます。 逆にテキストファイルをSAC形式に変換することもできます。 これには以下のコマンドを使用します。
The WIN and SAC formats are widely used file formats of seismic waveform data. The data can also be expressed in a text file, as the data is composed of sample times and amplitudes. Using ymaeda_opentools, Seismic waveform data can easily be converted from the WIN to SAC format, and further to a text file. A reversed conversion from a text file to the SAC is also supported. These conversions are available using the following commands.

コマンド名
Command name
コマンドが入っているサブパッケージ
The sub package which the command belongs to
機能
Role
wintosac win_data WIN形式の地震波形データをSAC形式に変換する。
Convert a seismic waveform data from the WIN to SAC format.
sac_timeseq2sequence sac_data SAC形式の地震波形データをテキストファイルに変換する。
Convert a seismic waveform data from the SAC format to a text file.
sequence2sac_timeseq sac_data テキストファイルに書かれた地震波形データをSAC形式に変換する。
Convert a seismic waveform data from a text file to the SAC format.

海外の地震波形データはWINではなくminiSEED形式で記録される場合が多いです。 ymaeda_opentoolsにはminiSEEDをSACに直接変換するツールはありません。 しかし mseed2sac という無償のソフトウェアが公開されていますので、 miniSEEDファイルからSACファイルへの変換自体はあまり問題にはならないと思います。 問題はその先の処理です。 というのはminiSEEDファイルでは時間の区切りが不規則なため 変換後のSACファイルも不規則な時間区切りになってしまい、 このままでは解析に使用しにくいです。 そこでymaeda_opentoolsの出番です。ymaeda_opentoolsの sacfiles_irregular2regularコマンド を用いると不規則な時間区切りのSACファイルを 例えば1時間区切りや1日区切りなどの規則的な区切りに直すことができます。
Outside Japan, miniSEED is more widely used than WIN format. The ymaeda_opentools does not provide a conversion tool from miniSEED to SAC. However, this conversion is not a problem because an open-source software mseed2sac is available. The problem is after the conversion; the miniSEED files, and thus the converted SAC files, are separated irregularly with time, which makes analysis complicated. The sacfiles_irregular2regular command of ymaeda_opentools solves this problem, as it merges and re-divides the irregularly divided SAC files into regular divisions, for example hourly or daily data.


◆WINシステムを用いたデータ解析の補助ツール (Tools to support data analyses by the WIN system)

ymaeda_opentoolsの win_dataサブパッケージ にはWINシステムを使った地震解析をサポートするための 3つのツールを用意してあります。 それらを紹介します。
Three tools that support the seismic analysis by the WIN system are available in the win_data sub package of ymaeda_opentools, which are introduced below.

●波形を簡単に表示する
(Easily displaying the waveforms)

WINファイルに収録されている地震波形はWINシステムを用いて表示できますが、 これには多数のパラメータを前もって設定しなければなりません。 例えば震源決定を目的とせず「単に波形を見たい」だけであっても 震源決定に使用する速度構造や地震検知のための観測点のゾーン分けなどの設定ファイルを 用意しなければなりません。 このことは初学者がWINシステムを初めて使う場合や、 経験者であっても新しい地域で始めた観測の波形を手早く確認したい場合に ハードルとなります。
The seismic waveforms recorded in a WIN file can be displayed by the WIN system; however, numerous parameters have to be configured first before looking at the waveforms. For example, configuration files for the velocity structure used to determine the hypocenters of earthquakes or a list of station zones used to detect earthquakes must be prepared even if you just want to look at waveforms. This requirement makes the WIN system not easy to use by beginners; even for experienced researchers, it takes some time to just check the waveforms from new observation fields.

ymaeda_opentoolsの run_winコマンド を用いると、より簡単にWINを起動できます。 このコマンドではダミーのパラメータファイルを自動生成して WINシステムを起動します。 これにより、パラメータの設定をスキップして 波形をすぐに表示することができます。
The WIN system can more easily be started using the run_win command of ymaeda_opentools; it automatically creates dammy parameter files and starts the WIN system. By this, users can skip the parameter configurations and immediately display the waveforms.

●チャネル表を簡単に取り扱う
(Easily treat channel tables)

WINシステムでは観測点情報を別ファイル(チャネル表)で管理します。 チャネル表には情報の有効期間を入れる欄が無いため、 地震計やデータロガーの交換等によっていずれか1つのチャネルの情報が変わるたびに チャネル表ファイルを丸ごと別のファイルに差し替えなければなりません。 その結果、期間毎に区切ったチャネル表ファイルを大量に作成する必要が生じます。 大量のファイルは間違いが見つかった場合の修正も、 また長期間のデータ解析のために場合分けして用いるにも大変です。
In the WIN system, station information is maintained by a separate file called a channel table. Because the channel table does not consist of a space to input the valid period for each information, the entire channel table file must be replaced by another file even if the information for only one channel has changed due to the replacement of a seismometer or a data logger. As a result, numerous channel table files separated by valid periods are created. The numerous files are not easy to correct if a mistake was found, and not easy to use for data analysis of long time period as it requires many branches.

ymaeda_opentoolsを用いると、各行の有効期間を付記した 独自の拡張形式のチャネル表ファイル により全期間の観測点情報を管理できます。 ファイルは1つで済むので間違いの修正や呼び出しが容易です。 この拡張形式のチャネル表ファイルはWINシステムで直接扱うことはできませんが、 ymaeda_opentoolsの selectChannelTable_timeコマンド により、指定した日時に有効な行を抜き出して WINシステムで扱える形式に変換できます。
Using ymaeda_opentools, the station information for all period can be maintained by a channel table file of an extended format that consists of the valid period for each line. The correction and use of this file is easy because the information for all period is in a single file. This file cannot directly be treated by the WIN system; however, the selectChannelTable_time command of ymaeda_opentools realizes extraction of the information valid at a specified date and time and conversion to a channel table file compatible to the WIN system.

チャネル表ファイルでは1行に1つのチャネル(観測点・成分組合せ)を記載する一方、 観測点座標は1観測点につき1つだけ書けば良い仕様になっています。 その結果、座標が書かれている行と書かれていない行が混在し、 観測点座標を取り出して処理するループ処理のスクリプトが煩雑になります。 ymaeda_opentoolsの fill_win_channelTableコマンド を用いると、省略された座標を補完したチャネル表ファイルを簡単に作成できます。 このチャネル表を用いれば例えばbashで
fill_win_channelTable channels.tbl channels.tbl.filled
for station in NU.STN1 NU.STN2 NU.STN3 NU.STN4 NU.STN5
do
    lat=‘awk -v station=$station ’($4==station && $5~/U$/){ print $14 }’     lon=‘awk -v station=$station ’($4==station && $5~/U$/){ print $15 }’ channels.tbl.filled‘
done
のような簡単な記述で多数観測点の観測点座標をまとめて取り出すことができます。 この例ではchannels.tblが元々のチャネル表で、 観測点座標がU成分の行に書かれている保証が無いためそのままではループ処理ができませんが、 fill_win_channelTableコマンドを用いてすべての行に座標が書かれたチャネル表ファイル channels.tbl.filledを作成することで緯度経度の取り出しが簡単になっています。
Each line of a channel table file consists of the settings for a channel (a combination of a station and a component), while the coordinate of the station must be written only for each station, not for each channel. As a results, lines with and without the coordinates of stations are mixed, which complicates a loop script to extract station coordinates. Using fill_win_channelTable command of ymaeda_opentools, a channel table with no omission of the coordinates can be created easily. Using this channel table, the coordinates of multiple stations can be extracted easily a bash script shown in the yellow box above. In this example, channels.tbl is the original channel table, which may not have the coordinates of all stations in the U-component lines. On the contrary, channels.tbl.filled created by fill_win_channelTable command has the coordinates in all lines, which easens the extraction of the coordinates.

●震源情報を整理する (Summarize hypocenter information)

WINシステムでは震源情報が1イベント1ファイルで出力されます。 このファイルはpickファイルと呼ばれ、「#f」から始まる最初の行に震源情報が書かれています。 しかしpickファイルの中には震源が求まっていないものもあります。 また自動震源と手動震源の区別などはpickファイル内の別の行を調べなければなりません。 更に、時刻の秒が負の値になっているもの、震源情報の区切りの空白が無いものなどもあり、 pickファイルのままではスクリプトによる集計が少々厄介です。 ymaeda_opentoolsの summarize_win_hypoコマンド を用いると、それらのファイルから震源情報を読み込んで 1つのテキストファイルに整理・出力できます。 これは地震数のカウントや震源分布図の作成など 地震活動の解析に有用です。
The WIN system outputs the hypocenter information as one file for one event. This file is called a pick file. The first line beginning with “#f” in this file gives the hypocenter information. However, summarizing the hypocenters from the pick files directly by a script is not simple because of the following reasons: not all pick files have the hypocenter information; to survey automatic and manual hypocenters, another line of the pick file must be surveyed; and some pick files may have negative values in the second of the origin times or no space between values. The summarize_win_hypo command of ymaeda_opentools gathers the hypocenter information from these pick files into a single text file. The output of this command is useful to seismicity analysis; for example, counting the number of earthquakes or creating a hypocenter map.

地震活動の調査にあたってもう1つ重要になるのが 個々の地震の震源決定に使用したP波・S波到着時刻のデータです。 WINシステムのpickファイルでは 「#s」から始まる行に「適当な基準日時」から測ったP波・S波到着時刻の観測データが、 「#f」から始まる行に到着時刻の観測値と理論値の残差が書かれています。 ymaeda_opentoolsの summarize_win_pick_infoコマンド を用いると同じ観測点におけるP波・S波到着時刻の観測値と理論値を 同じ行に並べた形式のデータを作成できます。 また、この出力ファイルでは基準日時が 地震の発生日時またはイベント波形(trg)ファイルの先頭日時になりますので 到着時刻の値自体の物理的な意味がより明確になります。
Another essential information for the survey of seismicity is the P- and S-wave arrival time data used to determine the hypocenter of each earthquake. A pick file of the WIN system consists of observed P- and S-wave arrival times measured from an “arbitrarily chosen reference time” in lines beginning with “#s”, and residuals between observed and calculated arrival times in lines beginning with “#f”. The summarize_win_pick_info command of ymaeda_opentools reformats these data to put observed and calculated P- and S-wave arrival times at each station into the same line, with the reference time being either the origin time of the earthquake or the beginning time of the event waveform (trg file) data, which makes the meaning of arrival times clearer.


◆SACを用いたデータ解析の補助ツール (Tools to support data analyses by SAC)

ymaeda_opentoolsの sac_dataサブパッケージ にはSAC形式の地震波形データを読み込んで解析を行い、 結果をSAC形式で出力するツールや情報をテキスト出力するツールを 多数用意してあります。 その中の一部を紹介します。
Many tools are available in sac_data sub package of ymaeda_opentools, which read a seismic waveform data in the SAC format, perform an analysis, and output the result as the SAC format or a text-based information. Some of these tools are introduced below.

●時刻や振幅の表示 (Displaying time or amplitude)

SACファイルはバイナリファイルなので、 そこに記録された時系列データから 具体的な時刻や振幅などの数値を取り出すのは容易ではありません。 ymaeda_opentoolsを用いると簡単に数値を取り出すことができます。
Because a SAC file is a binary file, it is not easy to extract a numerical value of interest (e.g., a time or an amplitude) from the time series data in the file. Using ymaeda_opentools, the numerical value can easily be extracted.

sacfile_getValue_givenTimeコマンド では、SACファイルに記録されている時系列データの 指定した時刻での振幅値を取り出せます。
The sacfile_getValue_givenTime command extracts the amplitude at a specified time in the time series data of a SAC file.

sacfile_findpeakコマンド では波形の山(極大値)と谷(極小値)の時刻と振幅を一覧表示できます。
The sacfile_findpeak command lists the times and amplitudes of peaks (local maxima) and troughs (local minima) of a waveform.

sacfile_finddefectコマンド では波形に含まれるデータ欠損の時刻を一覧表示できます。 SACデータには「欠損」の表現方法は存在しませんが、 欠損をダミーの0.0で埋めた結果として0.0が連続して登場することになりますので、 それを用いて欠損を検知します。
The sacfile_finddefect command displays the times of data defects in a waveform. Although there is no method to express the “defect” in the SAC data, padding the defects by dammy zeroes results in consecutive 0.0, which is used to identify the defects in this command.

●波形のベースラインの補正 (Correcting the baseline of a waveform)

SACのrmeanコマンドを用いると波形から平均振幅を差し引くことができますが、 全体の平均が差し引かれてしまいます。 大きなステップを含むイベントの解析においては イベント到着前の時刻のみの平均振幅を差し引きたい場合があります。 ymaeda_opentoolsの sacfile_remove_meanコマンド を用いると、波形から指定した時間窓での平均振幅を差し引くことができます。
Although the average amplitude of a waveform can be subtracted using the rmean command of SAC, it subtracts the average amplitude of the entire waveform. In the analysis of an event that consists of a large step, the average amplitude to be subtracted may be that before the arrival of the event. The sacfile_remove_mean command of ymaeda_opentools realizes the subtraction of the average amplitude of a waveform in a specified time window.

類似のコマンドに sacfile_remove_trend があります。 このコマンドでは指定した時間窓での線形トレンドを差し引くことができます。
A similar command is sacfile_remove_trend, which subtracts the linear trend of a waveform in a specified time window.

また sacfile_remove_medianコマンド を用いると波形の振幅の中間値を差し引くことができます。 少数の大振幅サンプルによって平均値が影響を受ける波形の場合には 平均値よりも中間値を差し引く方が良い場合があります。
The sacfile_remove_median command subtracts the median amplitude of a waveform. For a waveform that has a small number of samples of extremely large amplitudes that affect the entire average, sometimes it is better to subtract the median than the average.

●微分と積分 (Differentiation and Integration)

SACではdifコマンドやintコマンドを用いて微分・積分ができますが、 時刻が半サンプルずれてしまいます。 その結果、例えば積分した波形と元の波形の時系列データとの 四則演算ができません。
Although the waveform in a SAC file can be differentiated and integrated by dif and int commands of SAC, the time samples differ by half samples between the original and differentiated/integrated waveforms. As a result, the four arithmetic operation of the original and integrated waveforms, for example, is impossible.

ymaeda_opentoolsではサンプル時刻をずらさずに微分を行う sacfile_differentiateコマンド、 積分を行う sacfile_integralコマンド を用意しています。 これらを用いて生成した時系列データであれば四則演算が可能です。
In ymaeda_opentools, the sacfile_differentiate and sacfile_integral commands to differentiate and integrate a waveform without shifting the sample times are available. The four arithmetic operation is possible among the waveforms created by these commands and the original waveform.

●座標軸の回転 (Rotation of the coordinate axes)

水平動2成分の地震波形を元に別の方向の成分を合成できると便利な場合があります。 例えば東西成分と南北成分を合成して 噴火口から遠ざかる向き(radial)とそれに直交する向き(transverse)の 成分の波形を合成したり、 地震計の設置方位のずれを補正できます。 ymaeda_opentoolsでは sacrotateコマンド を用いてこれらの計算を行うことができます。
In some seismic waveform analyses, the two horizontal components are synthesized to create the waveforms along different directions. For example, the east-west and north-south components may be synthesized to create the waveforms along the radial and transverse directions from a volcanic crater, or a misorientation of the installation of a seismometer may be corrected. These computations are realized using the sacrotate command of ymaeda_opentools.

●時刻で分割された多数のSACファイルの連続処理 (Continuous processings of many SAC files separated by times)

地震波形データは1時間毎や1日毎など一定間隔で区切って記録される場合が多いです。 ymaeda_opentoolsではこのようなデータに対して ファイルの区切りをまたいで連続的に処理するコマンドを用意しています。 例えば
などがあります。 これらのコマンドを用いると1年分のデータであれ10年分のデータであれ、 複数ファイルに分割されたSACファイルを1つの巨大な時系列データとして処理できます。
Seismic waveform data is usually divided into multiple files, for example by each hour or day. Commands to process these data continuously across the file division are available in ymaeda_opentools: for example, sacfiles_filter_continuous command for low-pass, high-pass, and band-pass filtering and sacfiles_integral_continuous command for integration. Using these commands, the hourly or daily divided SAC files can be processed as a single huge time series data regardless of their total length.