Skip to content
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

Figure.meca: the 'scale' parameter can accept int/float/str values #2566

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pygmt/src/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def meca(
columns. If ``spec`` is a dictionary or a pd.DataFrame,
``convention`` is not needed and is ignored if specified.

scale : str
scale : int or float or str
Adjust the scaling of the radius of the beachball, which is
proportional to the magnitude. *scale* defines the size for
magnitude = 5 (i.e. scalar seismic moment M0 = 4.0E23 dynes-cm).
Expand Down Expand Up @@ -335,7 +335,7 @@ def meca(
data_format = data_format_code(convention=convention, component=component)

# Assemble -S flag
kwargs["S"] = data_format + scale
kwargs["S"] = f"{data_format}{scale}"
with Session() as lib:
# Choose how data will be passed into the module
file_context = lib.virtualfile_from_data(check_kind="vector", data=spec)
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,6 @@ def test_meca_spec_dict_all_scalars():
"depth": 12.0,
"event_name": "Event20220311",
},
scale="1c",
scale=1.0, # make sure a non-str scale works
)
return fig