0% encontró este documento útil (0 votos)
188 vistas71 páginas

Programación Python para Hidrocarburos

Este documento presenta una introducción a la programación en Python para la exploración de hidrocarburos. Explica conceptos básicos como declaraciones condicionales if/else/elif, ciclos for y while, y las instrucciones break y continue. También introduce la ley de Darcy, logs eléctricos, sísmica y producción de petróleo. El documento incluye ejemplos de código para ilustrar estos conceptos.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
188 vistas71 páginas

Programación Python para Hidrocarburos

Este documento presenta una introducción a la programación en Python para la exploración de hidrocarburos. Explica conceptos básicos como declaraciones condicionales if/else/elif, ciclos for y while, y las instrucciones break y continue. También introduce la ley de Darcy, logs eléctricos, sísmica y producción de petróleo. El documento incluye ejemplos de código para ilustrar estos conceptos.
Derechos de autor
© © All Rights Reserved
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como PDF, TXT o lee en línea desde Scribd

7/18/2020 PythonExploracionHidrocarburos.

ipynb - Colaboratory

PROGRAMACION EN PYTHON EXPLORACION DE


HIDROCARBUROS
CivGeo 2020 Instructor: Roderick Perez

18 de Julio, 2020

DATOS
Pozo

F02-1_logs.las ([Link]
Volumen sismico

Penobscot_0-[Link] ([Link]

Link de descarga: [Link]

NOTA:

Descargar desde AHORA!!!!!


Archuvo: 350 Mb
Luego colocarlo en su carpeta de trabajo (local o GDrive).

REQUERIMIENTO
TODOS los archivos deben estar cargados en su disco local (Jupyter Notebook) o GDrive.
NO nos vamos a detener porque alguien no sabe como cargar sus datos en GDrive o en
Jupyter, o no sabe como instalar una libreria.
Preguntas?

CONTENIDO
Declaraciones de ujos de control & Ciclos

Mayor que, menor que, igual que


If - else
If - elif
Ciclos

[Link] 1/71
7/18/2020 [Link] - Colaboratory

For
While
Break
Continue
Ley de Darcy
Wavelet
Electrical logs
Seismic
Production

Declaraciones de ujos de control & Ciclos

If, else, elif statements

if some_condition:
algorithm

Mayor >
Mayor que >=
Igual ==
Menor que <=
Menor <
NO igual !=

1 porosity = 0.15
2 if porosity > 0.1:
3 print("Sand")
Sand

1 #Notice that in this case nothing is printed


2 porosity = 0.05
3 if porosity > 0.1:
4 print("Sand")

If-else

[Link] 2/71
7/18/2020 [Link] - Colaboratory

if some_condition:
algorithm
else:
algorithm

1 porosity = 0.1
2 if porosity > 0.15:
3 print("Sand")
4 else:
5 print("Shaly-Sand")
Shaly-Sand

1 porosity = 0.1
2 if porosity >= 0.1:
3 print("Sand")
4 else:
5 print("Shaly-Sand")
Sand

if-elif

if some_condition1:
algorithm
elif some_condition2:
algorithm
else:
algorithm

1 # Definimos 2 variables: Porosidad & Permeabilidad


2 porosity = 0.15
3 permeability = 1500 #md
4
5 # Definimos condiciones
6 if porosity > 0.1 and permeability < 1000:
7 print("Sand")
[Link] 3/71
7/18/2020 [Link] - Colaboratory

8 elif porosity > 0.1 and permeability >= 1000:


9 print("MegaPerm Sand")
10 else:
11 print("Shale")
MegaPerm Sand

if statement inside a if statement or if-elif or if-else are called as nested if statements.

1 # Definimos 2 variables: Porosidad & Permeabilidad


2 porosity = 0.150
3 permeability = 1500 #md
4
5 # Definimos condiciones
6 if porosity > 0.1:
7 if permeability < 100:
8 print("Shaly-Sand")
9 elif permeability < 1000:
10 print("Sand")
11 elif permeability >= 1000:
12 print("MegaPerm Sand")
13 else:
14 print("Shale")
MegaPerm Sand

Loops
For

for variable in something:


algorithm

1 for i in range(5):
2 print(i)

[Link] 4/71
7/18/2020 [Link] - Colaboratory

0
1
In the2above example, i iterates over the 0,1,2,3,4. Every time it takes each value and executes the
algorithm
3 inside the loop. It is also possible to iterate over a nested list illustrated below.
4

1 # Definir la LISTA wells


2 wells = ['wellA', 'wellB', 'wellC']
3
4 #Definir mi ciclo 'for'
5 for well in wells:
6 print(well)
wellA
wellB
wellC

1 # Definir la ARREGLO wells con arreglos


2 list_of_wells = [['wellA', 'wellB', 'wellC'], [0.2, 0.3, 0.25
3
4 #Definir mi ciclo 'for' nested
5 for list1 in list_of_wells:
6 for x in list1:
7 print(x)
wellA
wellB
wellC
0.2
0.3
0.25

1 # Definimos variables
2 wells = ['wellA', 'wellB', 'wellC']
3 mean_poro = [0.2, 0.3, 0.5]
4 mean_permeability = [500, 1500, 200]
5 number_of_wells = len(wells)
6
7 # Defino ciclo 'for'
8 for x in range(number_of_wells):
9 print('The well name is ', wells[x], ', the mean poro
10 ' and mean permeability is ', mean_permeability

[Link] 5/71
7/18/2020 [Link] - Colaboratory

The well name is wellA , the mean porosity is 0.2 and mean permeability is 500
The well name is wellB , the mean porosity is 0.3 and mean permeability is 1500
The well name is wellC , the mean porosity is 0.5 and mean permeability is 200
While

while some_condition:
algorithm

1 n = 5
2
3 while n > 0:
4 n -= 1 # Equivalente a n = n-1
5 # n += 1 # Equivalente a n = n+1
6 print(n)
7 print('Finished')
4
3
2
1
0
Finished

1 well_rate = [248.956137704918, 434.084242622951, 383.69618688


2 225.643954098361, 208.289740983607, 168.05436393
3 133.21188852459, 112.300216393443, 114.898708196
4 204.845708196721, 186.109757377049, 153.19140327
5 142.323108196721, 144.104931147541, 130.75981967
6 119.386262295082, 120.372039344262]
7 number_of_items = len(well_rate)
8 minimum_rate = 150
9 i = 0
10 rate = 1000
11
12 while rate > minimum_rate:
13 rate = well_rate[i]
14 print('Rate is ', round(well_rate[i],2))
15 i += 1
16 print('Rate was below ', minimum_rate, ' m3/d in item ', i, '

[Link] 6/71
7/18/2020 [Link] - Colaboratory

Rate is 248.96
Rate is 434.08
Rate is 383.7
Rate is 400.76
Rate is 322.64
Rate is 225.64
Rate is 208.29
Rate is 168.05
Rate is 145.51
Rate was below 150 m3/d in item 9 of the list
Break
As the name says. It is used to break out of a loop when a condition becomes true when executing
the loop.

1 for i in range(20):
2 print(i)
3 if i>=7:
4 break
0
1
2
3
4
5
6
7

Continue
This continues the rest of the loop. Sometimes when a condition is satis ed there are chances of
the loop getting terminated. This can be avoided using continue statement.

1 for i in range(10):
2 if i>4:
3 print("The end.")
4 continue
5 elif i<7:
6 print(i)

[Link] 7/71
7/18/2020 [Link] - Colaboratory

0
1
2
3
4
The end.
The end.
The end.
The end.
Ley de
The Darcy
end.

Darcy's Law describe the ow rate in a porous media,


kA
Q = ΔP
μL

where:

Q = ow rate[m3 /s]
k = permeability [m2 ]
A = cross-sectional area [m2 ]
μ = viscosity [Pa.s]
L = length of sample [m]
ΔP = pressure difference accross the sample [Pa]

Note: All units are in SI.

1 # 1. Definir variables para inicializar


2
3 # Q = ???????
4 K = 10
5 s = 1
6 u = 1
7 L = 1
8 dp = 1

1 # 2. Escribir la funcion
2
3 Q = (s * K * dp)/ u*L
4
5 print(Q)
10.0

[Link] 8/71
7/18/2020 [Link] - Colaboratory

1 import numpy as np

In order to apply what we already learned, let's de ne a function:

1 def darcy_law (k, A, mu, L, dP):


2 """
3 Author: Roderick Perez
4 Version: 1.0
5
6 Darcy's Law function in order to
7 calculate the flow rate in a porous media.
8
9 args:
10 k = permeability [m2]
11 A = area [m2]
12 mu = viscosity [Pa.s]
13 L = sample length [m]
14 dP = pressure differential [Pa]
15
16 returns:
17 Q = flow rate [m3/s]
18 """
19 Q = k * A * dP / (mu * L)
20 return Q

Now, lets write the Darcy's Law function, and see the documentation we just created:

1 darcy_law?

Now, we can evaluate the function using the sample values used before

[Link] 9/71
7/18/2020 [Link] - Colaboratory

1 darcy_law(1, 1, 1, 1, 0)
0.0

Everything is working perfect. Then, let's input more realistic values:

1 k = 4.9346165e-13 # ~500 mD
2 A = 2.03e-3 # 1 inch diameter plug
3 mu = 8.9e-4 #~dynamic viscosity of water at about 25C
4 L = 0.0508 #2 inch plug
5 dP = 689476 # ~100 psi
6
7 Q = darcy_law(k, A, mu, L, dP)
8 print (f'The flow rate `Q` is: {Q:.1e} m3/s or {Q * 3600:.2f}
The flow rate `Q` is: 1.5e-05 m3/s or 0.05m3/h

Now, let's use Numpy to make a plot of the ow rate vs. plug length. For that we will need to de ne
the range of plug lengths. For that, let's use the [Link](first, last, step)

1 import numpy as np
2
3 L = [Link](0.05,1, 0.005)
4 L

[Link] 10/71
7/18/2020 [Link] - Colaboratory

array([0.05 , 0.055, 0.06 , 0.065, 0.07 , 0.075, 0.08 , 0.085, 0.09 ,


0.095, 0.1 , 0.105, 0.11 , 0.115, 0.12 , 0.125, 0.13 , 0.135,
0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 , 0.175, 0.18 ,
And now, evaluating the whole
0.185, 0.19 darcy's
, 0.195, 0.2Law
, function into each
0.205, 0.21 value0.22
, 0.215, in the
, L array,
0.225,
0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 , 0.265, 0.27 ,
0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3 , 0.305, 0.31 , 0.315,
1 len(L) 0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 , 0.355, 0.36 ,
0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395, 0.4 , 0.405,
0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 , 0.445, 0.45 ,
190
0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485, 0.49 , 0.495,
0.5 , 0.505, 0.51 , 0.515, 0.52 , 0.525, 0.53 , 0.535, 0.54 ,
0.545, 0.55 , 0.555, 0.56 , 0.565, 0.57 , 0.575, 0.58 , 0.585,
1 Q = 0.59 darcy_law(k,A,mu,L,dP)*3600
, 0.595, 0.6 , 0.605, 0.61 , 0.615, 0.62 , 0.625, 0.63 ,
2 Q 0.635, 0.64 , 0.645, 0.65 , 0.655, 0.66 , 0.665, 0.67 , 0.675,
0.68 , 0.685, 0.69 , 0.695, 0.7 , 0.705, 0.71 , 0.715, 0.72 ,
0.725, 0.73 ,
array([0.05587417, 0.735, 0.74
0.0507947 , 0.745, 0.75
, 0.04656181, , 0.755,0.03991012,
0.04298013, 0.76 , 0.765,
0.77 , 0.775,
0.03724945, 0.78 , 0.785,
0.03492136, 0.79 , 0.795,
0.03286716, 0.8 ,0.02940746,
0.03104121, 0.805, 0.81 ,
0.815, 0.82 , 0.825, 0.83 , 0.835, 0.84 , 0.845, 0.85 , 0.855,
0.02793709, 0.02660675, 0.02539735, 0.02429312, 0.0232809 ,
0.86 , 0.865, 0.87 , 0.875, 0.88 , 0.885, 0.89 , 0.895, 0.9 ,
0.02234967, 0.02149007, 0.02069414, 0.01995506, 0.01926696,
0.905, 0.91 ,
0.01862472, 0.915, 0.92
0.01802393, , 0.925, 0.93
0.01746068, , 0.935,0.01643358,
0.01693157, 0.94 , 0.945,
0.95 , 0.955, 0.96 , 0.965, 0.97 , 0.975, 0.98 , 0.985, 0.99 ,
0.01596405, 0.0155206 , 0.01510113, 0.01470373, 0.01432671,
0.995])
0.01396854, 0.01362785, 0.01330337, 0.01299399, 0.01269868,
0.01241648, 0.01214656, 0.01188812, 0.01164045, 0.01140289,
0.01117483, 0.01095572, 0.01074503, 0.0105423 , 0.01034707,
0.01015894, 0.00997753, 0.00980249, 0.00963348, 0.0094702 ,
0.00931236, 0.0091597 , 0.00901196, 0.00886892, 0.00873034,
0.00859603, 0.00846578, 0.00833943, 0.00821679, 0.00809771,
0.00798202, 0.0078696 , 0.0077603 , 0.007654 , 0.00755056,
0.00744989, 0.00735186, 0.00725639, 0.00716336, 0.00707268,
0.00698427, 0.00689805, 0.00681392, 0.00673183, 0.00665169,
0.00657343, 0.006497 , 0.00642232, 0.00634934, 0.006278 ,
0.00620824, 0.00614002, 0.00607328, 0.00600798, 0.00594406,
0.00588149, 0.00582023, 0.00576022, 0.00570145, 0.00564386,
0.00558742, 0.0055321 , 0.00547786, 0.00542468, 0.00537252,
0.00532135, 0.00527115, 0.00522189, 0.00517353, 0.00512607,
0.00507947, 0.00503371, 0.00498877, 0.00494462, 0.00490124,
0.00485862, 0.00481674, 0.00477557, 0.0047351 , 0.00469531,
0.00465618, 0.0046177 , 0.00457985, 0.00454262, 0.00450598,
0.00446993, 0.00443446, 0.00439954, 0.00436517, 0.00433133,
0.00429801, 0.0042652 , 0.00423289, 0.00420107, 0.00416971,
0.00413883, 0.00410839, 0.00407841, 0.00404885, 0.00401972,
0.00399101, 0.00396271, 0.0039348 , 0.00390728, 0.00388015,
0.00385339, 0.003827 , 0.00380096, 0.00377528, 0.00374994,
0.00372494, 0.00370028, 0.00367593, 0.00365191, 0.00362819,
0.00360479, 0.00358168, 0.00355886, 0.00353634, 0.0035141 ,
0.00349214, 0.00347045, 0.00344902, 0.00342786, 0.00340696,
0.00338631, 0.00336591, 0.00334576, 0.00332584, 0.00330616,
0.00328672, 0.0032675 , 0.0032485 , 0.00322972, 0.00321116,
0.00319281, 0.00317467, 0.00315673, 0.003139 , 0.00312146,
0.00310412, 0.00308697, 0.00307001, 0.00305323, 0.00303664,
0.00302023, 0.00300399, 0.00298792, 0.00297203, 0.00295631,
0.00294075, 0.00292535, 0.00291011, 0.00289503, 0.00288011,
0.00286534, 0.00285072, 0.00283625, 0.00282193, 0.00280775])

1 len(Q)
[Link] 11/71
7/18/2020 [Link] - Colaboratory

190

Finally, we can plot de results using the matplotlib library:

1 %matplotlib inline
2 import [Link] as plt
3
4 [Link](L,Q)
5 [Link]()

Text(0, 0.5, 'Flow Rate [Q]')

1 # Mejorando grafico
2
3 [Link](L,Q)
4
5 [Link]('Ley de Darcy')
6 [Link]('Longitud [L]')
7 lt l b l('Fl R t [Q]')
[Link] 12/71
7/18/2020 [Link] - Colaboratory
7 [Link]('Flow Rate [Q]')
8 [Link]()

1 # Mejorando grafico
2
3 [Link](L,Q)
4
5 [Link]('Ley de Darcy', fontsize = 30)
6 [Link]('Longitud [L]', fontsize = 20)
7 [Link]('Flow Rate [Q]', fontsize = 20)
8 [Link]()

1 # Agregando grid
2
3 lt l t(L Q)
[Link] 13/71
7/18/2020 [Link] - Colaboratory
3 [Link](L,Q)
4
5 [Link]('Ley de Darcy', fontsize = 30)
6 [Link]('Longitud [L]', fontsize = 20)
7 [Link]('Flow Rate [Q]', fontsize = 20)
8 [Link]()
9 [Link]()

1 # Agregando grid
2
3 [Link](figsize = (16,8))
4 [Link](L,Q)
5
6 [Link]('Ley de Darcy', fontsize = 30)
7 [Link]('Longitud [L]', fontsize = 20)
8 [Link]('Flow Rate [Q]', fontsize = 20)
9 [Link]()
10 [Link]()

[Link] 14/71
7/18/2020 [Link] - Colaboratory

1 # Cambiando linea
2
3 [Link](figsize = (16,8))
4 [Link](L,Q, lw = 6, c = 'red')
5
6 [Link]('Ley de Darcy', fontsize = 30)
7 [Link]('Longitud [L]', fontsize = 20)
8 [Link]('Flow Rate [Q]', fontsize = 20)
9 [Link]()
10 [Link]()

1 g# Cambiando tamano de letra de los "ticks"


2
[Link] 15/71
7/18/2020 [Link] - Colaboratory
2
3 [Link](figsize = (16,8))
4 [Link](L,Q, lw = 6, c = 'red')
5
6 [Link]('Ley de Darcy', fontsize = 30)
7 [Link]('Longitud [L]', fontsize = 20)
8 [Link]('Flow Rate [Q]', fontsize = 20)
9 [Link](fontsize = 15)
10 [Link](fontsize = 15)
11 [Link]()
12 [Link]()

Matplotlib help us to edit the labels of the axis, title of the graph, etc. For it, we need to specify the
g which is the area that contains the plot, and ax is the plot itself.

WAVELET

1 # Import modules
2 import numpy as np
3 import [Link] as plt
4 %matplotlib inline
[Link] 16/71
7/18/2020 [Link] - Colaboratory

Ondicula de Ricker
2 2 2
2 2 2 −π f t
A = (1 − 2π f t )e

Revisar: [Link]

1 # Define parameters
2 freq = 15 # Frecuencia
3 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
4 dt = 4 # Tasa de muestreo

1 # Create time array


2 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000

1 # Define Ricker Wavelet


2 ricker = (1 - 2 * [Link]**2 * freq**2 * t**2) * [Link](-[Link]*

1 # Plot results
2 [Link](t,ricker)
3 [Link]()

[Link] 17/71
7/18/2020 [Link] - Colaboratory

1 # Resumiendo - Todo en misma linea de codigo


2 freq = 5 # Frecuencia [Hz]
3 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
4 dt = 4 # Tasa de muestreo
5
6 [# Create time array
7 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
8
9 # Define Ricker Wavelet
10 ricker = (1 - 2 * [Link]**2 * freq**2 * t**2) * [Link](-[Link]*
11
12 [Link](t,ricker)
13 [Link]()
14

1 # Diferentes FRECUENCIAS
2 freq_1 = 5 # Frecuencia [Hz]
3 freq_2 = 50 # Frecuencia [Hz]
[Link] 18/71
7/18/2020 [Link] - Colaboratory

4 tn = 500 # Longitud de mi ondicula (en tiempo!!!)


5 dt = 4 # Tasa de muestreo
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker_1 = (1 - 2 * [Link]**2 * freq_1**2 * t**2) * [Link](-np
12 ricker_2 = (1 - 2 * [Link]**2 * freq_2**2 * t**2) * [Link](-np
13
14 [Link](t,ricker_1)
15 [Link](t,ricker_2)
16 [Link]()

1 # Mejorar grafico
2 freq_1 = 5 # Frecuencia [Hz]
3 freq_2 = 50 # Frecuencia [Hz]
4 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
5 dt = 4 # Tasa de muestreo
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker_1 = (1 - 2 * [Link]**2 * freq_1**2 * t**2) * [Link](-np
12 ricker_2 = (1 - 2 * [Link]**2 * freq_2**2 * t**2) * [Link](-np
13
14 [Link](t,ricker_1, c = 'r')
15 lt l t(t i k 2 'b')
[Link] 19/71
7/18/2020 [Link] - Colaboratory
15 [Link](t,ricker_2, c = 'b')
16 [Link]()

Cambiar el tamano de la gura

1 # Mejorar grafico
2 freq_1 = 5 # Frecuencia [Hz]
3 freq_2 = 50 # Frecuencia [Hz]
4 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
5 dt = 4 # Tasa de muestreo
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker_1 = (1 - 2 * [Link]**2 * freq_1**2 * t**2) * [Link](-np
12 ricker_2 = (1 - 2 * [Link]**2 * freq_2**2 * t**2) * [Link](-np
13
14 # Cambiar tamano de grafico
15 [Link](figsize=(12,4))
16 [Link](t,ricker_1, c = 'r')
17 [Link](t,ricker_2, c = 'b')
18 [Link]()

[Link] 20/71
7/18/2020 [Link] - Colaboratory

1 # Mejorar grafico
2 freq_1 = 5 # Frecuencia [Hz]
3 freq_2 = 50 # Frecuencia [Hz]
4 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
5 dt = 4 # Tasa de muestreo
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker_1 = (1 - 2 * [Link]**2 * freq_1**2 * t**2) * [Link](-np
12 ricker_2 = (1 - 2 * [Link]**2 * freq_2**2 * t**2) * [Link](-np
13
14 # Cambiar tamano de grafico
15 [Link](figsize=(12,4))
16 [Link]("Comparacion de ondiculas de Ricker", fontsize = 30
17 [Link](t,ricker_1, c = 'r', label='Ondicula 1 (5 hz)')
18 [Link](t,ricker_2, c = 'b', label='Ondicula 2 (50 hz)')
19 [Link]('Tiempo [s]', fontsize = 20)
20 [Link]('Amplitud', fontsize = 20)
21 [Link]()
22 [Link](fontsize = 20)
23 [Link]()

[Link] 21/71
7/18/2020 [Link] - Colaboratory

1 # Mejorar Tasa de muestreo de ondicula


2 freq_1 = 5 # Frecuencia [Hz]
3 freq_2 = 50 # Frecuencia [Hz]
4 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
5 dt = 1 # Tasa de muestreo
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker_1 = (1 - 2 * [Link]**2 * freq_1**2 * t**2) * [Link](-np
12 ricker_2
t = (1 - 2 * [Link]**2 * freq_2**2 * t**2) * [Link](-np
13
14 # Cambiar tamano de grafico
15 [Link](figsize=(12,4))
16 [Link]("Comparacion de ondiculas de Ricker", fontsize = 30
17 [Link](t,ricker_1, c = 'r', label='Ondicula 1 (5 hz)')
18 [Link](t,ricker_2, c = 'b', label='Ondicula 2 (50 hz)')
19 [Link]('Tiempo [s]', fontsize = 20)
20 [Link]('Amplitud', fontsize = 20)
21 [Link]()
22 [Link](fontsize = 20)
23 [Link]()

[Link] 22/71
7/18/2020 [Link] - Colaboratory

Utilizando los condicionales, indicar que se llene los valores de la ondicula, utilizando la funcion

.fill_between()

o
1 # Datos de entrada
2 freq = 5 # Frecuencia [Hz]
3 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
4 dt = 1 # Tasa de muestreo
5
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker = (1 - 2 * [Link]**2 * freq**2 * t**2) * [Link](-[Link]*
12
13 # Graficar
14 [Link](figsize=(12,4))
15 [Link](t,ricker, lw=2, color='black')
16
17 plt.fill_between(t, ricker, 0, ricker >= 0.0, color='blue',
18 plt.fill_between(t, ricker, 0, ricker < 0.0, color='red', alp
19
20 [Link](t,ricker, lw=1, color='black')
21 [Link]()
22 [Link]()

[Link] 23/71
7/18/2020 [Link] - Colaboratory

Editar titulo, y ejes de gra ca:

1 # Datos de entrada
2 freq = 5 # Frecuencia [Hz]
3 tn = 500 # Longitud de mi ondicula (en tiempo!!!)
4 dt = 1 # Tasa de muestreo
5
6
7 # Create time array
8 t = [Link](-tn / 2, tn / 2 + dt, dt) / 1000
9
10 # Define Ricker Wavelet
11 ricker = (1 - 2 * [Link]**2 * freq**2 * t**2) * [Link](-[Link]*
12
13 # Graficar
14 [Link](figsize=(12,4))
15 [Link](t,ricker, lw=2, color='black')
16
17 plt.fill_between(t, ricker, 0, ricker >= 0.0, color='blue',
18 plt.fill_between(t, ricker, 0, ricker < 0.0, color='red', alp
19
20 [Link]('%d Hz Ricker wavelet' %freq, fontsize = 16 )
21 [Link]( 'two-way time (s)', fontsize = 14)
22 [Link]('amplitude', fontsize = 14)
23 [Link]((-1.1,1.1))
24 [Link]((min(t),max(t)))
25 [Link]()
26 [Link]()

[Link] 24/71
7/18/2020 [Link] - Colaboratory

CARGAR DATOS EN GDrive

1 from [Link] import drive


2 [Link]('/content/gdrive/')
Go to this URL in a browser: [Link]

Enter your authorization code:


··········
Mounted at /content/gdrive/

1 !ls
gdrive sample_data

1 import os
2 [Link]("/content/gdrive/My Drive/")

1 # Actualizar la ruta de donde debo importar los datos


2 import sys
3 [Link]('/content/gdrive/My Drive/Colab Notebooks/')

1 !ls

[Link] 25/71
7/18/2020 [Link] - Colaboratory

'AAPG-ICE edited [Link]'


'AAPG-ICE edited [Link]'
appsheet
[Link]
ColabNotebooks
'Colab Notebooks'
Colab_Notebooks
'Estratigrafia Sismica - Seismic Reflection Methos_Made in [Link]'
'Generation of a Seismic Brittleness Volume and its implication in the prediction of EUR
Usando datos locales
'Identification of brittle_ductile areas in unconventional reservoirs using seismic and
[Link]
'Mineralogy-based brittleness prediction from surface seismic data (1).pdf'
'Mineralogy-based brittleness prediction from surface seismic [Link]'
1 ML_UniAndes_Oct2019.pdf
from [Link] import files
d
2 ML_UniAndes_Oct2019.pptx
[Link]()
[Link]
SeismicReflectionMethod_MadeInOklahoma_Abstract.pdf
Choose Files No file chosen
{}

1 !ls
[Link] [Link] sample_data

RESUMEN
Opcion 1: "Montando" el GDrive, permite que la ruta de los archivos quede ja estatica en mi
codigo.
Option2: Es mas simple de usar, permite la interactividad con el usuario. Sin embargo, NO se
guarda en la memoria del la maquina (virtual), y no permitiria replicar los resultados de forma
automatica.

WELL LOGS

1 # Import modules
2 import [Link] as plt
3 import numpy as np
4 import pandas as pd

Cargar los datos

1 # Cargar datos en Google COLAB


[Link] 26/71
7/18/2020
g g
[Link] - Colaboratory

2
3 file = '/content/gdrive/My Drive/Colab Notebooks/F02-1_logs.l

Cargar datos en JUPYTER

file = 'F02-1_logs.las' # Well: F02-1_logs

Revisemos los datos:

1 data = [Link](file, skiprows = 35)


2 data
array([[ 4.80000000e+01, -9.99250000e+02, 5.24048500e+02, ...,
3.82025700e+06, -4.55695600e+02, -9.99250000e+02],
[ 4.81500000e+01, -9.99250000e+02, 5.24041000e+02, ...,
3.82031175e+06, -4.55695600e+02, -9.99250000e+02],
[ 4.83000000e+01, -9.99250000e+02, 5.24033600e+02, ...,
3.82036625e+06, -4.55695600e+02, -9.99250000e+02],
...,
[ 1.49955000e+03, 1.86164970e+03, 5.37190200e+02, ...,
3.46552400e+06, -2.39115938e+05, -9.99250000e+02],
[ 1.49970010e+03, 1.88039780e+03, 5.37263000e+02, ...,
3.49995775e+06, -2.39115938e+05, -9.99250000e+02],
[ 1.49985010e+03, 1.85633500e+03, 5.37383100e+02, ...,
3.45440400e+06, -2.12640703e+05, -9.99250000e+02]])

Mnemonicos

1 mnemonics = ['DEPTH', 'RHOB', 'DT', 'GR', 'AI', 'AI_REL', 'PH

Set null value

Inspecting the le we notice that the null value is -999.2500.

1 data[data == -999.2500] = [Link]


2 print(data)

[Link] 27/71
7/18/2020 [Link] - Colaboratory

[[ 4.80000000e+01 nan 5.24048500e+02 ... 3.82025700e+06


-4.55695600e+02 nan]
[ 4.81500000e+01 nan 5.24041000e+02 ... 3.82031175e+06
-4.55695600e+02 nan]
[ 4.83000000e+01 nan 5.24033600e+02 ... 3.82036625e+06
-4.55695600e+02 nan]
...
Convert well into a pandas1.86164970e+03
[ 1.49955000e+03 DataFrame 5.37190200e+02 ... 3.46552400e+06
-2.39115938e+05 nan]
[ 1.49970010e+03 1.88039780e+03 5.37263000e+02 ... 3.49995775e+06
1 data = [Link](data,
-2.39115938e+05 nan] columns=mnemonics)
[ 1.49985010e+03 1.85633500e+03 5.37383100e+02 ... 3.45440400e+06
2 print(data)
-2.12640703e+05 nan]]

DEPTH RHOB DT GR AI AI_REL PHIE


0 48.0000 NaN 524.0485 NaN 3820257.00 -455.6956 NaN
1 48.1500 NaN 524.0410 NaN 3820311.75 -455.6956 NaN
2 48.3000 NaN 524.0336 NaN 3820366.25 -455.6956 NaN
3 48.4500 NaN 524.0262 NaN 3820419.75 -455.6956 NaN
4 48.6000 NaN 524.0190 NaN 3820472.25 -455.6956 NaN
... ... ... ... ... ... ... ...
9675 1499.2500 1787.5444 532.1727 27.6273 3359011.00 -239115.9375 NaN
9676 1499.4000 1814.1691 534.8610 28.5281 3391772.00 -239115.9375 NaN
9677 1499.5500 1861.6497 537.1902 28.5813 3465524.00 -239115.9375 NaN
9678 1499.7001 1880.3978 537.2630 28.5813 3499957.75 -239115.9375 NaN
9679 1499.8501 1856.3350 537.3831 27.9759 3454404.00 -212640.7031 NaN

[9680 rows x 7 columns]

1 data

DEPTH RHOB DT GR AI AI_REL PHIE

0 48.0000 NaN 524.0485 NaN 3820257.00 -455.6956 NaN

1 48.1500 NaN 524.0410 NaN 3820311.75 -455.6956 NaN

2 48.3000 NaN 524.0336 NaN 3820366.25 -455.6956 NaN

3 48.4500 NaN 524.0262 NaN 3820419.75 -455.6956 NaN

4 48.6000 NaN 524.0190 NaN 3820472.25 -455.6956 NaN

... ... ... ... ... ... ... ...

9675 1499.2500 1787.5444 532.1727 27.6273 3359011.00 -239115.9375 NaN

9676 1499.4000 1814.1691 534.8610 28.5281 3391772.00 -239115.9375 NaN

9677 1499.5500 1861.6497 537.1902 28.5813 3465524.00 -239115.9375 NaN

9678 1499.7001 1880.3978 537.2630 28.5813 3499957.75 -239115.9375 NaN

9679 1499.8501 1856.3350 537.3831 27.9759 3454404.00 -212640.7031 NaN

9680 rows × 7 columns

1 data head()
[Link] 28/71
7/18/2020 [Link] - Colaboratory
1 [Link]()

DEPTH RHOB DT GR AI AI_REL PHIE

0 48.00 NaN 524.0485 NaN 3820257.00 -455.6956 NaN

1 48.15 NaN 524.0410 NaN 3820311.75 -455.6956 NaN

2 48.30 NaN 524.0336 NaN 3820366.25 -455.6956 NaN

3 48.45 NaN 524.0262 NaN 3820419.75 -455.6956 NaN

4 48.60 NaN 524.0190 NaN 3820472.25 -455.6956 NaN

1 [Link]()

DEPTH RHOB DT GR AI AI_REL

count 9680.000000 8253.000000 9680.000000 9666.000000 9.680000e+03 9680.000000 4

mean 773.925016 1975.091074 495.026839 46.613531 4.078518e+06 5193.728898

std 419.177962 294.677828 50.861145 23.484662 8.776878e+05 193455.679167

min 48.000000 1350.444700 368.114700 1.339200 2.035267e+06 -617319.750000

25% 410.962500 1812.400000 460.693600 23.527000 3.658766e+06 -95113.828100

50% 773.925000 2096.345000 505.393400 48.765250 3.953107e+06 2603.301500

75% 1136.887575 2210.906000 521.642300 63.162950 4.782770e+06 93553.453100

max 1499.850100 2346.629200 667.920800 129.177300 5.983779e+06 629867.000000

Create a new dataFrame but with specify columns (tracks)

1 subgroup_data = data[['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']] #


2 subgroup_data = subgroup_data.values
3 print(subgroup_data)
[[ 48. nan 524.0485 nan nan]
[ 48.15 nan 524.041 nan nan]
[ 48.3 nan 524.0336 nan nan]
...
[1499.55 1861.6497 537.1902 28.5813 nan]
[1499.7001 1880.3978 537.263 28.5813 nan]
[1499.8501 1856.335 537.3831 27.9759 nan]]

1 file = '/content/gdrive/My Drive/Colab Notebooks/F02-1_logs.l


2
3 data = [Link](file, skiprows = 35)
4
[Link] 29/71
7/18/2020 [Link] - Colaboratory

5 mnemonics = ['DEPTH', 'RHOB', 'DT', 'GR', 'AI', 'AI_REL', 'PH


6
7 data = [Link](data, columns=mnemonics)
8
9 subgroup_data = data[['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']] #
10 subgroup_data = subgroup_data.values

Plot

Select the number of columns to plot

1 [Link](subgroup_data[:,1], subgroup_data[:,0])
[<[Link].Line2D at 0x7f4ffc2aae48>]

1 DEPTH = subgroup_data[:,0]
2 RHOB = subgroup_data[:,1]

1 [Link](RHOB, DEPTH)

[Link] 30/71
7/18/2020 [Link] - Colaboratory

[<[Link].Line2D at 0x7f4ffc1b74a8>]

1 [Link](figsize=(4,10))
2 [Link](RHOB, DEPTH)
[<[Link].Line2D at 0x7f4ffd1c40b8>]

1 GR = subgroup_data[:,3]

1 file = '/content/gdrive/My Drive/Colab Notebooks/F02-1_logs.l


2
3 data = [Link](file, skiprows = 35)
4
5 data[data==-999.2500]=[Link]
6
7 mnemonics = ['DEPTH', 'RHOB', 'DT', 'GR', 'AI', 'AI_REL', 'PH
[Link] 31/71
7/18/2020 [Link] - Colaboratory

8
9 data = [Link](data, columns=mnemonics)
10
11 subgroup_data = data[['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']] #
12 subgroup_data = subgroup_data.values
13
14 DEPTH = subgroup_data[:,0]
15 RHOB = subgroup_data[:,1]
16 GR = subgroup_data[:,3]
17
18 [Link](figsize=(4,10))
19 [Link](RHOB, DEPTH)
[<[Link].Line2D at 0x7f4ffc2bd470>]

1 [Link](GR, RHOB)
[Link] 32/71
7/18/2020 [Link] - Colaboratory

[<[Link].Line2D at 0x7f4ffbba17f0>]

1 [Link](GR, RHOB)
<[Link] at 0x7f4ffc45b0f0>

1 [Link](figsize = (12,8))
2 [Link](GR, RHOB, c = 'r', s = 2)
3 [Link]('GR vs RHOB', fontsize = 'xx-large')
4 [Link]('GR [API]', fontsize = 20)
5 [Link]('RHOB [g/cc]', fontsize = 20)
6 [Link]()
7 [Link]()

[Link] 33/71
7/18/2020 [Link] - Colaboratory

Subplots

las: 2

columnas: 2

[Link] 34/71
7/18/2020 [Link] - Colaboratory

Dudas con Matplotlib?

[Link] le/d/1kwYFaRjCOmKXGpOHZdDgxJ4gfAMpJ195/view

[Link] 35/71
7/18/2020 [Link] - Colaboratory

1 rows, cols = 1, 4
2 fig, ax = [Link](nrows = rows, ncols = cols, figsize =
3 ax[0].plot(RHOB, DEPTH)
4 [Link]()

[Link] 36/71
7/18/2020 [Link] - Colaboratory

Notice that the y-axis is backward. For that reason we need to manipulate the axis. Since we have
fours axis (columns), we need to specify the maximum and the minimum values of the axis we
would like to manipulate, in this case will be the rst (0).

1 fix, ax = [Link](nrows = rows, ncols = cols, figsize =


2 ax[0].plot(RHOB, DEPTH)
3 ax[0].set_ylim(max(DEPTH), min(DEPTH))
4 plt show()
[Link] 37/71
7/18/2020 [Link] - Colaboratory
4 [Link]()

[Link] 38/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12
13 ax[1].plot(DT, DEPTH)
14
15 ax[2].plot(GR, DEPTH)
16
17 ax[3].plot(PHIE, DEPTH)
18
19 [Link]()

[Link] 39/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup data[:,2]
[Link] 40/71
7/18/2020 [Link] - Colaboratory
5 DT subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12
13 ax[1].plot(DT, DEPTH)
14 ax[1].set_ylim(max(DEPTH), min(DEPTH))
15
16 ax[2].plot(GR, DEPTH)
17 ax[2].set_ylim(max(DEPTH), min(DEPTH))
18
19 ax[3].plot(PHIE, DEPTH)
20 ax[3].set_ylim(max(DEPTH), min(DEPTH))
21
22 [Link]()

[Link] 41/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12
13 ax[1].plot(DT, DEPTH)
14 #ax[1].set_ylim(max(DEPTH), min(DEPTH))
15
[Link] 42/71
7/18/2020 [Link] - Colaboratory
15
16 ax[2].plot(GR, DEPTH)
17 #ax[2].set_ylim(max(DEPTH), min(DEPTH))
18
19 ax[3].plot(PHIE, DEPTH)
20 #ax[3].set_ylim(max(DEPTH), min(DEPTH))
21
22 [Link]()

[Link] 43/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH, c = 'red')
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12
13 ax[1].plot(DT, DEPTH, c = 'green')
14 #ax[1].set_ylim(max(DEPTH), min(DEPTH))
15
16 ax[2].plot(GR, DEPTH, c = 'black')
17 #ax[2].set_ylim(max(DEPTH), min(DEPTH))
18
19 ax[3].plot(PHIE, DEPTH, c = 'magenta')
20 #ax[3].set_ylim(max(DEPTH), min(DEPTH))
21
22 [Link]()

[Link] 44/71
7/18/2020 [Link] - Colaboratory

[Link] 45/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH, c = 'red', lw = 0.5)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12
13 ax[1].plot(DT, DEPTH, c = 'green', lw = 0.5)
14 #ax[1].set_ylim(max(DEPTH), min(DEPTH))
15
16 ax[2].plot(GR, DEPTH, c = 'black', lw = 0.5)
17 #ax[2].set_ylim(max(DEPTH), min(DEPTH))
18
19 ax[3].plot(PHIE, DEPTH, c = 'magenta', lw = 0.5)
20 #ax[3].set_ylim(max(DEPTH), min(DEPTH))
21
22 [Link]()

[Link] 46/71
7/18/2020 [Link] - Colaboratory

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
[ ]
[Link] 47/71
7/18/2020 [Link] - Colaboratory

5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH, c = 'red', lw = 0.5)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12 ax[0].set_title('Densidad [g/cc]')
13 ax[0].grid()
14
15 ax[1].plot(DT, DEPTH, c = 'green', lw = 0.5)
16 #ax[1].set_ylim(max(DEPTH), min(DEPTH))
17 ax[1].set_title('DT [1/ms]')
18 ax[1].grid()
19
20 ax[2].plot(GR, DEPTH, c = 'black', lw = 0.5)
21 #ax[2].set_ylim(max(DEPTH), min(DEPTH))
22 ax[2].set_title('Gamma Ray [API]')
23 ax[2].grid()
24
25 ax[3].plot(PHIE, DEPTH, c = 'magenta', lw = 0.5)
26 #ax[3].set_ylim(max(DEPTH), min(DEPTH))
27 ax[3].set_title('Porosidad Effect')
28 ax[3].grid()
29
30 [Link]()

[Link] 48/71
7/18/2020 [Link] - Colaboratory

Aplicando los conocimientos previos, podemos seleccionar un cut-off y rellenar la curva de acuerdo
a dicho cut-off:

1 # ['DEPTH', 'RHOB', 'DT', 'GR', 'PHIE']


2
[Link] 49/71
7/18/2020 [Link] - Colaboratory

3 DEPTH = subgroup_data[:,0]
4 RHOB = subgroup_data[:,1]
5 DT = subgroup_data[:,2]
6 GR = subgroup_data[:,3]
7 PHIE = subgroup_data[:,4]
8
9 fix, ax = [Link](nrows = rows, ncols = cols, figsize =
10 ax[0].plot(RHOB, DEPTH, c = 'red', lw = 0.5)
11 ax[0].set_ylim(max(DEPTH), min(DEPTH))
12 ax[0].set_title('Densidad [g/cc]')
13 ax[0].grid()
14
15 ax[1].plot(DT, DEPTH, c = 'green', lw = 0.5)
16 #ax[1].set_ylim(max(DEPTH), min(DEPTH))
17 ax[1].set_title('DT [1/ms]')
18 ax[1].grid()
19
20 ax[2].plot(GR, DEPTH, c = 'black', lw = 0.5)
21 #ax[2].set_ylim(max(DEPTH), min(DEPTH))
22 ax[2].set_title('Gamma Ray [API]')
23
24 # Cut-off
25 cut_off = GR*0+50 # Cut-off es 50 API
26 ax[2].fill_betweenx(DEPTH, GR,cut_off, where=(GR>=cut_off), c
27 ax[2].fill_betweenx(DEPTH, GR,cut_off, where=(GR< cut_off), c
28 ax[2].grid()
29
30 ax[3].plot(PHIE, DEPTH, c = 'magenta', lw = 0.5)
31 #ax[3].set_ylim(max(DEPTH), min(DEPTH))
32 ax[3].set_title('Porosidad Effect')
33 ax[3].grid()
34
35 [Link]()

[Link] 50/71
7/18/2020 [Link] - Colaboratory

[Link] 51/71
7/18/2020 [Link] - Colaboratory

MANERA OPCIONES DE INCLUIR DATOS

Now we can repeat the code in order to ll the other tracks, but replacing each index with the
corresponding column index.

1 fix, ax = [Link](nrows = rows, ncols = cols, figsize =


2 ax[0].plot(data[:,1], data[:,0])
3 ax[0].set_ylim(max(data[:,0]), min(data[:,0]))
4
5 ax[1].plot(data[:,2], data[:,0])
6 ax[1].set_ylim(max(data[:,0]), min(data[:,0]))
7
8 ax[2].plot(data[:,3], data[:,0])
9 ax[2].set_ylim(max(data[:,0]), min(data[:,0]))
10
11 ax[3].plot(data[:,4], data[:,0])
12 ax[3].set_ylim(max(data[:,0]), min(data[:,0]))
13 [Link]()

[Link] 52/71
7/18/2020 [Link] - Colaboratory

However, this approach is not practical. Analyzing the code we see that there is pattern that we can
optimize using some of the tools reviewed previously, for example the For loop.

1 fix, ax = [Link](nrows = rows, ncols = cols, figsize =


2
3 for i in range(cols):
4 ax[i].plot(data[:,i+1], data[:,0])
5 ax[i].set_ylim(max(data[:, 0]), min(data[:, 0]))
6 [Link]()

[Link] 53/71
7/18/2020 [Link] - Colaboratory

[Link] 54/71
7/18/2020 [Link] - Colaboratory

Now is time to add other things into the graph such as a grid with different colors, tick (minor), and
the title of each plot using the mnemonics.

1 fix, ax = [Link](nrows = rows, ncols = cols, figsize =


2
3 for i in range(cols):
4 ax[i].plot(data[:,i+1], data[:,0],linewidth='0.5')
5 ax[i].set_ylim(max(data[:, 0]), min(data[:, 0]))
6 ax[i].minorticks_on()
7 ax[i].grid(which='major', linestyle='-', linewidth='0.5',
8 ax[i].grid(which='minor', linestyle=':', linewidth='0.5',
9 ax[i].set_title('%s' %mnemonics[i], fontsize='22') #title
10 [Link]()

[Link] 55/71
7/18/2020 [Link] - Colaboratory

An extra feature may be edit (or remove) the space between tracks (plots), using the function (out
of the loop):

plt.subplots_adjust(wspace=0)

It controls the amount of width reserved for space between subplots, expressed as a fraction of the
average axis width.

1 fix, ax = [Link](nrows = rows, ncols = cols, figsize =


2
3 for i in range(cols):
[Link] 56/71
7/18/2020 [Link] - Colaboratory
3 for i in range(cols):
4 ax[i].plot(data[:,i+1], data[:,0],linewidth='0.5')
5 ax[i].set_ylim(max(data[:, 0]), min(data[:, 0]))
6 ax[i].minorticks_on()
7 ax[i].grid(which='major', linestyle='-', linewidth='0.5',
8 ax[i].grid(which='minor', linestyle=':', linewidth='0.5',
9 ax[i].set_title('%s' %mnemonics[i], fontsize='22') #title
10
11 plt.subplots_adjust(wspace=0)
12 [Link]()

[Link] 57/71
7/18/2020 [Link] - Colaboratory

SEISMIC

1 # Import modules
2 import numpy as np
3 import segyio
4 import [Link] as plt

1 !pip install segyio # Recuerden que deben importar esta libre


Collecting segyio
Downloading [Link]
|████████████████████████████████| 92kB 2.5MB/s
Requirement already satisfied: numpy>=1.10 in /usr/local/lib/python3.6/dist-packages (fr
Installing collected packages: segyio
Successfully installed segyio-1.9.1

1 # Load file from hard drive


2 filename = '/content/gdrive/My Drive/Colab Notebooks/Penobsco

[Link] 58/71
7/18/2020 [Link] - Colaboratory

Cargar datos en Jupyter

filename = 'Penobscot_0-[Link]'

1 import numpy as np
2 import segyio
3 import [Link] as plt
4
5 filename = '/content/gdrive/My Drive/Colab Notebooks/Penobsco
6
7 with [Link](filename) as s:
8 c = [Link](s)

1 # Use segyio
2
3 with [Link](filename) as s:
4 c = [Link](s)

1 type(c)
[Link]

1 [Link]
(601, 481, 251)

[Link] 59/71
7/18/2020 [Link] - Colaboratory

1 # Plot seismic
2 # [Link](c[x, y, z])
3
4 # [Link](c[inline, crossline, timeslice])
5
6 [Link](c[150,:,:],)
7 [Link]()

Se recuerdan de la funcion .T de `numpy, la cual permitia calcular la transpuesta de una matriz?

1 # Plot seismic
2 [Link](c[150,:,:].T)
3 [Link]()

[Link] 60/71
7/18/2020 [Link] - Colaboratory

Ahora podemos cambiar la escala de colores, cambiando el parametro cmap .

1 # Plot seismic
2 [Link](c[150,:,:].T, cmap = 'Greys')
3 [Link]()

1 [Link](c[150,:,:].T, vmin=-1000, vmax = 1000, cmap = 'Gre


2 lt h ()
[Link] 61/71
7/18/2020 [Link] - Colaboratory
2 [Link]()

Ajustar los valores minimos y maximos (de forma dinamica)

1 ma = [Link](c, 98)
2 ma
4247.0

1 [Link](c[150,:,:].T, vmin=-ma, vmax = ma, cmap = 'Greys')


2 [Link]()

Agregar escala de colores

1 [Link](c[150,:,:].T, vmin=-ma, vmax = ma, cmap = 'Greys')


2 [Link]()
3 [Link]()

[Link] 62/71
7/18/2020 [Link] - Colaboratory

Detalles como ejes, titulo, asi como el aspect ratio

1 # Plot INLINE
2 [Link](figsize=(18,6))
3 [Link](c[150,:,:].T, vmin=-ma, vmax = ma, cmap = 'Greys',
4 [Link]()
5 [Link]('INLINE', fontsize=20)
6 [Link]('Time (ms)')
7 [Link]()

1 # Plot XLINE
2 [Link](figsize=(18,6))
3 [Link](c[:,240,:].T, vmin=-ma, vmax = ma, cmap = 'Greys',
4 [Link]()
5 [Link]('XLINE', fontsize=20)
6 lt l b l('Ti ( )')
[Link] 63/71
7/18/2020 [Link] - Colaboratory
6 [Link]('Time (ms)')
7 [Link]()

1 # Plot TIMESLICE
2 [Link](figsize=(14,10))
3 [Link](c[:,:,125].T, vmin=-ma, vmax = ma, cmap = 'seismic
4 [Link]()
5 [Link]('TIMESLICE', fontsize=20)
6 [Link]('Inline')
7 [Link]('Xline')
8 [Link]()

[Link] 64/71
7/18/2020 [Link] - Colaboratory

1 # Plot TIMESLICE
2 time_slice = 200
3
4 [Link](figsize=(14,10))
5 [Link](c[:,:,time_slice].T, vmin=-ma, vmax = ma, cmap = '
6 [Link]()
7 [Link]('TIME SLICE = %d ms' %time_slice, fontsize=20)
8 [Link]('Inline', fontsize=16)
9 [Link]('Xline', fontsize=16)
10 [Link]()

[Link] 65/71
7/18/2020 [Link] - Colaboratory

PRODUCCION

Importar librerias

1 import [Link] as plt


2 import math

Cuantos valores tiene mi arreglo de tasas de produccion?


Gra quen USTEDES en un gra co, los valores de produccion

Importar datos:

Datos de produccion

1 well_rate = [248.956137704918, 434.084242622951, 383.69618688


2 225.643954098361, 208.289740983607, 168.05436393
3 133.21188852459, 112.300216393443, 114.898708196
4 204.845708196721, 186.109757377049, 153.19140327
5 142.323108196721, 144.104931147541, 130.75981967
6 119.386262295082, 120.372039344262]

1 len(well_rate)
27

plot(x, y)

[Link] 66/71
7/18/2020 [Link] - Colaboratory

x y y tienen que tener la misma longitud

Datos de fecha

Se puede calcular de forma manual

1 t = [1, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330,
2 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660,
3 690, 720, 750, 780]
4 len(t)
27

O podemos realizar el analisis a traves del uso de la funcion [Link](inicio, final, step) :

1 dias = 27 * 30
2 dias
810

1 tiempo = [Link](1,dias,30)
2 tiempo
array([ 1, 31, 61, 91, 121, 151, 181, 211, 241, 271, 301, 331, 361,
391, 421, 451, 481, 511, 541, 571, 601, 631, 661, 691, 721, 751,
781])

1 k = 0
2 for i in tiempo:
3 tiempo[k] -= 1
4 k += 1
5
6 tiempo
array([ 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360,
390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750,
780])

1 len(time)

[Link] 67/71
7/18/2020 [Link] - Colaboratory

27
Codigo completo (alternativo) de generar la escala de valores de tiempo:

1 dias = 27 * 30
2 tiempo = [Link](1,dias,30)
3 k = 0
4 for i in tiempo:
5 tiempo[k] -= 1
6 k += 1
7
8 tiempo
array([ 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360,
390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750,
780])

Procedemos a gra car los valores de produccion, en funcion del la lista de dias ( t ) que generamos
de forma manual:

1 [Link](t,well_rate,"x",color = 'black')
2 [Link]()

Luego, podemos realizar un ajuste de los datos de produccion a una curva, por ejemplo la curva de
ajuste de "Doung":
a 1−m
−3 (t −1)
q = qi t e 1−m

El método duong fue desarrollado especí camente para depósitos no convencionales con muy
baja permeabilidad. La forma de la curva es adecuada para pozos que exhiben largos períodos de

[Link] 68/71
7/18/2020 [Link] - Colaboratory

ujo transitorio. El método duong alcanzará un eur nito, y tiende a ser más conservador que los
descensos tradicionales de Arps con b> 1.

Referencia: [Link]
Primero, procedemos a seleccionar parametros iniciales de mi aproximacion:

1 qi = well_rate[0] # Produccion inicial


2 m = 1.18
3 a = 1.8

Suposiciones:

Produccion de 90 m3 /d

1 # Ajustar ecuacion
2 f
q2 = []
3 for x in t:
4 qx = (qi * [Link](x,-m))* [Link]((a / (1 - m)) * ((ma
5 if qx < 90:
6 qx = 0
7 [Link](qx)
8
9 print(q2)
[248.956137704918, 438.070516922889, 365.17987542930115, 316.9576744515737, 282.53663669

Gra car resultados

1 [Link](t,q2,color='green')
2 [Link](t,well_rate,"x",color = 'black')
3 [Link]()

[Link] 69/71
7/18/2020 [Link] - Colaboratory

Ajustar parametros de gra co

1 # Parametros iniciales
2 qi = 250.0 # Produccion inicial
3 m = 1.18
4 a = 1.8
5
6 # Ajustar ecuacion
7 q2 = []
8 for x in t:
9 qx = (qi * [Link](x,-m))* [Link]((a / (1 - m)) * ((ma
10 if qx < 90:
11 qx = 0
12 [Link](qx)
13
14
15 # Graficar resultados
16 [Link](figsize=(16,8))
17 [Link](t,q2,color='green', lw=4, label='$q_{i}$ %d (b/d) Do
18 [Link](t,well_rate,"o",color = 'red', lw=5, label='Producci
19 [Link]('Ajuste de Produccion de Pozo', fontsize = 40)
20 [Link]('Tiempo (dias)', fontsize = 30)
21 [Link]('Produccion (barriles/dia', fontsize = 30)
22 [Link]([0,900])
23 [Link](fontsize = 20)
24 [Link](fontsize = 20)
25 [Link]()
26 [Link](fontsize = 20)
27 [Link]()
28
29 [Link]('[Link]')

[Link] 70/71
7/18/2020 [Link] - Colaboratory

<Figure size 432x288 with 0 Axes>

FELICITACIONES HEMOS FINALIZADO EL CURSO!!!

Encuesta POST curso: [Link]

RESUMEN DEL CURSO


Introduccion a Python
Uso de Python en Exploracion Minera

Gra car informacion de datos en mapa (folium)


Gra cas de radar (elementos en muestras de roca)
Modelado estructural (GemPy)
Python en Exploracion de Hidrocarburos

Declaraciones de ujos de control & Ciclos

[Link] 71/71

También podría gustarte