File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,16 @@ def gtype(self) -> int:
250
250
"lon"/"lat" or have units "degrees_east"/"degrees_north", then the grid is
251
251
assumed to be geographic.
252
252
"""
253
+ gtype = 0 # Cartesian by default
254
+
253
255
dims = self .dims
254
- gtype = 1 if dims [0 ] == "lat" and dims [1 ] == "lon" else 0
256
+ if dims [0 ] == "lat" and dims [1 ] == "lon" :
257
+ # Check dimensions for grids that following CF-conventions
258
+ gtype = 1
259
+ elif self .ProjRefPROJ4 is not None :
260
+ # Check ProjRefPROJ4 for images imported via GDAL.
261
+ # The logic comes from GMT's `gmtlib_read_image_info` function.
262
+ projref = self .ProjRefPROJ4 .decode ()
263
+ if "longlat" in projref or "latlong" in projref :
264
+ gtype = 1
255
265
return gtype
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ def to_dataarray(self) -> xr.DataArray:
166
166
axis: Y
167
167
actual_range: [-90. 90.]
168
168
>>> da.gmt.registration, da.gmt.gtype
169
- (1, 0 )
169
+ (1, 1 )
170
170
"""
171
171
# The image header
172
172
header = self .header .contents
You can’t perform that action at this time.
0 commit comments