In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import welly
welly.__version__
Out[1]:
In [2]:
from welly import Well
In [3]:
w = Well.from_las('P-129_out.LAS')
In [4]:
w.data['GR']
Out[4]:
In [5]:
w.plot()
In [6]:
w.data # Just a dict of data objects.
Out[6]:
In [7]:
from welly import Curve
In [8]:
p = {'mnemonic': 'FOO', 'run':0, }
data = [20, 30, 40, 20, 10, 0, 10]
c = Curve(data, basis=[2,3,4,5,6,7,8], params=p)
In [9]:
c.plot()
In Jupyter Notebook, the __repr__() is a little table summarizing the curve data...
In [10]:
gr = w.data['GR']
gr
Out[10]:
In [11]:
gr.read_at(168.7068)
Out[11]:
In [14]:
gr.basis
Out[14]:
In [15]:
gr[1000:1010]
Out[15]:
Curve objects are just ndarrays, so we get lots of things for free...
In [12]:
gr.describe() # Equivalent to get_stats()
Out[12]:
In [18]:
gr.get_stats()
Out[18]:
In [13]:
m = np.mean(gr)
In [15]:
m # Not really sure why this is a Curve
Out[15]:
In [16]:
gr.mnemonic
Out[16]:
In [17]:
w.data['GR_DESP'] = gr.despike(window_length=50, z=2)
w.plot(tracks = [['GR', 'GR_DESP']])
In [18]:
gr.start, gr.stop
Out[18]:
In [19]:
g = gr[1000:1020]
In [20]:
g.basis
Out[20]:
Notice that the basis is updated to match the data retrieved by the slice.
In [21]:
gr.plot(lw=0.5)
There's also an experimental 'imshow'-style 2D plot.
In [22]:
gr.plot_2d(cmap='viridis_r')
In [23]:
(200-gr).plot_2d(cmap='viridis', curve=True, lw=0.3, edgecolor='k')
plt.xlim(0,200)
Out[23]:
In [24]:
gr.step
Out[24]:
In [25]:
gr.read_at(1001)
Out[25]:
In [26]:
gr.read_at([1001, 1003, 1004])
Out[26]:
In [27]:
w.data['DESP'] = gr.despike(z=1)
w.data['DIFF'] = gr - w.data['DESP']
w.plot(tracks=['GR', 'DESP', 'DIFF'])
In [28]:
gr.to_basis(step=5).plot()
Or take out a segment of the log:
In [45]:
newb = gr.to_basis(start=1207, stop=1215)
newb.plot()
In [47]:
silly = newb.to_basis(start=1205, step=2)
silly.plot(marker='o')
In [48]:
dt = w.data['DT']
dt.to_basis_like(newb.basis).plot()
In [49]:
segment = gr.to_basis(start=600, stop=680)
In [50]:
segment.basis[-1]
Out[50]:
In [64]:
fig, axs = plt.subplots(ncols=2)
segment.plot(ax=axs[0], c='r')
segment.block(cutoffs=120, values=(0, 1)).plot(ax=axs[1])
Out[64]:
In [67]:
fig, ax = plt.subplots()
segment.plot(ax=ax)
segment.block(values=(80, 120)).plot(ax=ax)
Out[67]:
You can use a cutoff of, say, 120 API, then reassign the output values to whatever you like:
In [69]:
segment.block(cutoffs=120, values=(2.718, 3.142)).plot()
You can send a function in to determine replacement values from the original log. E.g., to replace the values with the block means:
In [77]:
fig, ax = plt.subplots()
segment.plot(ax=ax)
segment.block(cutoffs=120, function=np.mean).plot(ax=ax)
plt.axvline(120, color='c', lw=0.75)
Out[77]:
In [ ]: