From eb71ca38cb2f85b0fdf51f5fb09e789d1d952f33 Mon Sep 17 00:00:00 2001 From: Hallgrim Ludvigsen Date: Sun, 5 May 2019 23:55:04 +0200 Subject: [PATCH] Add quick start example with plot The quick start section should show a few common usecases, and be clear in terms of usage patterns. --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d904eb0c..d1134a8f2 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,31 @@ start your favourite Python interpreter and type `help(segyio)`, which should integrate well with IDLE, pycharm and other Python tools. ### Quick start ### + +Two examples on how to use segyio: + +Integrate with numpy to filter for a given treshold value ```python import segyio import numpy as np +threshold = 1e-2 with segyio.open('file.sgy') as f: for trace in f.trace: - filtered = trace[np.where(trace < 1e-2)] + filtered = trace[np.where(trace < threshold)] +``` + +Visualize the first inline slice in a seismic volume: + +```python +import segyio +import matplotlib.pyplot as plt + +filename = 'file.sgy' +with segyio.open(filename) as f: + inline_number = f.ilines[0] + inline_slice = f.iline[inline_number] + plt.imshow(inline_slice.T) + plt.show() ``` See the [examples](#examples) for more.