Skip to content

Commit f3a796d

Browse files
committed
Add more tests for xarray grid shading
This PR adds more tests for xarray grid shading. Valid `shading` values are: - boolean - a constant intensity - some modifiers to automatically derive an intensity grid from input grid - an intensity grid with modifiers - an intensity grid in the (-1,+1) range This PR covers the first 4 cases only.
1 parent 203e647 commit f3a796d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pygmt/tests/test_grdimage.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,27 @@ def test_grdimage_file():
7878
condition=gmt_version <= Version("6.1.1"),
7979
)
8080
@check_figures_equal()
81-
def test_grdimage_xarray_shading(grid):
81+
@pytest.mark.parametrize(
82+
"shading",
83+
[True, 0.5, "+a30+nt0.8", "@earth_relief_01d_g+d", "@earth_relief_01d_g+a60+nt0.8"],
84+
)
85+
def test_grdimage_shading_xarray(grid, shading):
8286
"""
8387
Test that shading works well for xarray.
84-
See https://github.com/GenericMappingTools/pygmt/issues/364
88+
89+
The ``shading`` can be True, a constant intensity, some modifiers, or
90+
a grid with modifiers.
91+
92+
See https://github.com/GenericMappingTools/pygmt/issues/364 and
93+
https://github.com/GenericMappingTools/pygmt/issues/618.
8594
"""
8695
fig_ref, fig_test = Figure(), Figure()
8796
kwargs = dict(
8897
region=[-180, 180, -90, 90],
8998
frame=True,
9099
projection="Cyl_stere/6i",
91100
cmap="geo",
92-
shading=True,
101+
shading=shading,
93102
)
94103

95104
fig_ref.grdimage("@earth_relief_01d_g", **kwargs)

0 commit comments

Comments
 (0)