# How to plot Shear-wave splitting measurements using PyGMT

How you can plot the shear-wave splitting measurements from splitting database using PyGMT.

You can easily obtain the SKS splitting measurements from the Shear-wave splitting data base. In this post, I will show you how you can do the custum plot of these measurements.

First step is to download and save the splittingDB.txt in your local directory.

## Plot shear-wave splitting measurements for arbitrarily selected region

We can read the database using pandas:

df = pd.read_csv('splittingDB.txt', sep='|')
df.dropna(inplace=True)
df['Latitude'] = pd.to_numeric(df['Latitude'], errors='coerce')
df['Longitude'] = pd.to_numeric(df['Longitude'], errors='coerce')
df['phi'] = pd.to_numeric(df['phi'], errors='coerce')
df['dt'] = pd.to_numeric(df['dt'], errors='coerce')


We select arbitrary region for plotting the measurements. Then we extract the

minlon, maxlon = -132.89, -66.09
minlat, maxlat = 22.62, 51.64
dftmp1 = df[(minlon < df['Longitude']) & (df['Longitude'] < maxlon)]
dftaiwan = dftmp1[(minlat < df['Latitude']) & (df['Latitude'] < maxlat)]
dftaiwan.reset_index(inplace=True)

   index  id Station  Latitude  Longitude   phi    dt  refID Phase pmax pmin dtmax dtmin remark
0      4   4     LAC     34.39    -116.41 -54.0  1.20      0   SKS
1      5   5     LON     46.75    -121.81  84.0  1.00      0   SKS   11        0.2
2      6   6     MNV     38.43    -118.15  75.0  0.90      0   SKS
3      9   9    RSCP     35.59     -85.57  59.0  0.75      0   SKS    6       0.15
4     11  11    RSNY     44.55     -74.53  74.0  0.90      0   SKS    5       0.15


Finally, we can plot the measurements using the plot_splitting_map function defined below.

plot_splitting_map(dftaiwan, boxcoordinates=[
minlon, maxlon, minlat, maxlat], dcoord=0.5, dtscale=0.2, penwidth="0.5p",
proj="M10c", figname='splitting_map.png', frame=["a5f1", "WSen"],
markersizescale=0.1)


## Similar posts

### Topographic splitting map of Germany

# germany
minlon, maxlon = 4.26, 17.00
minlat, maxlat = 45.14, 54.92
plot_splitting_map(dftaiwan, boxcoordinates=[
minlon, maxlon, minlat, maxlat], dcoord=0.5, dtscale=0.5, penwidth="0.5p",
proj="M10c", figname='splitting_map.png', frame=["a5f1", "WSen"],
markersizescale=0.1, colormap="topo", markercolormap="jet")