Skip to content
Merged
8 changes: 7 additions & 1 deletion pygmt/tests/test_datasets_earth_relief.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import numpy as np
import numpy.testing as npt
import pytest
from packaging.version import Version
from pygmt.clib import __gmt_version__
from pygmt.datasets import load_earth_relief
from pygmt.exceptions import GMTInvalidInput

Expand Down Expand Up @@ -186,6 +188,10 @@ def test_earth_relief_15s_default_registration():
npt.assert_allclose(data.max(), -71, atol=0.5)


@pytest.mark.xfail(
condition=Version(__gmt_version__) >= Version("6.5.0"),
reason="Upstream bug tracked in https://github.com/GenericMappingTools/pygmt/issues/2511",
)
def test_earth_relief_03s_default_registration():
"""
Test that the grid returned by default for the 3 arc-second resolution has a
Expand All @@ -198,5 +204,5 @@ def test_earth_relief_03s_default_registration():
npt.assert_allclose(data.coords["lat"].data.max(), 5)
npt.assert_allclose(data.coords["lon"].data.min(), -10)
npt.assert_allclose(data.coords["lon"].data.max(), -9.8)
npt.assert_allclose(data.min(), -2131.9, atol=0.5)
npt.assert_allclose(data.min(), -2069.85, atol=0.5)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As reported in #2511, there must be some bugs in GMT 6.5.0, so mark the test as xfail for GMT>=6.5.0.

npt.assert_allclose(data.max(), -924.5, atol=0.5)
6 changes: 5 additions & 1 deletion pygmt/tests/test_datasets_load_remote_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Test the _load_remote_dataset function.
"""
import pytest
from packaging.version import Version
from pygmt.clib import __gmt_version__
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
from pygmt.exceptions import GMTInvalidInput

Expand All @@ -27,11 +29,13 @@ def test_load_remote_dataset_benchmark_with_region():
data = load_remote_dataset_wrapper(resolution="01d", region=[-10, 10, -5, 5])
assert data.name == "seafloor_age"
assert data.attrs["long_name"] == "age of seafloor crust"
assert data.attrs["cpt"] == "@earth_age.cpt"
assert data.attrs["units"] == "Myr"
assert data.attrs["horizontal_datum"] == "WGS84"
assert data.gmt.registration == 0
assert data.shape == (11, 21)
# The cpt attribute was added since GMT 6.4.0
if Version(__gmt_version__) >= Version("6.4.0"):
assert data.attrs["cpt"] == "@earth_age.cpt"


def test_load_remote_dataset_invalid_resolutions():
Expand Down
14 changes: 14 additions & 0 deletions pygmt/tests/test_x2sys_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import numpy.testing as npt
import pandas as pd
import pytest
from packaging.version import Version
from pygmt import x2sys_cross, x2sys_init
from pygmt.clib import __gmt_version__
from pygmt.datasets import load_sample_data
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import data_kind
Expand Down Expand Up @@ -55,6 +57,10 @@ def test_x2sys_cross_input_file_output_file():


@pytest.mark.usefixtures("mock_x2sys_home")
@pytest.mark.xfail(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment #2986 (comment).

condition=Version(__gmt_version__) < Version("6.5.0"),
reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
)
def test_x2sys_cross_input_file_output_dataframe():
"""
Run x2sys_cross by passing in a filename, and output internal crossovers to a
Expand Down Expand Up @@ -196,6 +202,10 @@ def test_x2sys_cross_invalid_tracks_input_type(tracks):


@pytest.mark.usefixtures("mock_x2sys_home")
@pytest.mark.xfail(
condition=Version(__gmt_version__) < Version("6.5.0"),
reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
)
def test_x2sys_cross_region_interpolation_numpoints():
"""
Test that x2sys_cross's region (R), interpolation (l) and numpoints (W) arguments
Expand All @@ -221,6 +231,10 @@ def test_x2sys_cross_region_interpolation_numpoints():


@pytest.mark.usefixtures("mock_x2sys_home")
@pytest.mark.xfail(
condition=Version(__gmt_version__) < Version("6.5.0"),
reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8188",
)
def test_x2sys_cross_trackvalues():
"""
Test that x2sys_cross's trackvalues (Z) argument work.
Expand Down