{ "cells": [ { "cell_type": "markdown", "id": "d4f629fb", "metadata": { "tags": [] }, "source": [ "# Earthquake Signals" ] }, { "cell_type": "markdown", "id": "4f8bf1b3-d255-4c4b-92a4-5326b5bb57ba", "metadata": { "tags": [] }, "source": [ "## Part I: Seismicity on Earth\n", "\n", "An earthquake is a vibration of Earth caused by the sudden release of energy, usually as an abrupt breaking of rock along planar fractures called faults. An earthquake initiates at its hypocenter or focus at some depth below the land surface or sea floor. The epicenter of the earthquake is defined as the point on the Earth’s surface above where the earthquake initiated.\n", "\n", "But only rocks that are relatively cold and brittle (the Earth’s lithosphere) can be broken in earthquakes. Rocks that are hot and ductile (e.g. the Earth’s asthenosphere) will deform without breaking, and therefore do not produce earthquakes. By observing where earthquakes occur, both horizontally and with depth, we can learn where stress is concentrated and infer the material properties of the Earth.\n", "\n", "In this section, we will examine the distribution of earthquakes. You will notice that most of them are near plate boundaries. Each type of plate boundaries has a unique moving pattern shown in the image below. Keep this in mind when you look at the earthquake epicenter plot later in this section.\n", "\n", "\n", " \n", "\n", "*Image: Three major types of plate boundaries.*\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "68c1a3d8-4916-4e05-87e0-603555e0c5f2", "metadata": { "tags": [ "remove-input" ] }, "outputs": [], "source": [ "import pandas as pd\n", "import json\n", "import numpy as np\n", "import plotly.express as px\n", "import plotly.graph_objects as go\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "code", "execution_count": null, "id": "b4c20227-5dc0-4fa3-bef6-28dfbeff62a4", "metadata": { "tags": [ "remove-input" ] }, "outputs": [], "source": [ "def cutoff_track(lon, lat, cutoff_lon):\n", " \"\"\"\n", " Insert nan between two points that cross the cutoff lontitude. \n", " Avoid horizontal line when plot the track\n", " \n", " Input Parameters:\n", " ----------------\n", " \n", " lon: longitude array\n", " lat: latitude array\n", " cutoff_lon: divide the curve at this cutoff longitude\n", " \n", " Return:\n", " ------\n", " \n", " lon, lat: updated arrays\n", " \"\"\"\n", " xtrk = np.mod(lon - cutoff_lon, 360)\n", " is_cross = np.where(np.abs(xtrk[1:-1]-xtrk[0:-2]) > 90)[0]\n", " nans = np.empty(np.size(is_cross))\n", " nans[:] = np.nan\n", " lon = np.insert(lon, is_cross+1, nans)\n", " lat = np.insert(lat, is_cross+1, nans)\n", " return lon, lat\n", "\n", "def load_plate_boundaries(filename):\n", " \"\"\"\n", " Input Parameters:\n", " ----------------\n", " \n", " filename: input JSON file name containing the curve locations\n", " \"\"\" \n", "\n", " # Opening JSON file\n", " f = open(filename)\n", "\n", " # returns JSON object as a dictionary\n", " boundary = json.load(f)\n", " \n", " f.close()\n", "\n", " boundary = np.array(boundary[1])\n", " lons = boundary[:,0]\n", " lats = boundary[:,1]\n", "\n", " lons, lats = cutoff_track(lons, lats, 180)\n", " \n", " return lons, lats\n", "\n", "\n", "def plot_earthquake_map(catalog):\n", " \"\"\"\n", " Input Parameters:\n", " ----------------\n", " \n", " catalog: dataframe containing earthquakes\n", " \"\"\" \n", " \n", " rlons, rlats = load_plate_boundaries('../Geophysics/Files/ridge.json')\n", " tlons, tlats = load_plate_boundaries('../Geophysics/Files/transform.json')\n", " hlons, hlats = load_plate_boundaries('../Geophysics/Files/trench.json')\n", "\n", " \n", " fig1 = px.scatter_geo(catalog, lon=\"ep.lon\", lat=\"ep.lat\", size=\"centroid.MW\", color=\"ep.depth\", \n", " labels={\"ep.lon\":\"longitude (degrees)\", \"ep.lat\":\"latitude (degrees)\", \"centroid.MW\":\"Moment Magnitude\",\n", " \"ep.depth\":\"depth (km)\", \"ep.timestamp\":\"origin time\"}, \n", " hover_data=['ep.timestamp'])\n", "\n", " fig1a = px.line_geo(lon=rlons, lat=rlats)\n", " fig1a.update_traces(line={'color':'skyblue', 'width':3})\n", " \n", " fig1b = px.line_geo(lon=tlons, lat=tlats)\n", " fig1b.update_traces(line={'color':'lime', 'width':3})\n", " \n", " fig1c = px.line_geo(lon=hlons, lat=hlats)\n", " fig1c.update_traces(line={'color':'orangered', 'width':3})\n", " \n", " fig = go.Figure(data=fig1.data + fig1a.data + fig1b.data + fig1c.data, layout = fig1.layout)\n", " fig.update_xaxes(range=[-180, 180], tickvals=np.arange(-180,190,30))\n", " fig.update_yaxes(range=[-90, 90], tickvals=np.arange(-90,100,15))\n", " fig.update_geos(projection_type=\"robinson\", lataxis_showgrid=True, lonaxis_showgrid=True)\n", " fig.update_layout(title_text=\"Global CMT catalog (N = %d earthquakes)\"%len(catalog), title_x=0.5)\n", " fig.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "9ea8acb3-eabf-4344-b4c5-8cee1ca2d25e", "metadata": { "tags": [ "remove-input" ] }, "outputs": [], "source": [ "# Read earthquake catalog\n", "cmt_cat = pd.read_table(\"Files/Global_CMT_1972_2018.csv\", delimiter=',')\n", "cmt_cat = cmt_cat.sort_values(by=['ep.depth', 'centroid.MW'])" ] }, { "cell_type": "markdown", "id": "4909159c-3229-4078-bfe4-77cdb1661ccc", "metadata": {}, "source": [ "
Review
\n", "Feel free to adjust the filter parameters in the cell below to have more or less earthquakes on the map. You may hover the dots to get the information of the earthquakes. The colors of the lines indicate the type of plate boundaries: Red is a Trench, Green is a Transform, and Blue is a Ridge boundary.
\n", "