Skip to content

Commit

Permalink
Allow virtualfile_from_grid to accept a registration argument
Browse files Browse the repository at this point in the history
Default registration is still "GMT_GRID_NODE_REG" as per upstream, but we might want to override that in some cases.
  • Loading branch information
weiji14 committed Jun 10, 2020
1 parent ebd3e00 commit bb7afdc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ def virtualfile_from_matrix(self, matrix):
yield vfile

@contextmanager
def virtualfile_from_grid(self, grid):
def virtualfile_from_grid(self, grid, registration="GMT_GRID_NODE_REG"):
"""
Store a grid in a virtual file.
Expand Down Expand Up @@ -1240,7 +1240,12 @@ def virtualfile_from_grid(self, grid):
family = "GMT_IS_GRID|GMT_VIA_MATRIX"
geometry = "GMT_IS_SURFACE"
gmt_grid = self.create_data(
family, geometry, mode="GMT_CONTAINER_ONLY", ranges=region, inc=inc
family,
geometry,
mode="GMT_CONTAINER_ONLY",
ranges=region,
inc=inc,
registration=registration,
)
self.put_matrix(gmt_grid, matrix)
args = (family, geometry, "GMT_IN|GMT_IS_REFERENCE", gmt_grid)
Expand Down

0 comments on commit bb7afdc

Please sign in to comment.