How to plot earthquakes data on a three-dimensional topographic map
Read the earthquake data from a data file and overlay on a three-dimensional topographic map using PyGMT.
Continuing our previous post on overlaying the earthquake location data on topographic map, this time we will overlay the earthquake data on a three-dimensional map. The three-dimensional map will be very similar to the one we built using PyGMT in one of our previous post.
Read the data file
Taiwan is located at a compressive tectonic boundary between the Eurasian Plate and the Philippine Sea Plate. The island straddles the compressional plate boundary between the Eurasian Plate to the west and the north and the Philippine Sea Plate to the east and south. The present convergence rate is about 7 cm/year in a NW-SE direction.
The data for this post was downloaded from Central Weather Bureau of Taiwan, and saved as evtlist.dat
. The dataset contains 2317 events with the date range from 1995-07-05
to 2019-12-16
. The depth of the events ranges from 11-180 km, and magnitude (Mw) from 3.0-7.1.
We can read the tabular data using pandas’ read_csv
method.
import pandas as pd
# dataformat: 1 1995-07-05 17:33:48.600 24.8313 122.1158 27 4.87
data = pd.read_csv('evtlist.dat', names=['SN','year','time','latitude','longitude','depth_km','magnitude'], delimiter='\s+')
Load the topographic data
We load the topographic data directly using the PyGMT load_earth_relief
method. The PyGMT will download the specified resolution of the topographic data locally.
minlon, maxlon = 119.5, 124.0
minlat, maxlat = 19.8, 26.0
# Load sample earth relief data
grid = pygmt.datasets.load_earth_relief(resolution="03s", region=[minlon, maxlon, minlat, maxlat])
Define three-dimensional perspective
We first specify the cpt files for the topographic colors, and then we specify the three-dimensional perspective view. The view is set to have the azimuth and elevation angle of the viewpoint to be 150 and 30 degrees. The cover type of the grid is taken as “surface”. The other options are mesh, waterfall, image, etc. See the pygmt.Figure.grdview
for details.
We define the region by the bounds of latitudes, longitudes and depths. The projection was taken to be “Mercator” with width of 15cm. The vertical height was taken to be 4cm.
pygmt.makecpt(
cmap='geo',
series=f'-{maxdep}/4000/100',
continuous=True
)
fig = pygmt.Figure()
fig.grdview(
grid=grid,
region=[minlon, maxlon, minlat, maxlat, -maxdep, 4000],
perspective=[150, 30],
frame=frame,
projection="M15c",
zsize="4c",
surftype="i",
plane=f"-{maxdep}+gazure",
shading=0,
# Set the contour pen thickness to "1p"
contourpen="1p",
)
Plot the data on a topographic map
Since the depths of the event ranges up to 180 km, we had to constrain it to show it within the range of our chosen maximum depth for the three-dimensional map. We project the depths in the range of 0 to the maximum depth of the displayed topography.
Another good choice for displaying the actual depth for each earthquake events is displaying on a cross-sectional map. The advantage of displaying the events on the topographic map is understanding its relation with the tectonics (topography or bathymetry).
depthData = data.depth_km.values
depthData = maxdep*(depthData - data.depth_km.min())/(data.depth_km.max()-data.depth_km.min()) #normalize the depth to the maximum of maxdep
# colorbar colormap
pygmt.makecpt(cmap="jet", series=[
depthData.min(), depthData.max()])
fig.plot3d(
x=data.longitude,
y=data.latitude,
z=-1*depthData,
size=0.05*data.magnitude, #scale the magnitude
color=depthData,
cmap=True,
style="cc",
pen="black",
perspective=True,
)
Add colorbar to the figure
At last, we can add the colorbar to show the values of actual depths of the event.
pygmt.makecpt(cmap="jet", series=[
data.depth_km.min(), data.depth_km.max()])
fig.colorbar(frame='af+l"Depth (km)"', perspective=True,)
Complete script
References
- Yi-Hsuan Wu, Chien-Chih Chen, Donald L. Turcotte, John B. Rundle, Quantifying the seismicity on Taiwan, Geophysical Journal International, Volume 194, Issue 1, July 2013, Pages 465–469, https://doi.org/10.1093/gji/ggt101
Disclaimer of liability
The information provided by the Earth Inversion is made available for educational purposes only.
Whilst we endeavor to keep the information up-to-date and correct. Earth Inversion makes no representations or warranties of any kind, express or implied about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services or related graphics content on the website for any purpose.
UNDER NO CIRCUMSTANCE SHALL WE HAVE ANY LIABILITY TO YOU FOR ANY LOSS OR DAMAGE OF ANY KIND INCURRED AS A RESULT OF THE USE OF THE SITE OR RELIANCE ON ANY INFORMATION PROVIDED ON THE SITE. ANY RELIANCE YOU PLACED ON SUCH MATERIAL IS THEREFORE STRICTLY AT YOUR OWN RISK.
Leave a comment