Plotting

Some preliminaries...


In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import welly
welly.__version__


Out[1]:
'0.4.4'

Load a well and add deviation and a striplog

Use the from_las() method to load a well by passing a filename as a str.

This is really just a wrapper for lasio but instantiates a Header, Curves, etc.


In [2]:
from welly import Well

In [3]:
w = Well.from_las('P-130_out.LAS')

In [4]:
w.data.keys()


Out[4]:
dict_keys(['CALI', 'DT', 'NPHI_SAN', 'NPHI_LIM', 'NPHI_DOL', 'DPHI_LIM', 'DPHI_SAN', 'DPHI_DOL', 'M2R9', 'M2R6', 'M2R3', 'M2R2', 'M2R1', 'GR', 'SP', 'PEF', 'DRHO', 'RHOB'])

In [5]:
w.data['GR'].plot()


Load a deviation survey.


In [6]:
dev = np.loadtxt('P-130_deviation_survey.csv', delimiter=',', skiprows=1)
w.location.add_deviation(dev[:, :3], td=2618.3)
w.location.md2tvd(2000)


Out[6]:
array(1998.17950533)

Add a striplog.


In [7]:
from striplog import Legend, Striplog
legend = Legend.builtin('NSDOE')
strip = Striplog.from_image('P-130_25_2618.png', 25, 2618, legend=legend)
strip.plot(aspect=2)



In [8]:
w.data['strip'] = strip

Basic plot

We want to use a legend so we get the striplog to look right:


In [9]:
tracks = ['MD', 'strip', 'GR', 'RHOB', ['DT', 'DTS'], 'M2R9', 'MD']
w.plot(tracks=tracks, legend=legend)


The legend doesn't have entries for the curves, so they are grey.

Let's add some.


In [10]:
curve_legend_csv = """colour,lw,ls,xlim,xscale,curve mnemonic
#ff0000,1.0,-,"0,200",linear,GR
blue,1.0,-,,linear,RHOB
#00ff00,1.0,--,,linear,DT
#ffff00,1.0,--,,linear,DTS
black,1.0,,,log,M2R9
"""
curve_legend = Legend.from_csv(text=curve_legend_csv)

In [11]:
complete_legend = legend + curve_legend

In [12]:
complete_legend[-6:]


Out[12]:
colourcomponentxlimcurvelswidthxscalehatchlw
#666666
lithologymudstone
colourgrey
NoneNoneNone1.0NoneNoneNone
#ff0000None0,200{'mnemonic': 'gr'}-NonelinearNone1.0
#0000ffNoneNone{'mnemonic': 'rhob'}-NonelinearNone1.0
#00ff00NoneNone{'mnemonic': 'dt'}--NonelinearNone1.0
#ffff00NoneNone{'mnemonic': 'dts'}--NonelinearNone1.0
#000000NoneNone{'mnemonic': 'm2r9'}NoneNonelogNone1.0

In [13]:
curve_legend.get_decor(w.data['GR'])


Out[13]:
colour#ff0000
lw1.0
ls-
xlim0,200
xscalelinear
curve{'mnemonic': 'gr'}
widthNone
hatchNone

In [14]:
w.data['GR'].plot(legend=curve_legend)



In [15]:
w.plot(tracks=tracks, legend=complete_legend, extents=(700, 1200))


2D log plot

A variable density display.


In [16]:
w.data['GR'].plot_2d(cmap='viridis')



In [17]:
w.data['GR'].plot_2d(curve=True,cmap='viridis')


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-17-20dea6657f3b> in <module>
----> 1 w.data['GR'].plot_2d(curve=True,cmap='viridis')

~/anaconda3/envs/geocomp/lib/python3.7/site-packages/welly/curve.py in plot_2d(self, ax, width, aspect, cmap, curve, ticks, return_fig, **kwargs)
    324 
    325             # Make the 'fill' mask and clip the background image with it.
--> 326             patch = PathPatch(paths._paths[0], visible=False)
    327             ax.add_artist(patch)
    328             im.set_clip_path(patch)

IndexError: list index out of range

In [ ]: