GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add an advanced tutorial for plotting focal mechanisms (beachballs) by yvonnefroehlich · Pull Request #2550 · GenericMappingTools/pygmt

Conversation

@yvonnefroehlich

@yvonnefroehlich yvonnefroehlich commented May 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
@yvonnefroehlich
Add basic structur and code examples for meca tutorial
9a031b2
@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label May 29, 2023
@yvonnefroehlich yvonnefroehlich added this to the 0.11.0 milestone May 29, 2023
@yvonnefroehlich yvonnefroehlich self-assigned this May 29, 2023
@yvonnefroehlich
yvonnefroehlich marked this pull request as draft May 29, 2023 19:07
@yvonnefroehlich 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
@yvonnefroehlich
Fix typos
24802bb
@yvonnefroehlich

yvonnefroehlich commented May 29, 2023

Copy link
Copy Markdown
Member Author

/format

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.

actions-bot and others added 14 commits May 29, 2023 20:17
@actions-bot
[format-command] fixes
686bf92
@yvonnefroehlich
Use 'nodal', Adjust front size of 'event_name' label
744cf3f
@yvonnefroehlich
Remove color-coding from section 'Add label'
f3f0bd3
@yvonnefroehlich
Add section 'Plot several beachballs'
9d19715
@yvonnefroehlich
Expand convention list, Adjust the other lists in the introduction part
ba9debf
@yvonnefroehlich
Fix line length
5e12f74
@yvonnefroehlich
Adjust code and comments
4a8a24e
@yvonnefroehlich
Adjust thumbnail figure
e2d705d
@yvonnefroehlich
Fix code comment
725f54d
@yvonnefroehlich
Adjust stuff regarding 'input data'
ec06281
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
f6b77d1
@yvonnefroehlich
Use aliases for 'L', 'T', and 'Fr'
e97f1b4
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
2c31093
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
c0662fb
michaelgrund
michaelgrund reviewed Aug 23, 2023
View reviewed changes
Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

yvonnefroehlich and others added 7 commits September 2, 2023 13:25
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
05e323d
@yvonnefroehlich
Add remark regarding GMT issue #7777 and PR #7778
4a390fc
@yvonnefroehlich
Add empty line after heading in tutorial 'focal_mechanisms.py'
96ee768
@yvonnefroehlich
Update code separate in tutorial 'focal_mechanisms.py'
16fae40
@yvonnefroehlich
Use two empty lines befor sub-sections
af105a3
@yvonnefroehlich
Use empty line after sub-section
a457331
@yvonnefroehlich
Use correct order of regarding sphinx thumbnail
2293b38
@yvonnefroehlich
Use line length
ddf6211
@yvonnefroehlich 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
Merge branch 'main' into add-tutorial-meca
6574f7e
@yvonnefroehlich
yvonnefroehlich marked this pull request as ready for review March 18, 2025 07:34
@yvonnefroehlich

yvonnefroehlich commented Mar 18, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@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 🙂?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seisman
seisman reviewed Mar 18, 2025
View reviewed changes
Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman added the needs review This PR has higher priority and needs review. label Mar 18, 2025
yvonnefroehlich and others added 7 commits March 18, 2025 21:58
@yvonnefroehlich @seisman
Use for loop and dicts
e37421a
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
ac88165
@yvonnefroehlich
Fix code style
14b31b4
@yvonnefroehlich
Improve docs
4a87d23
@yvonnefroehlich
Improve docs
6f449fe
@yvonnefroehlich @seisman
Use equal space between beachballs
93712b2
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich
Merge branch 'main' into add-tutorial-meca
8933633
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 23, 2025
seisman
seisman approved these changes Mar 23, 2025
View reviewed changes
Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman mentioned this pull request Mar 23, 2025
Release PyGMT v0.15.0 #3851
Closed
27 of 29 tasks
@yvonnefroehlich @seisman
Fix typos
4489590
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich
yvonnefroehlich requested a review from michaelgrund March 23, 2025 19:06
michaelgrund
michaelgrund reviewed Mar 24, 2025
View reviewed changes
Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread examples/tutorials/advanced/focal_mechanisms.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

michaelgrund and others added 2 commits March 24, 2025 09:39
@michaelgrund
Merge branch 'main' into add-tutorial-meca
0577297
@yvonnefroehlich @michaelgrund
Fix a lot of typos
7e52907
Co-authored-by: Michael Grund <[email protected]>
michaelgrund
michaelgrund approved these changes Mar 24, 2025
View reviewed changes
@seisman seisman changed the title Add tutorial showing how to plot focal mechanisms (beachballs) Add a tutorial for plotting focal mechanisms (beachballs) Mar 24, 2025
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 24, 2025
@seisman
seisman merged commit e452dfb into main Mar 24, 2025
@seisman
seisman deleted the add-tutorial-meca branch March 24, 2025 10:41
seisman added a commit that referenced this pull request Mar 24, 2025
@seisman
Add an entry for PR #2550
11c0f1c
@yvonnefroehlich yvonnefroehlich changed the title Add a tutorial for plotting focal mechanisms (beachballs) Add an advanced tutorial for plotting focal mechanisms (beachballs) Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seisman seisman seisman approved these changes
@michaelgrund michaelgrund michaelgrund approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@yvonnefroehlich yvonnefroehlich

Labels

documentation Improvements or additions to documentation

Projects

None yet

Milestone

0.15.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@yvonnefroehlich @seisman @michaelgrund @actions-bot
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.