diff --git a/pygmt/figure.py b/pygmt/figure.py index 474cd91179b..0658b8a5b33 100644 --- a/pygmt/figure.py +++ b/pygmt/figure.py @@ -269,12 +269,6 @@ def savefig( kwargs.pop("metadata", None) self.psconvert(prefix=prefix, fmt=fmts[ext], crop=crop, **kwargs) - # TODO(GMT>=6.5.0): Remove the workaround for upstream bug in GMT<6.5.0. - # Remove the .pgw world file if exists. Not necessary after GMT 6.5.0. - # See upstream fix https://github.com/GenericMappingTools/gmt/pull/7865 - if ext == "tiff": - fname.with_suffix(".pgw").unlink(missing_ok=True) - # Rename if file extension doesn't match the input file suffix. if ext != suffix[1:]: fname.with_suffix("." + ext).rename(fname) diff --git a/pygmt/src/ternary.py b/pygmt/src/ternary.py index 50d7e8f69d9..43a0128780e 100644 --- a/pygmt/src/ternary.py +++ b/pygmt/src/ternary.py @@ -5,11 +5,9 @@ from collections.abc import Sequence from typing import Literal -import pandas as pd -from packaging.version import Version from pygmt._typing import PathLike, TableLike from pygmt.alias import Alias, AliasSystem -from pygmt.clib import Session, __gmt_version__ +from pygmt.clib import Session from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias @@ -107,11 +105,6 @@ def ternary( ) aliasdict.merge(kwargs) - # TODO(GMT>=6.5.0): Remove the patch for upstream bug fixed in GMT 6.5.0. - # See https://github.com/GenericMappingTools/pygmt/pull/2138 - if Version(__gmt_version__) < Version("6.5.0") and isinstance(data, pd.DataFrame): - data = data.to_numpy() - with Session() as lib: with lib.virtualfile_in(check_kind="vector", data=data) as vintbl: lib.call_module( diff --git a/pygmt/src/timestamp.py b/pygmt/src/timestamp.py index bee28a7c974..3abab490643 100644 --- a/pygmt/src/timestamp.py +++ b/pygmt/src/timestamp.py @@ -5,10 +5,9 @@ import warnings from collections.abc import Sequence -from packaging.version import Version from pygmt._typing import AnchorCode from pygmt.alias import Alias, AliasSystem -from pygmt.clib import Session, __gmt_version__ +from pygmt.clib import Session from pygmt.helpers import build_arg_list __doctest_skip__ = ["timestamp"] @@ -52,8 +51,7 @@ def timestamp( font Font of the timestamp and the optional label. Since the GMT logo has a fixed height, the font sizes are fixed to be 8-point for the timestamp and 7-point for - the label. The parameter can't change the font color for GMT<=6.4.0, only the - font style. + the label. timefmt Format string for the UNIX timestamp. The format string is parsed by the C function ``strftime``, so that virtually any text can be used (even not @@ -84,20 +82,6 @@ def timestamp( warnings.warn(message=msg, category=RuntimeWarning, stacklevel=2) text = str(text)[:64] - # TODO(GMT>=6.5.0): Remove the patch for upstream "offset" bug fixed in GMT 6.5.0. - # TODO(GMT>=6.5.0): Remove the workaround for the '+t' modifier added in GMT 6.5.0. - # Related issues: - # - https://github.com/GenericMappingTools/gmt/issues/7107 - # - https://github.com/GenericMappingTools/gmt/pull/7127 - if Version(__gmt_version__) < Version("6.5.0"): - if "/" not in str(offset): # Giving a single offset doesn't work in GMT<6.5.0 - offset = f"{offset}/{offset}" - if text is not None: - # Workaround for GMT<6.5.0 by overriding the 'timefmt' parameter and - # unsetting 'text'. - timefmt = str(text) - text = None - aliasdict = AliasSystem( U=[ Alias(label, name="label"), diff --git a/pygmt/tests/test_binstats.py b/pygmt/tests/test_binstats.py index 53626f16364..91848b6e1c1 100644 --- a/pygmt/tests/test_binstats.py +++ b/pygmt/tests/test_binstats.py @@ -6,9 +6,7 @@ import numpy.testing as npt import pytest -from packaging.version import Version from pygmt import binstats -from pygmt.clib import __gmt_version__ from pygmt.enums import GridRegistration, GridType from pygmt.helpers import GMTTempFile @@ -53,11 +51,6 @@ def test_binstats_no_outgrid(): npt.assert_allclose(temp_grid.mean(), 4227489) -# TODO(GMT>=6.5.0): Remove the xfail marker for the upstream bug fixed in GMT 6.5.0. -@pytest.mark.xfail( - condition=Version(__gmt_version__) < Version("6.5.0"), - reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/8243", -) def test_binstats_quantile(): """ Test binstats quantile statistic functionality. diff --git a/pygmt/tests/test_meca.py b/pygmt/tests/test_meca.py index eaa9213fd5e..618b1cfbbed 100644 --- a/pygmt/tests/test_meca.py +++ b/pygmt/tests/test_meca.py @@ -7,9 +7,7 @@ import numpy as np import pandas as pd import pytest -from packaging.version import Version from pygmt import Figure -from pygmt.clib import __gmt_version__ from pygmt.exceptions import GMTInvalidInput, GMTValueError from pygmt.helpers import GMTTempFile @@ -143,21 +141,10 @@ def test_meca_spec_multiple_focalmecha(inputtype): return fig -# TODO(GMT>=6.5.0): Remove the skipif condition for GMT>=6.5.0. @pytest.mark.mpl_image_compare(filename="test_meca_offset.png") @pytest.mark.parametrize( "inputtype", - [ - "args", - "dict", - pytest.param( - "ndarray", - marks=pytest.mark.skipif( - condition=Version(__gmt_version__) < Version("6.5.0"), - reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/7557", - ), - ), - ], + ["args", "dict", "ndarray"], ) def test_meca_offset(inputtype): """ @@ -202,22 +189,10 @@ def test_meca_offset(inputtype): return fig -# TODO(GMT>=6.5.0): Remove the skipif marker for GMT>=6.5.0. -# Passing event names via pandas doesn't work for GMT<=6.4. -# See https://github.com/GenericMappingTools/pygmt/issues/2524. @pytest.mark.mpl_image_compare(filename="test_meca_eventname.png") @pytest.mark.parametrize( "inputtype", - [ - "args", - pytest.param( - "dataframe", - marks=pytest.mark.skipif( - condition=Version(__gmt_version__) < Version("6.5.0"), - reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/7557", - ), - ), - ], + ["args", "dataframe"], ) def test_meca_eventname(inputtype): """ diff --git a/pygmt/tests/test_subplot.py b/pygmt/tests/test_subplot.py index 118b0306900..62b015f188e 100644 --- a/pygmt/tests/test_subplot.py +++ b/pygmt/tests/test_subplot.py @@ -104,9 +104,7 @@ def test_subplot_nrows_ncols_less_than_one_error(): pass -# Increase tolerance for compatibility with GMT 6.4, see -# https://github.com/GenericMappingTools/pygmt/pull/2454 -@pytest.mark.mpl_image_compare(tolerance=4.0) +@pytest.mark.mpl_image_compare() def test_subplot_outside_plotting_positioning(): """ Plotting calls are correctly positioned after exiting subplot. diff --git a/pygmt/tests/test_x2sys_cross.py b/pygmt/tests/test_x2sys_cross.py index 891db117af8..c440742bd8b 100644 --- a/pygmt/tests/test_x2sys_cross.py +++ b/pygmt/tests/test_x2sys_cross.py @@ -12,9 +12,7 @@ import numpy.testing as npt import pandas as pd import pytest -from packaging.version import Version from pygmt import config, x2sys_cross, x2sys_init -from pygmt.clib import __gmt_version__ from pygmt.datasets import load_sample_data from pygmt.exceptions import GMTTypeError @@ -38,12 +36,7 @@ def fixture_tracks(): return [dataframe.query(expr="z > -20")] # reduce size of dataset -# TODO(GMT>=6.5.0): Remove the xfail marker for the upstream bug fixed in GMT 6.5.0. @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_input_file_output_file(): """ Run x2sys_cross by passing in a filename, and output internal crossovers to an ASCII @@ -68,12 +61,7 @@ def test_x2sys_cross_input_file_output_file(): npt.assert_allclose(result["i_1"].max(), 82945.9370, rtol=1.0e-4) -# TODO(GMT>=6.5.0): Remove the xfail marker for the upstream bug fixed in GMT 6.5.0. @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_input_file_output_dataframe(): """ Run x2sys_cross by passing in a filename, and output internal crossovers to a @@ -247,12 +235,7 @@ def test_x2sys_cross_invalid_tracks_input_type(tracks): x2sys_cross(tracks=[invalid_tracks]) -# TODO(GMT>=6.5.0): Remove the xfail marker for the upstream bug fixed in GMT 6.5.0. @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 @@ -283,12 +266,7 @@ def test_x2sys_cross_region_interpolation_numpoints(): npt.assert_allclose(output.z_M.mean(), -2896.875915, rtol=1e-4) -# TODO(GMT>=6.5.0): Remove the xfail marker for the upstream bug fixed in GMT 6.5.0. @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. diff --git a/pygmt/tests/test_xarray_accessor.py b/pygmt/tests/test_xarray_accessor.py index 99098836be3..6814245856e 100644 --- a/pygmt/tests/test_xarray_accessor.py +++ b/pygmt/tests/test_xarray_accessor.py @@ -3,14 +3,11 @@ """ import importlib -import sys from pathlib import Path import pytest import xarray as xr -from packaging.version import Version from pygmt import which -from pygmt.clib import __gmt_version__ from pygmt.datasets import load_earth_relief from pygmt.enums import GridRegistration, GridType from pygmt.exceptions import GMTValueError @@ -113,12 +110,7 @@ def test_xarray_accessor_set_invalid_registration_and_gtype(): grid.gmt.gtype = "geographic" -# TODO(GMT>=6.5.0): Remove the xfail marker for GMT>=6.5.0. @pytest.mark.skipif(condition=not _HAS_NETCDF4, reason="netCDF4 is not installed") -@pytest.mark.xfail( - condition=sys.platform == "win32" and Version(__gmt_version__) < Version("6.5.0"), - reason="Upstream bug fixed in https://github.com/GenericMappingTools/gmt/pull/7573", -) def test_xarray_accessor_sliced_datacube(): """ Check that a 2-D grid which is sliced from an n-dimensional datacube works with