# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + [markdown] slideshow={"slide_type": "slide"}
# **Python Piano Diagram Tutorial- Intro**
#
#
# April 20, 2020

# + [markdown] slideshow={"slide_type": "slide"}
# **Agenda**
#
# - What is Python?
# - Purpose of this Presentation
# - Walk through GB Code
# - Final Comments/Questions
#

# + [markdown] slideshow={"slide_type": "slide"}
# **What is Python?**
#
# - High-level programming language
#     - Other examples: Matlab, C++, Fortran
# - (Relatively) simple, easy to learn syntax
# - FREE 
# - Supports modules and packages
#     - Modules – piece of software that has specific functionality
#         - Able to import in modules that other people have created (BIG deal)
#     - Package- collection of modules

# + [markdown] slideshow={"slide_type": "slide"}
# **Purpose**
# - Show potential and power of Python
#     - Current: 20 min in ppt, moving objects, adding shapes, adding text boxes, eyeballing distances
#     - Python: 5 min in Python, distances are to scale, consistency with other GBs
# - Introduce you to GB function
# - Get you excited to try and use it 
#
# **Comments**
# - Puzzle
# - New language, have patience
# - 45% time spent googling, 50% modifying what was found on google, 5% asking the expert data scientists at Noble
# - Scratching the surface

# + [markdown] slideshow={"slide_type": "slide"}
# Packages needed to run codes:

# + slideshow={"slide_type": "fragment"}
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
from matplotlib.ticker import (MultipleLocator, FormatStrFormatter,
                               AutoMinorLocator)

from matplotlib.patches import Ellipse

# + [markdown] slideshow={"slide_type": "slide"}
# **Setting up plot:**

# + slideshow={"slide_type": "fragment"}
    #DP X
pad = 'X'

fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)

xmax = 90
ymax = 9
xr = 7

ax.set(xlim=(xmax, 0), ylim = (0, ymax))

# + [markdown] slideshow={"slide_type": "slide"}
# **Formatting labels/tick marks on plot:**
# -

ax.set(xlim=(xmax, 0), ylim = (0, ymax))

    #plt.yticks(np.arange(start,stop, step),[labels])
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', 'Fort Hays','Nio D', 'C Marl', 'C Chalk','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)

    #plt.yticks(np.arange(start,stop, step),[labels])
plt.xticks(np.arange(90, -1, step=-5),['90', '85','80','75', '70', '65','60', '55', '50','45','40','35','30','25','20','15','10'])
ax.tick_params(axis='x', labelsize=18)


# + [markdown] slideshow={"slide_type": "slide"}
# **Adding section lines:**
# -

    #plotting vertical black lines to show section lines
    #plt.vlines(x,ymin, ymax, line parameters)
plt.vlines(90, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
plt.vlines(10, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)

# + [markdown] slideshow={"slide_type": "slide"}
# **Adding colored rectangles for each formation:**

# + slideshow={"slide_type": "fragment"}
fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)
ax.set(xlim=(90, 0), ylim = (0, ymax))
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', 'Fort Hays','Nio D', 'C Marl', 'C Chalk','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)


#adding in color rectangles 
    #ax.add_patch(patches.Rectangle((xmin, ymin), w_rect, h_rect))
ax.add_patch(patches.Rectangle((0, 0), xmax+xr, 1, color='wheat'))
ax.add_patch(patches.Rectangle((0, 1), xmax+xr, 1, color = 'powderblue'))
ax.add_patch(patches.Rectangle((0, 2), xmax+xr, 1, color = 'lightgray'))
ax.add_patch(patches.Rectangle((0, 3), xmax+xr, 2, color = 'lemonchiffon'))
ax.add_patch(patches.Rectangle((0, 5), xmax+xr, 2, color = 'lightskyblue'))
ax.add_patch(patches.Rectangle((0, 7), xmax+xr, 2, color = 'pink'))

# + [markdown] slideshow={"slide_type": "slide"}
# **Adding gridlines**

# + slideshow={"slide_type": "fragment"}
fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)
ax.set(xlim=(90, 0), ylim = (0, ymax))
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', 'Fort Hays','Nio D', 'C Marl', 'C Chalk','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)

#formatting gridlines
ax.xaxis.grid(zorder=0,color ='black', linestyle = ':')
ax.grid(which='minor', linestyle=':', linewidth='1', color='black')
ax.yaxis.set_minor_locator(AutoMinorLocator(2))

# + [markdown] slideshow={"slide_type": "slide"}
# **Putting it all together:**

# + slideshow={"slide_type": "fragment"}
#DP X
pad = 'X'
fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)
ax.set(xlim=(90, 0), ylim = (0, ymax))
ax.add_patch(patches.Rectangle((0, 0), xmax+xr, 1, color='wheat'))
ax.add_patch(patches.Rectangle((0, 1), xmax+xr, 1, color = 'powderblue'))
ax.add_patch(patches.Rectangle((0, 2), xmax+xr, 1, color = 'lightgray'))
ax.add_patch(patches.Rectangle((0, 3), xmax+xr, 2, color = 'lemonchiffon'))
ax.add_patch(patches.Rectangle((0, 5), xmax+xr, 2, color = 'lightskyblue'))
ax.add_patch(patches.Rectangle((0, 7), xmax+xr, 2, color = 'pink'))
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', 'Fort Hays','Nio D', 'C Marl', 'C Chalk','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)
plt.xticks(np.arange(90, -1, step=-5),['90', '85','80','75', '70', '65','60', '55', '50','45','40','35','30','25','20','15','10'])
ax.tick_params(axis='x', labelsize=18)
plt.vlines(90, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
plt.vlines(10, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
ax.xaxis.grid(zorder=0,color ='black', linestyle = ':')
ax.grid(which='minor', linestyle=':', linewidth='1', color='black')
ax.yaxis.set_minor_locator(AutoMinorLocator(2))


# + [markdown] slideshow={"slide_type": "slide"}
# **Functions needed to run codes:**
#  - essentially same idea as packages

# + slideshow={"slide_type": "fragment"}
def well(x,y,color_):
    ellipse = Ellipse(xy=(x, y), width=3, height=.8, fc=color_)
    ax.add_patch(ellipse)
    


# + [markdown] slideshow={"slide_type": "skip"}
# **Example #1 with wells:**

# + slideshow={"slide_type": "slide"}
fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)
ax.set(xlim=(90, 0), ylim = (0, ymax))
ax.add_patch(patches.Rectangle((0, 0), xmax+xr, 1, color='wheat'))
ax.add_patch(patches.Rectangle((0, 1), xmax+xr, 1, color = 'powderblue'))
ax.add_patch(patches.Rectangle((0, 2), xmax+xr, 1, color = 'lightgray'))
ax.add_patch(patches.Rectangle((0, 3), xmax+xr, 2, color = 'lemonchiffon'))
ax.add_patch(patches.Rectangle((0, 5), xmax+xr, 2, color = 'lightskyblue'))
ax.add_patch(patches.Rectangle((0, 7), xmax+xr, 2, color = 'pink'))
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', '<NAME>','<NAME>', '<NAME>', '<NAME>','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)
plt.xticks(np.arange(90, -1, step=-5),['90', '85','80','75', '70', '65','60', '55', '50','45','40','35','30','25','20','15','10'])
ax.tick_params(axis='x', labelsize=18)
ax.xaxis.grid(zorder=0,color ='black', linestyle = ':')
ax.grid(which='minor', linestyle=':', linewidth='1', color='black')
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
plt.vlines(90, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
plt.vlines(10, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)

well(87,4.5,'red')
well(84,6.5,'black')
well(76,3.5,'black')
well(68,6.5,'black')
well(59,3.5,'black')
well(51,6.5,'black')
well(43,3.8,'black')
well(36,6.5,'black')
well(27,4,'black')
well(20,6.5,'black')
well(5,3.5,'red')
well(6,0.5,'red')

# + [markdown] slideshow={"slide_type": "slide"}
# **Adding legend**

# + slideshow={"slide_type": "fragment"}
texts = ["Producing", "DP Wells"]
colors = ["red", "black"]
patches_ = [ plt.plot([],[], marker="o", ms=12, ls="", mec='black', color=colors[i], 
            label="{:s}".format(texts[i]) )[0]  for i in range(len(texts)) ]
plt.legend(handles=patches_, loc = 'upper right', ncol=1, facecolor="lightgray", numpoints=1) 

# + slideshow={"slide_type": "slide"}
fig, ax = plt.subplots()
plt.gcf().set_size_inches(14, 5)
ax.set(xlim=(90, 0), ylim = (0, ymax))
ax.add_patch(patches.Rectangle((0, 0), xmax+xr, 1, color='wheat'))
ax.add_patch(patches.Rectangle((0, 1), xmax+xr, 1, color = 'powderblue'))
ax.add_patch(patches.Rectangle((0, 2), xmax+xr, 1, color = 'lightgray'))
ax.add_patch(patches.Rectangle((0, 3), xmax+xr, 2, color = 'lemonchiffon'))
ax.add_patch(patches.Rectangle((0, 5), xmax+xr, 2, color = 'lightskyblue'))
ax.add_patch(patches.Rectangle((0, 7), xmax+xr, 2, color = 'pink'))
plt.yticks(np.arange(0.5, ymax, step=1),['Codell', 'Fort Hays','Nio D', 'C Marl', 'C Chalk','B Marl', 'B Chalk', 'A Marl','A Chalk'])
ax.tick_params(axis='y', labelsize=18)

plt.xticks(np.arange(90, 9, step=-5))
ax.tick_params(axis='x', labelsize=18)

ax.xaxis.grid(zorder=0,color ='black', linestyle = ':')
ax.grid(which='minor', linestyle=':', linewidth='1', color='black')
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
plt.vlines(90, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
plt.vlines(10, 0, ymax, colors='black', linestyles='solid', label='',linewidth=6)
well(87,4.5,'red')
well(84,6.5,'black')
well(76,3.5,'black')
well(68,6.5,'black')
well(59,3.5,'black')

texts = ["Producing", "DP Wells"]
colors = ["red", "black"]
patches_ = [ plt.plot([],[], marker="o", ms=12, ls="", mec='black', color=colors[i], 
            label="{:s}".format(texts[i]) )[0]  for i in range(len(texts)) ]
plt.legend(handles=patches_, loc = 'upper right', ncol=1, facecolor="lightgray", numpoints=1)

# + [markdown] slideshow={"slide_type": "slide"}
# **Final Comments**
# - PATIENCE
# - GOOGLE
# -



StarcoderdataJupyterScriptsDedupFiltered