PyGMT - psmeca option

Hi all,

I searched through the source code on GitHub (master) and it looks the team has not yet got around to implementing a method for psmeca in base_plotting.py. Am I correct? Or is there another way to draw earthquake focal mechanisms using PyGMT?

If not, it looks like I could try to implement it myself following the examples you have calling other modules (e.g. coast).

Cheers,
James

UPDATE:

Looks like I was right, you guys did a really great job of making the code easily modular. I was able to (at least partially) implement the meca feature. I did this quickly and committed this back to my forked version of the master branch. Have not submitted a pull request because it probably violates your contributers code of conduct - haven’t had the time to review it thoroughly yet.

Code example:

fig = pygmt.Figure()
fig.basemap(region=region, frame=“af”, projection=“M0/0/8i”)
fig.coast(shorelines=True, N=2, land=‘gray’, water=‘skyblue’)
fig.meca(table=“MTTable.txt”, Sd=“1”, C=" ")
fig.show()

@sgjholt Actually there is already a PR for it (see https://github.com/GenericMappingTools/pygmt/pull/516). Feel free to try it and give your feedbacks.

@seisman Darn, I should have double checked the PRs. Oh well, I still learned a lot about the project doing it and it didn’t take long. I will give this branch a try. Thanks for responding!

1 Like

FYI https://github.com/GenericMappingTools/pygmt/pull/516 has been merged into PyGMT (thanks to @tjnewton and @liamtoney), and should be available for the next v0.2.0 release.

Alternatively, you can install from the PyGMT master branch directly from Github using pip install https://github.com/GenericMappingTools/pygmt/archive/master.zip and start using it now. Fair warning that there might be some bugs/issues, but it would be good to have someone test it and report back on how we can improve meca.

PyGMT v0.2.0 has just been released (see PyGMT v0.2.0 released), and this comes with the meca function. Do you want to give it a try if you have time?

From memory, it seems like text annotations might be the only thing that doesn’t work yet, but we could get that into v0.2.1 perhaps. Would be good to see if there’s any other rough edges that needs to be improved.

May you share your text file. I am struggle with similar issue but still no solution.