Map of focal mechanism with Pygmt

2 Likes

#!/usr/bin/env python3
“”"
Created on Wen Aug 26 14:20:59 2020
Script python para graficar la sismicidad en Venezuela,
requier los archivos

  • mff_bb.txt
  • etopo1_bedrock.grd
  • verde.cpt
  • fallas2015.txt
    “”"
    import pandas as pd
    import pygmt

#Carga archivo de mecanismos
sismos=pd.read_csv(“mff_bb.txt”, sep=’\s+’)

#Mapas GMT
KWARGS = dict(
grid=‘etopo1_bedrock.grd’,region=[-74,-59,5,15],
projection=‘M10i’,cmap=‘verde.cpt’, frame=0)

fig = pygmt.Figure()

fig.grdimage(shading=True, **KWARGS) # Add illumination!

fig.coast(shorelines=True,borders=[‘1/0.8p’,‘2/0.1p’],
frame=True,map_scale=’-68.5/7.0/7.0/200 ',resolution=‘f’)

#fallas
fig.plot(data=“fallas2015.txt”, pen=“1,red”) #sizes=0.02 * 2 ** data.MAG

#epicentros
fig.plot(x=sismos.lon,y=sismos.lat, style=“c0.2c”,
color=‘yellow’,pen=“black”)

fig.text(textfiles=None,x=-68.0, y=13.5, position=None,text=‘Mar Caribe’,
angle=0, font=‘28p,Helvetica-Bold,white’, justify=‘LM’)

#mecanismos
with pygmt.clib.Session() as session:
session.call_module(‘meca’, ‘mff_bb.txt -Sc1.0/12p -C -G0’)

fig.savefig(‘mecanismos.png’)

mff_bb.txt (1.8 KB)