Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 1 addition & 8 deletions pygmt/src/ternary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Expand Down
20 changes: 2 additions & 18 deletions pygmt/src/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
7 changes: 0 additions & 7 deletions pygmt/tests/test_binstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
29 changes: 2 additions & 27 deletions pygmt/tests/test_meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
"""
Expand Down
4 changes: 1 addition & 3 deletions pygmt/tests/test_subplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 0 additions & 22 deletions pygmt/tests/test_x2sys_cross.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 0 additions & 8 deletions pygmt/tests/test_xarray_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading