# 6.4: Earthquake Distance and Magnitude Jupyter Notebook

- Page ID
- 11990

Instructions

- To use this page, read the text between each of the python code windows, then press RUN to execute the code in the box.
- It is necessary to run each of the boxes in order.
- Don't click restart in the cells unless you come back to the top of the page and start over.
- If you modify the code, this modification will not remain after you leave or refresh this page.
- You must run simulations/cells that require user input to completion. Make sure you see the Message informing you a cell is complete before continuing to the next cell. Here's why you must do this:
- These cells may not be re-run until the simulation is completed, otherwise no output will be generated.
- All following cells will not run until the user input cell is completed.

- For Dropdown Menus: You do not need to rerun the cells with the menu to change your selection. However, you must rerun all of the following cells to implement the change.

Be patient, some times it can take 1-2 minutes for the juypter kernel to start.

An interactive example of calculating the distance from an earthquake from seismic wave arrivals and magnitude from the empirical formula for Richter Magnitude.

**Key Questions:** Consider these as you work your way through this page.

For Earthquake Distance:

- Compare the distance predicted for the same ts-tp time for different rock types: which rock type gives the largest distance? Explain why.

For Richter Magnitude:

- As you increase the seismogram amplitude, does the magnitude increase, decrease, or stay the same?
- Can you generate an unrealistic magnitude (M \(\geq\) 10)? If so, why? If not, which parameter value prevents this?

First, we import the necessary libraries and create a dictionary containing p and s-wave velocities in different materials.

### Earthquake Distance

Now, let's learn about how we can determine how far away we are from an earthquake from a seismogram. The p and s-wave arrival times can be picked from a seismogram, and their difference between them is related to how far away the earthquake was. In this cell, you will be prompted to enter the difference in arrival times of the waves. That information will be used to calculate the distance between you and the earthquake assuming the waves are traveling through a layer of granite. The function distance_from_eq accomplishes this, and the formula is derived in 6.3: Location and Focal Mechanisms.

Now let's explore how different materials affect the results. Changing the material will change the p and s-wave velocities. This cell will prompt you to select a new arrival time difference and allow you to pick a material. Note: To change the material later on, you do not need to rerun this cell, simply change the dropdown menu selection. However, you will need to run all cells after this one.

Now run the next cell to do the calculation, do this for all the materials and consider the key questions.

### Richter Magnitude

Now let's take it a step further and calculate the Richter Magnitude. The Richter Magnitude depends on the amplitude on a Wood-Anderson Seismometer and the distance from the earthquake. This cell will prompt you to select an arrival time difference and a material type for this model.

This cell will first calculate the distance from the earthquake just like before. However, to calculate magnitude we will also need the seismometer amplitude so you will be prompted to enter that here. To calculate the magnitude, the function richter_magnitude is defined. This formula is shown partially in 6.2: Earthquake Magnitude, however that version of the formula leaves \(A_0(\delta)\), where delta is the distance, as an unknown function. In this example, an empirical formula is used for \(A_0(\delta)\). Go ahead and run the cell, and see how the magnitude varies with different amplitudes.

**Key Questions:** Consider these as you work your way through this page.

For Earthquake Distance:

- Compare the distance predicted for the same ts-tp time for different rock types: which rock type gives the largest distance? Explain why.

For Richter Magnitude:

- As you increase the seismogram amplitude, does the magnitude increase, decrease, or stay the same?
- Can you generate an unrealistic magnitude (M \(\geq\) 10)? If so, why? If not, which parameter value prevents this?