Skip to content

Commit

Permalink
Add more tests for xarray grid shading
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
seisman committed Oct 15, 2020
1 parent 203e647 commit f3a796d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pygmt/tests/test_grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,27 @@ def test_grdimage_file():
condition=gmt_version <= Version("6.1.1"),
)
@check_figures_equal()
def test_grdimage_xarray_shading(grid):
@pytest.mark.parametrize(
"shading",
[True, 0.5, "+a30+nt0.8", "@earth_relief_01d_g+d", "@earth_relief_01d_g+a60+nt0.8"],
)
def test_grdimage_shading_xarray(grid, shading):
"""
Test that shading works well for xarray.
See https://github.com/GenericMappingTools/pygmt/issues/364
The ``shading`` can be True, a constant intensity, some modifiers, or
a grid with modifiers.
See https://github.com/GenericMappingTools/pygmt/issues/364 and
https://github.com/GenericMappingTools/pygmt/issues/618.
"""
fig_ref, fig_test = Figure(), Figure()
kwargs = dict(
region=[-180, 180, -90, 90],
frame=True,
projection="Cyl_stere/6i",
cmap="geo",
shading=True,
shading=shading,
)

fig_ref.grdimage("@earth_relief_01d_g", **kwargs)
Expand Down

0 comments on commit f3a796d

Please sign in to comment.