From c17f091c1e1b0b8b5576c4a517eea40ab931061e Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 6 Jun 2023 13:00:09 +0800 Subject: [PATCH] Merge test_meca_loc_array into test_meca_spec_multiple_focalmecha --- .../baseline/test_meca_loc_array.png.dvc | 4 -- pygmt/tests/test_meca.py | 48 ++++++------------- 2 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 pygmt/tests/baseline/test_meca_loc_array.png.dvc diff --git a/pygmt/tests/baseline/test_meca_loc_array.png.dvc b/pygmt/tests/baseline/test_meca_loc_array.png.dvc deleted file mode 100644 index 31612381e84..00000000000 --- a/pygmt/tests/baseline/test_meca_loc_array.png.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 7500fa67c18f4e307497e05fbc6857e3 - size: 4903 - path: test_meca_loc_array.png diff --git a/pygmt/tests/test_meca.py b/pygmt/tests/test_meca.py index 644d997b43e..4d013400074 100644 --- a/pygmt/tests/test_meca.py +++ b/pygmt/tests/test_meca.py @@ -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. @@ -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( @@ -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(): """