Skip to content

Commit

Permalink
Fix the grid accessor (grid registration and type) for 3D grids (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored May 4, 2022
1 parent ae4584c commit d8a7f9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pygmt/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def __init__(self, xarray_obj):
self._obj = xarray_obj
try:
self._source = self._obj.encoding["source"] # filepath to NetCDF source
# From the shortened summary information of `grdinfo`,
# get grid registration in column 10, and grid type in column 11
# Get grid registration and grid type from the last two columns of
# the shortened summary information of `grdinfo`.
self._registration, self._gtype = map(
int, grdinfo(self._source, per_column="n", o="10,11").split()
int, grdinfo(self._source, per_column="n").split()[-2:]
)
except (KeyError, ValueError):
self._registration = 0 # Default to Gridline registration
Expand Down

0 comments on commit d8a7f9e

Please sign in to comment.