Skip to content

Commit 5dbcce9

Browse files
committed
grdinfo workaround for GMT<=6.5 only
1 parent 9af6b9c commit 5dbcce9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pygmt/src/grdinfo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
grdinfo - Retrieve info about grid file.
33
"""
44

5-
from pygmt.clib import Session
5+
from packaging.version import Version
6+
from pygmt.clib import Session, __gmt_version__
67
from pygmt.helpers import (
78
GMTTempFile,
89
build_arg_list,
@@ -111,7 +112,9 @@ def grdinfo(grid, **kwargs):
111112
A string with information about the grid.
112113
"""
113114
# Workaround for upstream bug https://github.com/GenericMappingTools/gmt/issues/8525
114-
grid_as_matrix = bool(kwargs.get("L"))
115+
grid_as_matrix = Version(__gmt_version__) <= Version("6.5.0") and bool(
116+
kwargs.get("L")
117+
)
115118

116119
with GMTTempFile() as outfile:
117120
with Session(grid_as_matrix=grid_as_matrix) as lib:

0 commit comments

Comments
 (0)