@@ -126,7 +126,7 @@ class GMTDataArrayAccessor:
126
126
(<GridRegistration.GRIDLINE: 0>, <GridType.GEOGRAPHIC: 1>)
127
127
"""
128
128
129
- def __init__ (self , xarray_obj ):
129
+ def __init__ (self , xarray_obj : xr . DataArray ):
130
130
self ._obj = xarray_obj
131
131
132
132
# Default to Gridline registration and Cartesian grid type
@@ -137,19 +137,19 @@ def __init__(self, xarray_obj):
137
137
# two columns of the shortened summary information of grdinfo.
138
138
if (_source := self ._obj .encoding .get ("source" )) and Path (_source ).exists ():
139
139
with contextlib .suppress (ValueError ):
140
- self ._registration , self ._gtype = map (
140
+ self ._registration , self ._gtype = map ( # type: ignore[assignment]
141
141
int , grdinfo (_source , per_column = "n" ).split ()[- 2 :]
142
142
)
143
143
144
144
@property
145
- def registration (self ):
145
+ def registration (self ) -> GridRegistration :
146
146
"""
147
147
Grid registration type :class:`pygmt.enums.GridRegistration`.
148
148
"""
149
149
return self ._registration
150
150
151
151
@registration .setter
152
- def registration (self , value ):
152
+ def registration (self , value : GridRegistration | int ):
153
153
# TODO(Python>=3.12): Simplify to `if value not in GridRegistration`.
154
154
if value not in GridRegistration .__members__ .values ():
155
155
msg = (
@@ -160,14 +160,14 @@ def registration(self, value):
160
160
self ._registration = GridRegistration (value )
161
161
162
162
@property
163
- def gtype (self ):
163
+ def gtype (self ) -> GridType :
164
164
"""
165
165
Grid coordinate system type :class:`pygmt.enums.GridType`.
166
166
"""
167
167
return self ._gtype
168
168
169
169
@gtype .setter
170
- def gtype (self , value ):
170
+ def gtype (self , value : GridType | int ):
171
171
# TODO(Python>=3.12): Simplify to `if value not in GridType`.
172
172
if value not in GridType .__members__ .values ():
173
173
msg = (
0 commit comments