-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add tutorial showing how to plot focal mechanisms (beachballs) #2550
base: main
Are you sure you want to change the base?
Conversation
/format |
# | ||
# Store focal mechanism parameters for one event in a dictionary following the | ||
|
||
# moment tensor convention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason that you need to define two focal mechanims here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I think I wanted to have the moment tensor convention for section "Plotting the components of a seismic moment tensor" (around line 109) and later the Aki and Richards convention for the sections "Adjusting the outlines" (around line 143) and "Highlighting the nodal planes" (around line 173).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see your points. What about renaming them to shorter names like meca_aki
/meca_mt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea of the variable names was convention_datatype_amount
:
- aki_dict_single
- mt_dict_single
- aki_dict_multiple
- aki_df_multiple
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
# Set up a dictionary | ||
aki_dict_multiple = { | ||
"strike": [255, 173, 295, 318], | ||
"dip": [70, 68, 79, 89], | ||
"rake": [20, 83, -177, -179], | ||
"magnitude": [7.0, 5.8, 6.0, 7.8], | ||
"longitude": [-72.53, -79.61, 69.46, 37.01], | ||
"latitude": [18.44, 0.90, 33.02, 37.23], | ||
"depth": [13, 19, 4, 10], | ||
"plot_longitude": [-70, -110, 100, 0], | ||
"plot_latitude": [40, 10, 50, 55], | ||
"event_name": [ | ||
"Haiti - 2010/01/12", | ||
"Esmeraldas - 2022/03/27", | ||
"Afghanistan - 2022/06/21", | ||
"Syria/Turkey - 2023/02/06", | ||
], | ||
} | ||
# Convert to a pandas.DataFrame | ||
aki_df_multiple = pd.DataFrame(aki_dict_multiple) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aki_df_dict
is not used:
# Set up a dictionary | |
aki_dict_multiple = { | |
"strike": [255, 173, 295, 318], | |
"dip": [70, 68, 79, 89], | |
"rake": [20, 83, -177, -179], | |
"magnitude": [7.0, 5.8, 6.0, 7.8], | |
"longitude": [-72.53, -79.61, 69.46, 37.01], | |
"latitude": [18.44, 0.90, 33.02, 37.23], | |
"depth": [13, 19, 4, 10], | |
"plot_longitude": [-70, -110, 100, 0], | |
"plot_latitude": [40, 10, 50, 55], | |
"event_name": [ | |
"Haiti - 2010/01/12", | |
"Esmeraldas - 2022/03/27", | |
"Afghanistan - 2022/06/21", | |
"Syria/Turkey - 2023/02/06", | |
], | |
} | |
# Convert to a pandas.DataFrame | |
aki_df_multiple = pd.DataFrame(aki_dict_multiple) | |
# Set up a pandas.DataFrame with multiple focal mechanism parameters. | |
aki_df_multiple = pd.DataFrame( | |
{ | |
"strike": [255, 173, 295, 318], | |
"dip": [70, 68, 79, 89], | |
"rake": [20, 83, -177, -179], | |
"magnitude": [7.0, 5.8, 6.0, 7.8], | |
"longitude": [-72.53, -79.61, 69.46, 37.01], | |
"latitude": [18.44, 0.90, 33.02, 37.23], | |
"depth": [13, 19, 4, 10], | |
"plot_longitude": [-70, -110, 100, 0], | |
"plot_latitude": [40, 10, 50, 55], | |
"event_name": [ | |
"Haiti - 2010/01/12", | |
"Esmeraldas - 2022/03/27", | |
"Afghanistan - 2022/06/21", | |
"Syria/Turkey - 2023/02/06", | |
], | |
} | |
) |
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:Plotting the P and T axesRelated PRs (need to be merged before this PR is mergd)
scale
: PR Figure.meca: Expand docstring for the scale parameter #2552compressionfill
,camp
,offset
: PR Figure.meca: Expand docstrings for "compressionfill", "cmap", and "offset" #2553Add aliases for Fa, Fe, Fg, Ft, Fp: PR Figure.meca: Add aliases for "Fa", "Fe", "Fg", "Ft", "Fp" #3526Backup of code for plotting the P and T axes
Preview: https://pygmt-dev--2550.org.readthedocs.build/en/2550/tutorials/advanced/focal_mechanisms.html
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version