diff --git a/pygmt/tests/baseline/test_makecpt_categorical.png.dvc b/pygmt/tests/baseline/test_makecpt_categorical.png.dvc new file mode 100644 index 00000000000..3e8f5f16a3b --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_categorical.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 3452d1c57e68d0ff7a326a6fa35cbf5d + size: 4079 + path: test_makecpt_categorical.png diff --git a/pygmt/tests/baseline/test_makecpt_continuous.png b/pygmt/tests/baseline/test_makecpt_continuous.png deleted file mode 100644 index 56d5d243a58..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_continuous.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_continuous.png.dvc b/pygmt/tests/baseline/test_makecpt_continuous.png.dvc new file mode 100644 index 00000000000..847aa561557 --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_continuous.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 9a18c81caa92725aa9de5c2dd7d74e46 + size: 75856 + path: test_makecpt_continuous.png diff --git a/pygmt/tests/baseline/test_makecpt_cyclic.png.dvc b/pygmt/tests/baseline/test_makecpt_cyclic.png.dvc new file mode 100644 index 00000000000..2f65a8908cc --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_cyclic.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 479dbbd853e31354d825e0e23e123920 + size: 3925 + path: test_makecpt_cyclic.png diff --git a/pygmt/tests/baseline/test_makecpt_plot_grid.png.dvc b/pygmt/tests/baseline/test_makecpt_plot_grid.png.dvc new file mode 100644 index 00000000000..8892a9285ff --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_plot_grid.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 690415b96990c3b1d1388bf263e40a0d + size: 150867 + path: test_makecpt_plot_grid.png diff --git a/pygmt/tests/baseline/test_makecpt_plot_grid_scaled_with_series.png.dvc b/pygmt/tests/baseline/test_makecpt_plot_grid_scaled_with_series.png.dvc new file mode 100644 index 00000000000..02553625436 --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_plot_grid_scaled_with_series.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: aea39948ca2ea6924618a0e09b0020b3 + size: 118302 + path: test_makecpt_plot_grid_scaled_with_series.png diff --git a/pygmt/tests/baseline/test_makecpt_plot_points.png.dvc b/pygmt/tests/baseline/test_makecpt_plot_points.png.dvc new file mode 100644 index 00000000000..1375bbae583 --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_plot_points.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: b28ff0dad316d0b6a860b8af7e402a56 + size: 26601 + path: test_makecpt_plot_points.png diff --git a/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png b/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png deleted file mode 100644 index cd9c7ee3345..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png.dvc b/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png.dvc new file mode 100644 index 00000000000..3f321c178ec --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_reverse_color_and_zsign.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 6a5ca01aebcc23b00dc884fcd9c927d8 + size: 141567 + path: test_makecpt_reverse_color_and_zsign.png diff --git a/pygmt/tests/baseline/test_makecpt_reverse_color_only.png b/pygmt/tests/baseline/test_makecpt_reverse_color_only.png deleted file mode 100644 index 81ae1a44350..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_reverse_color_only.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_reverse_color_only.png.dvc b/pygmt/tests/baseline/test_makecpt_reverse_color_only.png.dvc new file mode 100644 index 00000000000..1b6124cde6d --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_reverse_color_only.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 5ad9b6aab72e45be8a1adc20f9e1c0e9 + size: 71377 + path: test_makecpt_reverse_color_only.png diff --git a/pygmt/tests/baseline/test_makecpt_reverse_zsign_only.png b/pygmt/tests/baseline/test_makecpt_reverse_zsign_only.png deleted file mode 100644 index 54ecee7ce92..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_reverse_zsign_only.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_to_plot_grid.png b/pygmt/tests/baseline/test_makecpt_to_plot_grid.png deleted file mode 100644 index b7e848f4cbb..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_to_plot_grid.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_to_plot_grid_scaled_with_series.png b/pygmt/tests/baseline/test_makecpt_to_plot_grid_scaled_with_series.png deleted file mode 100644 index 735e8379227..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_to_plot_grid_scaled_with_series.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_to_plot_points.png b/pygmt/tests/baseline/test_makecpt_to_plot_points.png deleted file mode 100644 index 727e75726ae..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_to_plot_points.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_truncated_at_zhigh_only.png b/pygmt/tests/baseline/test_makecpt_truncated_at_zhigh_only.png deleted file mode 100644 index e7d2f03a6d0..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_truncated_at_zhigh_only.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_truncated_at_zlow_only.png b/pygmt/tests/baseline/test_makecpt_truncated_at_zlow_only.png deleted file mode 100644 index 533b8b70f38..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_truncated_at_zlow_only.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_truncated_to_zlow_zhigh.png b/pygmt/tests/baseline/test_makecpt_truncated_to_zlow_zhigh.png deleted file mode 100644 index 14d800d4aab..00000000000 Binary files a/pygmt/tests/baseline/test_makecpt_truncated_to_zlow_zhigh.png and /dev/null differ diff --git a/pygmt/tests/baseline/test_makecpt_truncated_zlow_zhigh.png.dvc b/pygmt/tests/baseline/test_makecpt_truncated_zlow_zhigh.png.dvc new file mode 100644 index 00000000000..e1aec7c6f47 --- /dev/null +++ b/pygmt/tests/baseline/test_makecpt_truncated_zlow_zhigh.png.dvc @@ -0,0 +1,4 @@ +outs: +- md5: 26f3d0d95a68799ddd4eb8a130bc1445 + size: 97790 + path: test_makecpt_truncated_zlow_zhigh.png diff --git a/pygmt/tests/test_makecpt.py b/pygmt/tests/test_makecpt.py index 0cb8517ceb5..98d15e81543 100644 --- a/pygmt/tests/test_makecpt.py +++ b/pygmt/tests/test_makecpt.py @@ -9,7 +9,6 @@ from pygmt.datasets import load_earth_relief from pygmt.exceptions import GMTInvalidInput from pygmt.helpers import GMTTempFile -from pygmt.helpers.testing import check_figures_equal TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") POINTS_DATA = os.path.join(TEST_DATA_DIR, "points.txt") @@ -40,7 +39,7 @@ def fixture_grid(): @pytest.mark.mpl_image_compare -def test_makecpt_to_plot_points(points, region): +def test_makecpt_plot_points(points, region): """ Use static color palette table to change color of points. """ @@ -58,34 +57,29 @@ def test_makecpt_to_plot_points(points, region): @pytest.mark.mpl_image_compare -def test_makecpt_to_plot_grid(grid): +def test_makecpt_plot_grid(grid): """ Use static color palette table to change color of grid. """ fig = Figure() makecpt(cmap="relief") - fig.grdimage(grid, projection="W0/6i") + fig.grdimage(grid, projection="W0/10c") return fig -@check_figures_equal() -def test_makecpt_to_plot_grid_scaled_with_series(grid): +@pytest.mark.mpl_image_compare +def test_makecpt_plot_grid_scaled_with_series(grid): """ Use static color palette table scaled to a min/max series to change color of grid. """ - # Use single-character arguments for the reference image - fig_ref = Figure() - makecpt(C="oleron", T="-4500/4500") - fig_ref.grdimage(grid, J="W0/6i") - - fig_test = Figure() - makecpt(cmap="oleron", series="-4500/4500") - fig_test.grdimage(grid, projection="W0/6i") - return fig_ref, fig_test + fig = Figure() + makecpt(cmap="oleron", series=[-4500, 4500]) + fig.grdimage(grid, projection="W0/10c") + return fig -def test_makecpt_output_to_cpt_file(): +def test_makecpt_output_cpt_file(): """ Save the generated static color palette table to a .cpt file. """ @@ -111,35 +105,13 @@ def test_makecpt_invalid_output(): @pytest.mark.mpl_image_compare -def test_makecpt_truncated_to_zlow_zhigh(grid): +def test_makecpt_truncated_zlow_zhigh(grid): """ Use static color palette table that is truncated to z-low and z-high. """ fig = Figure() makecpt(cmap="rainbow", truncate=[0.15, 0.85], series=[-4500, 4500]) - fig.grdimage(grid, projection="W0/6i") - return fig - - -@pytest.mark.mpl_image_compare -def test_makecpt_truncated_at_zlow_only(grid): - """ - Use static color palette table that is truncated at z-low only. - """ - fig = Figure() - makecpt(cmap="rainbow", truncate=[0.5, None], series=[-4500, 4500]) - fig.grdimage(grid, projection="W0/6i") - return fig - - -@pytest.mark.mpl_image_compare -def test_makecpt_truncated_at_zhigh_only(grid): - """ - Use static color palette table that is truncated at z-high only. - """ - fig = Figure() - makecpt(cmap="rainbow", truncate=[None, 0.5], series=[-4500, 4500]) - fig.grdimage(grid, projection="W0/6i") + fig.grdimage(grid, projection="W0/10c") return fig @@ -150,18 +122,7 @@ def test_makecpt_reverse_color_only(grid): """ fig = Figure() makecpt(cmap="earth", reverse=True) - fig.grdimage(grid, projection="W0/6i") - return fig - - -@pytest.mark.mpl_image_compare -def test_makecpt_reverse_zsign_only(grid): - """ - Use static color palette table with its z-value sign reversed. - """ - fig = Figure() - makecpt(cmap="earth", reverse="z") - fig.grdimage(grid, projection="W0/6i") + fig.grdimage(grid, projection="W0/10c") return fig @@ -173,7 +134,7 @@ def test_makecpt_reverse_color_and_zsign(grid): """ fig = Figure() makecpt(cmap="earth", reverse="cz") - fig.grdimage(grid, projection="W0/6i") + fig.grdimage(grid, projection="W0/10c") return fig @@ -184,39 +145,31 @@ def test_makecpt_continuous(grid): scaled from -4500 to 4500m. """ fig = Figure() - makecpt(cmap="blue,white", continuous=True, series="-4500,4500") - fig.grdimage(grid, projection="W0/6i") + makecpt(cmap="blue,white", continuous=True, series=[-4500, 4500]) + fig.grdimage(grid, projection="W0/10c") return fig -@check_figures_equal() +@pytest.mark.mpl_image_compare def test_makecpt_categorical(region): """ Use static color palette table that is categorical. """ - fig_ref = Figure() - makecpt(C="categorical", W="") - fig_ref.colorbar(cmap=True, region=region, frame=True, position="JBC") - - fig_test = Figure() + fig = Figure() makecpt(cmap="categorical", categorical=True) - fig_test.colorbar(cmap=True, region=region, frame=True, position="JBC") - return fig_ref, fig_test + fig.colorbar(cmap=True, region=region, frame=True, position="JBC") + return fig -@check_figures_equal() +@pytest.mark.mpl_image_compare def test_makecpt_cyclic(region): """ Use static color palette table that is cyclic. """ - fig_ref = Figure() - makecpt(C="cork", W="w") - fig_ref.colorbar(cmap=True, region=region, frame=True, position="JBC") - - fig_test = Figure() + fig = Figure() makecpt(cmap="cork", cyclic=True) - fig_test.colorbar(cmap=True, region=region, frame=True, position="JBC") - return fig_ref, fig_test + fig.colorbar(cmap=True, region=region, frame=True, position="JBC") + return fig def test_makecpt_categorical_and_cyclic():