This notebooks looks at the main striplog object. For the basic objects it depends on, see Basic objects.
First, import anything we might need.
In [1]:
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import striplog
striplog.__version__
# If you get a lot of warnings here, try running this block again.
Out[1]:
In [2]:
from striplog import Legend, Lexicon, Interval, Component
In [3]:
legend = Legend.builtin('NSDOE')
lexicon = Lexicon.default()
In [4]:
from striplog import Striplog
print(Striplog.__doc__)
Here is one of the images we will convert into striplogs:
In [5]:
imgfile = "M-MG-70_14.3_135.9.png"
In [6]:
strip = Striplog.from_img(imgfile, 14.3, 135.9, legend=legend)
strip
Out[6]:
In [7]:
strip.plot(legend, ladder=True, aspect=5)
There are several ways to inspect a striplog:
print prints the contents of the striplogtop shows us a list of the primary lithologies in the striplog, in order of cumulative thicknessplot makes a plot of the striplog with coloured bars
In [8]:
print(strip[:5])
In [9]:
strip.unique
Out[9]:
It's easy enough to visualize this. Perhaps this should be a method...
In [10]:
depth = 0
list_of_int = []
for i in strip.unique:
list_of_int.append(Interval(depth, depth+i[1], components=[i[0]]))
depth += i[1]
Striplog(list_of_int).plot(legend, aspect=3)
If you call plot() on a Striplog you'll get random colours (one per rock type in the striplog), and preset aspect ratio of 10.
In [11]:
strip.plot()
For more control, you can pass some parameters. You'll probably always want to pass a legend.
In [12]:
strip.plot(legend, ladder=True, aspect=5, ticks=5)
In [13]:
hashy_csv = """colour,width,hatch,component colour,component grainsize,component lithology
#dddddd,1,---,grey,,siltstone,
#dddddd,2,xxx,,,anhydrite,
#dddddd,3,...,grey,vf-f,sandstone,
#dddddd,4,+--,,,dolomite,
#dddddd,5,ooo,,,volcanic,
#dddddd,6,---,red,,siltstone,
#dddddd,7,,,,limestone,
"""
hashy = Legend.from_csv(text=hashy_csv)
strip.plot(hashy, ladder=True, aspect=6, lw=1)
Again, the object is indexable and iterable.
In [14]:
print(strip[:3])
In [15]:
print(strip[-1].primary.summary())
In [16]:
for i in strip[:5]:
print(i.summary())
In [17]:
len(strip)
Out[17]:
In [18]:
import numpy as np
np.array([d.top.z for d in strip[5:13]])
Out[18]:
You can even index into it with an iterable, like a list of indices. The result is a striplog.
In [19]:
indices = [2,4,6]
strip[indices].plot(legend, aspect=5)
Slicing returns a new striplog:
In [20]:
strip[1:3]
Out[20]:
In [21]:
rock = strip.find('sandstone')[1].components[0]
rock2 = Component({'lithology':'shale', 'colour':'grey'})
iv = Interval(top=300, base=350, description='', components=[rock, rock2])
In [22]:
strip[-3:-1] + Striplog([iv])
Out[22]:
In [23]:
del strip[4]
strip.plot(aspect=5)
In [24]:
print(strip.to_las3())
In [25]:
strip.source
Out[25]:
In [26]:
csv_string = """top, base, lithology
200.000, 230.329, Anhydrite
230.329, 233.269, Grey vf-f sandstone
233.269, 234.700, Anhydrite
234.700, 236.596, Dolomite
236.596, 237.911, Red siltstone
237.911, 238.723, Anhydrite
238.723, 239.807, Grey vf-f sandstone
239.807, 240.774, Red siltstone
240.774, 241.122, Dolomite
241.122, 241.702, Grey siltstone
241.702, 243.095, Dolomite
243.095, 246.654, Grey vf-f sandstone
246.654, 247.234, Dolomite
247.234, 255.435, Grey vf-f sandstone
255.435, 258.723, Grey siltstone
258.723, 259.729, Dolomite
259.729, 260.967, Grey siltstone
260.967, 261.354, Dolomite
261.354, 267.041, Grey siltstone
267.041, 267.350, Dolomite
267.350, 274.004, Grey siltstone
274.004, 274.313, Dolomite
274.313, 294.816, Grey siltstone
294.816, 295.397, Dolomite
295.397, 296.286, Limestone
296.286, 300.000, Volcanic
"""
In [27]:
strip2 = Striplog.from_csv(text=csv_string, lexicon=lexicon)
Notice the warning about a missing term in the lexicon.
In [28]:
Component.from_text('Grey vf-f sandstone', lexicon)
Out[28]:
In [29]:
las3 = """~Lithology_Parameter
LITH . : Lithology source {S}
LITHD. MD : Lithology depth reference {S}
~Lithology_Definition
LITHT.M : Lithology top depth {F}
LITHB.M : Lithology base depth {F}
LITHN. : Lithology name {S}
~Lithology_Data | Lithology_Definition
200.000, 230.329, Anhydrite
230.329, 233.269, Grey vf-f sandstone
233.269, 234.700, Anhydrite
234.700, 236.596, Dolomite
236.596, 237.911, Red siltstone
237.911, 238.723, Anhydrite
238.723, 239.807, Grey vf-f sandstone
239.807, 240.774, Red siltstone
240.774, 241.122, Dolomite
241.122, 241.702, Grey siltstone
241.702, 243.095, Dolomite
243.095, 246.654, Grey vf-f sandstone
246.654, 247.234, Dolomite
247.234, 255.435, Grey vf-f sandstone
255.435, 258.723, Grey siltstone
258.723, 259.729, Dolomite
259.729, 260.967, Grey siltstone
260.967, 261.354, Dolomite
261.354, 267.041, Grey siltstone
267.041, 267.350, Dolomite
267.350, 274.004, Grey siltstone
274.004, 274.313, Dolomite
274.313, 294.816, Grey siltstone
294.816, 295.397, Dolomite
295.397, 296.286, Limestone
296.286, 300.000, Volcanic
"""
In [30]:
strip3 = Striplog.from_las3(las3, lexicon)
print(strip3)
©2015 Agile Geoscience. Licensed CC-BY. striplog.py