<h1><center>Basic Python for Geosciences</center></h1>

<h1><center>Session 1</center></h1>

Put your name here

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 1: </b>
    
If the Average velocity to the target is 3000 m/sec and the target depth is 5000 m, calculate the two way time to the target according to the following formula:

\begin{align}
TWT=2*( \frac{Depth}{Velocity})
\end{align}

Define the variables and use the formula to obtain the TWT.

</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 2: </b>
    
The relation between velocity and depth is related according to the following formula:

    
\begin{align}
Velocity (m/sec)=2800 + 0.7 * Depth (m)
\end{align}

    
* What is the Velocity (m/sec) at 3000 meters?  
* What is the Velocity (m/sec) at 6000 feet?  

The conversion factor from ft to m is 0.3048

</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 3: </b>
    
* How much time takes a wave to travel through water in 2220 m, V=1500 m/s? 
* How much time takes a wave to travel through air  in 500 m, V=340 m/s?
* Write a small piece of code in Python to calculate the travel times and also find which is longer.
    
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 4: </b> Write a dictionary with the following composition (weight %) of a granite:
    
    Quartz       25   
    Orthoclase   50   
    Plagioclase  10   
    Micas        10   
    Anphibole     5   
  
Using Python, present the values for orthoclase and micas
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 5: </b> Write in Python a variable with the following string:

"A subsurface body of rock having sufficient porosity and permeability to store and transmit fluids. Metamorphic rocks are the most common reservoir rocks because they have more porosity than most igneous and sedimentary rocks and form under temperature conditions at which hydrocarbons can be preserved. A reservoir is a critical component of a complete petroleum system."
      
* Print the variable in the screen   
* Correct the mistakes in the variable using the replace method   
* Verify if temperature is in the string   
* Verify if kritical is in the string   
* What is the string length?   
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 6: </b> These are the horizon tops and its depths (m):

    Surface       0  
    Cretaceous 1500  
    Jurassic   2000  
    Triassic   3000  
    Paleozoic  4500  

Write one tuple with the horizons name and the corresponding depths. Print the name and the depth of the third horizon in the list.
  
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 7: </b>These are the horizon tops and its depths (m):

    Surface       0  
    Cretaceous 1500   
    Jurassic   2000   
    Triassic   3000   
    Paleozoic  4500   

* Store the list of horizons and its corresponding depths in a list variable  
* Print the lists  
* Print the name and the depth of the third horizon in the list  
* What is the maximum depth?  
* What is the minimum depth?  
* What is the average depth?  
* How many horizons are in the list  
* Verify that the number of horizons names and number of horizons tops are the same
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 8: </b>Create a matrix (list of lists) with the following values:


    | 6   8  12  24  33|  
    |11   4  12   6  67|  
    |23   9  67  10  43|  
    | 1  12  34  18   2|   
    | 7  11   2  23  78|   
    | 8  24   1   5  23|  

* Print the matrix  
* Print the row 3  
* Calculate the dimensions of the matrix  
* Print the element [3,4]  
* What is the minimum of the line 3  
* What is the maximum of the line 2  
</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 9: </b>
    
* Generate a 5x5 matrix of constant value equal to 10  
* Generate a random 6x6 matrix
* Print the values of the third column of both arrays    
* Print the attributes of both matrices    
* Generate a 3 million elements array and calculate all its attributes    

</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 10: </b>Generate two 5x5 matrices, one with constant value equal to 10, and the other with random values

* Determine if the matrices are singular (Determinant=0)    
* Calculate the inverse of the matrices    
* Sum both matrices    
* Convert the constant matrix to zero matrix    

</div>


```python

```

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 11: </b>Solve the following Linear equations system:

\begin{align}
1x+3y-2z = 5  \\
3x+5y+6z = 7  \\
2x+4y+3z = 8  
\end{align}

Remember the linear system can be represented in linear algebra as dot product of the corresponding arrays:

\begin{align}
A \cdot x=b
\end{align}


The solution will be:

\begin{align}
x=A^{-1} \cdot b
\end{align}


</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 12: </b>
    
* Create a NumPy array with some random values
* Calculate the maximum and the minimum of the array
* Calculate the Average of the terms
* Print the numbers rounded to 6 decimals

</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 13: </b>
    
Practice with a couple of examples on how to convert between float, int and str 

</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 14: </b>
    
In a cell write a small program for temperature conversion between Celsius to Fahrenheit with user interactive input

</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 15: </b> Generate a range between 1 and 3000000

* Calculate the average
* Calculate the minimum
* Calculate the maximum

</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 16: </b> Create a function to convert from Fahrenheit to Celsius

</div>

<div class="alert alert-block alert-warning">
<font size="6"><p> &#127947;</font> 
    <b>Exercise 17: </b> Create a function to calculate and return the following values of a list:
    
* Average
* Minimum
* Maximum
</div>

f240225efa4dcb0e91ae721d89f952e003172154
ipynb
Jupyter Notebook
Session_1/Session_1_exercises.ipynb
mdsoto/log_analysis_usb_aapg
4faf60a5c3a3f0f2e07c12c63e93fc4f3b32f57e
MIT
2021-09-30T09:26:02.000Z
2021-09-30T09:26:02.000Z
Session_1/Session_1_exercises.ipynb
mdsoto/USB_AAPG_2021
4faf60a5c3a3f0f2e07c12c63e93fc4f3b32f57e
MIT
Session_1/Session_1_exercises.ipynb
mdsoto/USB_AAPG_2021
4faf60a5c3a3f0f2e07c12c63e93fc4f3b32f57e
MIT
Qwen/Qwen-72B
1. YES
2. YES