Skip to content

Commit

Permalink
Merge test_meca_loc_array into test_meca_spec_multiple_focalmecha
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Jun 6, 2023
1 parent a51ea04 commit c17f091
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 37 deletions.
4 changes: 0 additions & 4 deletions pygmt/tests/baseline/test_meca_loc_array.png.dvc

This file was deleted.

48 changes: 15 additions & 33 deletions pygmt/tests/test_meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def test_meca_spec_single_focalmecha_file():


@pytest.mark.mpl_image_compare(filename="test_meca_spec_multiple_focalmecha.png")
@pytest.mark.parametrize("inputtype", ["dict_mecha", "dataframe", "array2d"])
@pytest.mark.parametrize(
"inputtype", ["dict_mecha", "dict_mecha_mixed", "dataframe", "array2d"]
)
def test_meca_spec_multiple_focalmecha(inputtype):
"""
Test passing multiple focal mechanisms to the spec parameter.
Expand All @@ -96,6 +98,18 @@ def test_meca_spec_multiple_focalmecha(inputtype):
"latitude": [47.5, 48.5],
"depth": [12.0, 11.0],
}
elif inputtype == "dict_mecha_mixed":
args = {
"spec": {
"strike": [330, 350],
"dip": [30, 50],
"rake": [90, 90],
"magnitude": [3, 2],
},
"longitude": np.array([-123.5, -124.5]),
"latitude": [47.5, 48.5],
"depth": [12, 11],
}
elif inputtype == "dataframe":
args = {
"spec": pd.DataFrame(
Expand Down Expand Up @@ -127,38 +141,6 @@ def test_meca_spec_multiple_focalmecha(inputtype):
return fig


@pytest.mark.mpl_image_compare
def test_meca_loc_array():
"""
Test supplying lists and np.ndarrays as the event location (longitude,
latitude, and depth).
"""
fig = Figure()
# specify focal mechanisms
focal_mechanisms = {
"strike": [327, 350],
"dip": [41, 50],
"rake": [68, 90],
"magnitude": [3, 2],
}
# longitude, latitude, and depth may be specified as an int, float,
# list, or 1-D numpy array
longitude = np.array([-123.3, -124.4])
latitude = np.array([48.4, 48.2])
depth = [12.0, 11.0] # to test mixed data types as inputs
scale = "2c"
fig.meca(
focal_mechanisms,
scale,
longitude=longitude,
latitude=latitude,
depth=depth,
region=[-125, -122, 47, 49],
projection="M14c",
)
return fig


@pytest.mark.mpl_image_compare
def test_meca_dict_offset():
"""
Expand Down

0 comments on commit c17f091

Please sign in to comment.