-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
How to... | ||
---------- | ||
|
||
.. toctree:: | ||
:caption: How to... | ||
:maxdepth: 1 | ||
|
||
tutorial/10_Extract_curves_into_striplogs.ipynb | ||
tutorial/11_Parse_a_description_into_components.ipynb | ||
tutorial/12_Calculate_sand_proportion.ipynb | ||
tutorial/13_Work_with_binary_logs.ipynb | ||
tutorial/14_Merge_overlapping_striplogs.ipynb | ||
tutorial/15_Model_sequences_with_Markov_chains.ipynb | ||
tutorial/16_Block_logs.ipynb |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Parse a description into components\n", "\n", "This notebook requires at least version 0.8.8."]}, {"cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [{"data": {"text/plain": ["'0.8.8'"]}, "execution_count": 1, "metadata": {}, "output_type": "execute_result"}], "source": ["import striplog\n", "\n", "striplog.__version__"]}, {"cell_type": "markdown", "metadata": {}, "source": ["We have some text:"]}, {"cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": ["text = \"wet silty fine sand with tr clay\""]}, {"cell_type": "markdown", "metadata": {}, "source": ["To read this with `striplog`, we need to define a `Lexicon`. This is a dictionary-like object full of regular expressions, which acts as a bridge between this unstructured description and a dictionary-like `Component` object which `striplog` wants. The `Lexicon` also contains abbreviations for converting abbreviated text like cuttings descriptions into expanded words.\n", "\n", "A `Lexicon` to read only this text might look like:"]}, {"cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": ["from striplog import Lexicon\n", "\n", "lex_dict = {\n", " 'lithology': ['sand', 'clay'],\n", " 'grainsize': ['fine'],\n", " 'modifier': ['silty'],\n", " 'amount': ['trace'],\n", " 'moisture': ['wet', 'dry'],\n", " 'abbreviations': {'tr': 'trace'},\n", " 'splitters': ['with'],\n", " 'parts_of_speech': {'noun': ['lithology'],\n", " 'adjective': ['grainsize', 'modifier', 'moisture'],\n", " 'subordinate': ['amount'],\n", " }\n", "}\n", "\n", "lexicon = Lexicon(lex_dict)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Now we can parse the text with it:"]}, {"cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [{"data": {"text/plain": ["[Component({'lithology': 'sand', 'grainsize': 'fine', 'modifier': 'silty', 'moisture': 'wet'}),\n", " Component({'lithology': 'clay', 'amount': 'trace'})]"]}, "execution_count": 4, "metadata": {}, "output_type": "execute_result"}], "source": ["from striplog import Interval\n", "\n", "Interval._parse_description(text, lexicon=lexicon, max_component=3, abbreviations=True)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["But this is obviously a bit of a pain to make and maintain. So instead of definining a `Lexicon` from scratch, we'll modify the default one:"]}, {"cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": ["# Make and expand the lexicon.\n", "lexicon = Lexicon.default()\n", "\n", "# Add moisture words (or could add as other 'modifiers').\n", "lexicon.moisture = ['wet(?:tish)?', 'dry(?:ish)?']\n", "lexicon.parts_of_speech['adjective'] += ['moisture']\n", "\n", "# Add the comma as component splitter.\n", "lexicon.splitters += [', ']"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Parsing with this yields the same results as before..."]}, {"cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [{"data": {"text/plain": ["[Component({'lithology': 'sand', 'modifier': 'silty', 'grainsize': 'fine', 'moisture': 'wet'}),\n", " Component({'lithology': 'clay'})]"]}, "execution_count": 6, "metadata": {}, "output_type": "execute_result"}], "source": ["Interval._parse_description(text, lexicon=lexicon, max_component=3)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["...but we can parse more things now:"]}, {"cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [{"data": {"text/plain": ["[Component({'lithology': 'sandstone', 'grainsize': 'coarse'}),\n", " Component({'lithology': 'limestone', 'amount': 'minor'})]"]}, "execution_count": 7, "metadata": {}, "output_type": "execute_result"}], "source": ["Interval._parse_description(\"Coarse sandstone with minor limestone\", lexicon=lexicon, max_component=3)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["`striplog` does all this parsing internally when you use the `Striplog.from_descriptions()` class method.\n", "\n", "Have fun!"]}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7"}}, "nbformat": 4, "nbformat_minor": 4} |
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
,Wells,Date,Type,Top,Bottom | ||
1,OG-815,1972-10-21,perforation,2426,2431 | ||
2,OG-815,1972-10-30,perforation,2431,2439 | ||
0,OG-815,1972-11-04,perforation,2258,2270 | ||
3,OG-815,1972-11-04,perforation,2369,2374 | ||
4,OG-815,1976-05-25,perforation,2352,2362 | ||
6,OG-815,1976-05-25,squeeze,2369,2374 | ||
5,OG-815,1976-05-28,perforation,2344,2348 | ||
7,OG-815,1976-05-28,squeeze,2352,2362 | ||
8,OG-815,1976-05-28,squeeze,2344,2348 | ||
9,OG-815,1976-06-02,perforation,2310,2320 | ||
10,OG-815,1998-02-21,perforation,2310,2320 | ||
12,OG-815,1998-02-22,squeeze,2258,2270 | ||
11,OG-815,1998-02-22,perforation,2292,2298 | ||
13,OG-815,2000-11-18,squeeze,2310,2320 | ||
14,OG-815,2000-11-18,squeeze,2292,2298 | ||
15,OG-815,2001-05-21,perforation,2260,2270 | ||
16,OG-815,2001-05-21,perforation,2246,2250 | ||
17,OG-815,2002-05-26,perforation,2192,2195 | ||
18,OG-815,2002-05-27,perforation,2185,2192 | ||
19,OG-815,2002-05-30,welltest-pm,2246,2250 | ||
20,OG-815,2002-05-30,welltest-pm,2260,2270 | ||
21,OG-815,2002-05-30,welltest-pm,2292,2298 | ||
22,OG-815,2002-05-30,welltest-pm,2310,2320 | ||
27,OG-815,2002-06-03,squeeze,2310,2320 | ||
26,OG-815,2002-06-03,squeeze,2292,2298 | ||
24,OG-815,2002-06-03,squeeze,2246,2250 | ||
23,OG-815,2002-06-03,perforation,2185,2189 | ||
25,OG-815,2002-06-03,squeeze,2260,2270 | ||
28,OG-815,2002-06-05,perforation,2132,2141 | ||
29,OG-815,2006-07-18,perforation,2255,2263 | ||
30,OG-815,2006-07-19,perforation,2263,2266 | ||
31,OG-815,2006-07-19,perforation,2243,2246 | ||
32,OG-815,2008-04-28,perforation,2119,2127 | ||
33,OG-815,2008-04-28,perforation,2112,2119 | ||
34,OG-815,2008-04-28,squeeze,2255,2266 | ||
35,OG-815,2008-04-28,squeeze,2243,2246 | ||
36,OG-815,2008-06-22,perforation,2100,2105 | ||
37,OG-815,2008-06-23,perforation,1992,2005 | ||
38,OG-815,2008-06-24,perforation,1986,1992 | ||
39,OG-815,2009-10-23,perforation,2037,2053 | ||
40,OG-815,2009-10-23,perforation,2018,2023 | ||
41,OG-815,2012-05-29,perforation,2243,2245 | ||
42,OG-815,2012-05-30,perforation,2183,2190 | ||
43,OG-815,2012-05-30,perforation,2132,2136 | ||
44,OG-815,2012-05-30,perforation,1995,2005 | ||
45,OG-815,2015-11-13,perforation,2189,2195 | ||
46,OG-815,2015-11-14,perforation,2180,2189 | ||
47,OG-815,2015-11-14,perforation,1995,2005 | ||
48,OG-815,2018-07-31,perforation,2100,2105 | ||
49,OG-815,2018-07-31,perforation,2000,2010 |