Skip to content

Commit

Permalink
Try using GMT_GRID_PIXEL_REG as default instead of GMT_GRID_NODE_REG
Browse files Browse the repository at this point in the history
Trying to use pixel registration as the default when converting an xarray.DataArray to a virtual GMT grid, instead of gridline registration.
  • Loading branch information
weiji14 committed Jun 19, 2020
1 parent bb7afdc commit 08edf6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def dataarray_to_matrix(grid):
dim
)
)
region.extend([coord.min(), coord.max()])
region.extend([coord.min() - coord_inc / 2, coord.max() + coord_inc / 2])
inc.append(coord_inc)

if any([i < 0 for i in inc]): # Sort grid when there are negative increments
Expand Down
6 changes: 3 additions & 3 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def create_data(self, family, geometry, mode, **kwargs):
registration : int
The node registration (what the coordinates mean). Can be
``'GMT_GRID_PIXEL_REG'`` or ``'GMT_GRID_NODE_REG'``. Defaults to
``'GMT_GRID_NODE_REG'``.
``'GMT_GRID_PIXEL_REG'``.
pad : int
The grid padding. Defaults to ``GMT_PAD_DEFAULT``.
Expand Down Expand Up @@ -565,7 +565,7 @@ def create_data(self, family, geometry, mode, **kwargs):
)
geometry_int = self._parse_constant(geometry, valid=GEOMETRIES)
registration_int = self._parse_constant(
kwargs.get("registration", "GMT_GRID_NODE_REG"), valid=REGISTRATIONS
kwargs.get("registration", "GMT_GRID_PIXEL_REG"), valid=REGISTRATIONS
)

# Convert dim, ranges, and inc to ctypes arrays if given (will be None
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def virtualfile_from_matrix(self, matrix):
yield vfile

@contextmanager
def virtualfile_from_grid(self, grid, registration="GMT_GRID_NODE_REG"):
def virtualfile_from_grid(self, grid, registration="GMT_GRID_PIXEL_REG"):
"""
Store a grid in a virtual file.
Expand Down

0 comments on commit 08edf6f

Please sign in to comment.