0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【メモ】Seismic Unix でサンプル数の大きなファイルを扱う

0
Last updated at Posted at 2021-09-09

課題

背景

サブボトムプロファイラなどで取得したデータは、他のソフトウェアでも扱えるように"seg"形式に変換することが多い("sgy"や"segy"でも同じ事になると思われる)。通常の反射法のデータと比べてトレースあたりのサンプル数 ns が多かったり、サンプリング dt がとても小さな値だったりする。

加えて、簡便なオペレーションに伴い沢山の測線を取得する事が多いので、ある程度自動的な処理にかけたい場面も多い。

トレース数の制限

SUのデフォルトのソースコードでは、どうやらトレースあたりのサンプル数が16bitの65535に制限されているようで、それより長いファイルを投入すると SU_NFLTS の値を超えたというエラーが発生することがある。特に描画系のコマンドで気づく事が多い。

ソースコードの書き換え(対症療法)

segy.h の29行目あたり SU_NFLTS の値を少し大きくしてコンパイルすると、 SU_NFLTS に関するエラーが出なくなる。

segy.h
<< #define SU_NFLTS	65535   /*   Arbitrary limit on data array size	*/
>> /*	#define SU_NFLTS	65535      Arbitrary limit on data array size */
>> #define SU_NFLTS	131070   /*   Arbitrary limit on data array size */

オリジナルファイル:

追記

2011年頃、このGoogleGroupsで既に同様の議論がされている。

GoogleGroups [Seisunix] Reading long SEGY traces

segy.h を書き換えるのは注意が必要で、どこかで型の不整合が起きるなどの問題を起こす可能性がある旨が書かれていた。そもそも上記のように SU_NFLTS だけを書き換えても、 ns フィールドは short型 で定義されているので(313-315行目)、16bitを超える数値をぶち込むとどうなるか分からないですね。それで int型 なんかに書き換えようものなら、ソースコード全体に影響が出てしまうのでこわい。

segy.h
	unsigned short ns;	/* number of samples in this trace 
			   byte# 115-116
			*/

規格通りのSEG-Yヘッダでは ns フィールドは16bitの short型 であるべきなので、正攻法はSEGYファイルの方を修正すべきとの議論もある。しかし、、、

現行の SEG-Y Rev.2.0 ではトレースあたりのサンプル数を

 2^{32} -1 個

測線あたりのトレース数は

 2^{64} -1 個

まで増やしたとの事なので、「気分としては」無限に増やして良いことになる。Seismic Unix 全体のアップデートを一人でやるのは大変なので、コミュニティで何とか新しい規格に対応して欲しいなぁとぼんやり思う。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?