striplog について
striplogは、岩相などの地質データを深度区間として扱うPythonライブラリです。地質・検層のワークフロー向けに、検索、統計、描画、構造化ログの出力を行えます。
主な機能
- 01CSVやテキストからログを作成
- 02深度区間の検索と切り出し
- 03ネット・グロス比の計算
- 04検層ログの描画と対比
- 05CSV、LAS、JSONへの出力
活用シーン
- 01坑井データから岩相ログを作成
- 02複数坑井の区間を比較
- 03岩相ごとの割合を計算
- 04後続分析向けにログを出力
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ steadfastasart/ geoscience-skills --skill striplogインストール後、Claude Code で/striplogを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
references/components.mdlexicon.mdscripts/create_striplog.py詳細
striplog - 岩相ログ
クイックリファレンス
from striplog import Striplog, Interval, Component
# Create from intervals
intervals = [
Interval(top=0, base=10, components=[Component({'lithology': 'sandstone'})]),
Interval(top=10, base=25, components=[Component({'lithology': 'shale'})]),
Interval(top=25, base=40, components=[Component({'lithology': 'limestone'})]),
]
strip = Striplog(intervals)
# Load from file
strip = Striplog.from_csv('lithology.csv') # Columns: top, base, lithology
# Access and display
print(strip)
strip.plot()
df = strip.to_dataframe()
主要なクラス
| クラス | 用途 |
|---|---|
Striplog | メインのログコンテナ。区間を保持します |
Interval | 上端、下端、構成要素を持つ深度区間 |
Component | プロパティを持つ岩石タイプの定義 |
Lexicon | 同義語を含む岩石タイプ辞書 |
Legend | 可視化のスタイル(色、パターン) |
基本操作
CSVから作成
# CSV format: top,base,lithology
strip = Striplog.from_csv('lithology.csv')
strip.plot()
説明テキストから作成
from striplog import Striplog, Lexicon
description = """
0.0 - 5.5 m: Fine to medium sandstone
5.5 - 12.0 m: Grey shale with silt laminations
12.0 - 18.5 m: Massive limestone, fossiliferous
"""
strip = Striplog.from_description(description, lexicon=lexicon)
クエリと抽出
# Get interval at depth
interval = strip.read_at(z=15)
print(interval.primary.lithology)
# Crop to depth range
subset = strip.crop((10, 30))
# Unique lithologies
lithologies = strip.unique('lithology')
統計
# Net-to-gross for specific lithology
ntg = strip.net_to_gross(pattern={'lithology': 'sandstone'})
print(f"Sandstone: {ntg * 100:.1f}%")
# Merge adjacent same-lithology intervals
merged = strip.merge_neighbours()
坑井の対比
import matplotlib.pyplot as plt
wells = [Striplog.from_csv(f'well{i}.csv') for i in range(1, 4)]
fig, axes = plt.subplots(1, 3, figsize=(10, 8), sharey=True)
for ax, well, name in zip(axes, wells, ['Well 1', 'Well 2', 'Well 3']):
well.plot(ax=ax, legend=legend)
ax.set_title(name)
plt.tight_layout()
plt.savefig('correlation.png')
エクスポート
strip.to_csv('output.csv')
strip.to_las('output.las')
strip.to_json('output.json')
df = strip.to_dataframe()
ハッチングパターン
| パターン | コード | 典型的な用途 |
|---|---|---|
| ドット | ... | 砂岩 |
| ダッシュ | --- | 頁岩 |
| プラス | +++ | 石灰岩 |
| X | xxx | ドロマイト |
| V | vvv | 火山岩 |
代替ツールとの使い分け
| ツール | 最適な用途 |
|---|---|
| striplog | 構造化された岩相ログ、区間ベースのデータ、NTG、対比 |
| welly | 坑井ログ曲線(連続データ)、複数坑井のプロジェクト |
| custom matplotlib | 区間ロジックを必要としない、単純な単発の層序柱状図 |
striplogを使う場合は、クエリ、統計、対比が可能な構造化オブジェクトとして、地質区間(岩相、 堆積相)を表現する必要があるときです。
代わりにwellyを使う場合は、連続的な坑井ログ曲線(GR、RHOB)を扱うときです。 wellyとstriplogは相互に補完するもので、曲線にはwelly、岩相区間にはstriplogを使います。
代わりにcustom matplotlibを使う場合は、区間のクエリやネット・トゥ・グロスの計算が不要な、 単純な単発の層序柱状図を作成するときです。
よくあるワークフロー
CSVデータから岩相ログを作成する
- [ ] Prepare CSV with columns: top, base, lithology (optionally color)
- [ ] Load with `Striplog.from_csv('lithology.csv')`
- [ ] Define Legend with colors and hatch patterns for each lithology
- [ ] Verify intervals: check for gaps or overlaps
- [ ] Merge adjacent same-lithology intervals with `merge_neighbours()`
- [ ] Compute statistics: `net_to_gross()`, `unique()`
- [ ] Plot with legend and export to desired format
よくある問題
| 問題 | 解決策 |
|---|---|
| テキストを解析できない | 同義語を含むLexiconを定義します |
| 色が違う | Decorオブジェクトを使ってカスタムLegendを作成します |
| ログに隙間がある | 区間の上端と下端の値が一致しているか確認します |
| プロットがおかしい | 深度の方向(下に向かって増加)を確認します |
参考資料
- Lexiconの設定 - 岩石タイプ辞書と同義語
- Componentの定義 - プロパティと複数属性の区間
スクリプト
- scripts/create_striplog.py - CSVまたはテキストデータからstriplogを作成します
コメント
Markdown 対応