Skip to content

Commit bb7afdc

Browse files
committed
Allow virtualfile_from_grid to accept a registration argument
Default registration is still "GMT_GRID_NODE_REG" as per upstream, but we might want to override that in some cases.
1 parent ebd3e00 commit bb7afdc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pygmt/clib/session.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ def virtualfile_from_matrix(self, matrix):
11711171
yield vfile
11721172

11731173
@contextmanager
1174-
def virtualfile_from_grid(self, grid):
1174+
def virtualfile_from_grid(self, grid, registration="GMT_GRID_NODE_REG"):
11751175
"""
11761176
Store a grid in a virtual file.
11771177
@@ -1240,7 +1240,12 @@ def virtualfile_from_grid(self, grid):
12401240
family = "GMT_IS_GRID|GMT_VIA_MATRIX"
12411241
geometry = "GMT_IS_SURFACE"
12421242
gmt_grid = self.create_data(
1243-
family, geometry, mode="GMT_CONTAINER_ONLY", ranges=region, inc=inc
1243+
family,
1244+
geometry,
1245+
mode="GMT_CONTAINER_ONLY",
1246+
ranges=region,
1247+
inc=inc,
1248+
registration=registration,
12441249
)
12451250
self.put_matrix(gmt_grid, matrix)
12461251
args = (family, geometry, "GMT_IN|GMT_IS_REFERENCE", gmt_grid)

0 commit comments

Comments
 (0)