GeezerVison is showing github.com — Add an advanced tutorial for plotting focal mechanisms (beachballs) by yvonnefroehlich · Pull Request #2550 · GenericMappingTools/pygmt
Conversation
Description of proposed changes
This PR aims to add a tutorial showing how to plot focal mechanisms using pygmt.Figure.meca. It focuses on how the display of the beachballs can be adjusted and modified:
- Filling the quadrants
Plotting the P and T axes
- Plotting the components of a seismic moment tensor
- Adjusting the outlines
- Highlighting the nodal planes
- Adding offset from the event location
- Adding a label
- Using size-coding and color-coding
Related PRs (need to be merged before this PR is mergd)
- Add aliases for L, T, Fr : PR Figure.meca: Add aliases for "L", "T", and "Fr" #2546
- Expand docstring for
scale: PR Figure.meca: Expand docstring for the scale parameter #2552
- Expand docstrings for
compressionfill, camp, offset: PR Figure.meca: Expand docstrings for "compressionfill", "cmap", and "offset" #2553
- Add table for conventions to docs: PR DOC / Figure.meca: Use table for supported conventions #3811
-
Add aliases for Fa, Fe, Fg, Ft, Fp: PR Figure.meca: Add aliases for "Fa", "Fe", "Fg", "Ft", "Fp" #3526
Backup of code for plotting the P and T axes
# %%
# Plotting the P and T axes
# -------------------------
#
# Wait for PR #3526
fig = pygmt.Figure()
fig.basemap(region=[-size, size] * 2, projection=projection, frame=frame)
fig.meca(
spec=mt_dict_single,
scale="1c",
longitude=-2,
latitude=0,
Fa=True,
)
fig.meca(
spec=mt_dict_single,
scale="1c",
longitude=2,
latitude=0,
Fa="0.2c/cd", # Compute and plot P and T axes with symbols, Adjust size and symbols
Fe="darkorange", # Adjust fill of T axis symbol
Fg="gray30", # Adjust fill of P axis symbol
Ft="0.8p,cornsilk", # Adjust outline of T axis symbol
Fp="0.8p,gray60", # Adjust outline of P axis symbol
)
fig.show()
Preview: https://pygmt-dev--2550.org.readthedocs.build/en/2550/tutorials/advanced/focal_mechanisms.html
Reminders
- Run
make format and make check to make sure the code follows the style guide.
- Add tests for new features or tests that would have caught the bug that you're fixing.
- Add new public functions/methods/classes to
doc/api/index.rst.
- Write detailed docstrings for all functions/methods.
- If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
- If adding new functionality, add an example to docstrings or tutorials.
- Use underscores (not hyphens) in names of Python files and directories.
Slash Commands
You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:
/format: automatically format and lint the code
/test-gmt-dev: run full tests on the latest GMT development version
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
yvonnefroehlich
changed the title
Add tutorial showing how to plot focal mechanisms (beachballs)
WIP: Add tutorial showing how to plot focal mechanisms (beachballs)
May 29, 2023
github-actions[bot] reacted with rocket emoji
github-actions[bot] reacted with eyes emoji
All reactions
-
🚀
1 reaction
-
👀
1 reaction
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
yvonnefroehlich
changed the title
WIP: Add tutorial showing how to plot focal mechanisms (beachballs)
Add tutorial showing how to plot focal mechanisms (beachballs)
Mar 18, 2025
@yvonnefroehlich The tutorial already looks good to me. Are there more changes you'd like to make?
From the content side I do not have things in mind I want to change at the moment (actually, the tutorial is already a bit longer). If we have additional GMT flags wrapped (e.g., #3526) we may want consider to extend this tutorial.
As this a longer tutorial, maybe we can have a second reviewer here 🙂?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
seisman
changed the title
Add tutorial showing how to plot focal mechanisms (beachballs)
Add a tutorial for plotting focal mechanisms (beachballs)
Mar 24, 2025
yvonnefroehlich
changed the title
Add a tutorial for plotting focal mechanisms (beachballs)
Add an advanced tutorial for plotting focal mechanisms (beachballs)
Mar 26, 2025
Reviewers
seisman
seisman approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|