Skip to content

Commit 6280e39

Browse files
committed
Add a workaround to determine the grid gtype property
1 parent 2045561 commit 6280e39

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pygmt/datatypes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,13 @@ def to_dataarray(self):
104104
grid = xr.DataArray(data, coords=[y, x], dims=["lat", "lon"])
105105
grid.name = "z"
106106
grid.gmt.registration = header.registration
107+
# Determine the gtype property based on x and y units.
108+
# This is a temporary workaround and may not work for all cases.
109+
if (
110+
header.x_units == b"longitude [degrees_east]"
111+
and header.y_units == b"latitude [degrees_north]"
112+
):
113+
grid.gmt.gtype = 1
114+
else:
115+
grid.gmt.gtype = 0
107116
return grid

0 commit comments

Comments
 (0)