Skip to content

Commit 07b2802

Browse files
committed
Set registration and gtype properly as enums on init
1 parent c2c010c commit 07b2802

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pygmt/xarray/accessor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ def __init__(self, xarray_obj: xr.DataArray):
137137
# two columns of the shortened summary information of grdinfo.
138138
if (_source := self._obj.encoding.get("source")) and Path(_source).exists():
139139
with contextlib.suppress(ValueError):
140-
self._registration, self._gtype = map( # type: ignore[assignment]
140+
_registration, _gtype = map(
141141
int, grdinfo(_source, per_column="n").split()[-2:]
142142
)
143+
self._registration = GridRegistration(_registration)
144+
self._gtype = GridType(_gtype)
143145

144146
@property
145147
def registration(self) -> GridRegistration:

0 commit comments

Comments
 (0)