Skip to content

Commit a633abf

Browse files
committed
Rename virtualfile_to_data to virtualfile_out
1 parent 452f65f commit a633abf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ conversion of Python variables to GMT virtual files:
293293
clib.Session.virtualfile_from_matrix
294294
clib.Session.virtualfile_from_vectors
295295
clib.Session.virtualfile_from_grid
296-
clib.Session.virtualfile_to_data
296+
clib.Session.virtualfile_out
297297

298298

299299
Low level access (these are mostly used by the :mod:`pygmt.clib` package):

pygmt/clib/session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ def virtualfile_from_data( # noqa: PLR0912
16101610
return file_context
16111611

16121612
@contextlib.contextmanager
1613-
def virtualfile_to_data(
1613+
def virtualfile_out(
16141614
self, kind: Literal["dataset", "grid"] = "dataset", fname: str | None = None
16151615
):
16161616
"""
@@ -1642,15 +1642,15 @@ def virtualfile_to_data(
16421642
... with open(tmpfile.name, mode="w") as fp:
16431643
... print("1.0 2.0 3.0 TEXT", file=fp)
16441644
... with Session() as lib:
1645-
... with lib.virtualfile_to_data(kind="dataset") as vouttbl:
1645+
... with lib.virtualfile_out(kind="dataset") as vouttbl:
16461646
... lib.call_module("read", f"{tmpfile.name} {vouttbl} -Td")
16471647
... ds = lib.read_virtualfile(vouttbl, kind="dataset")
16481648
>>> isinstance(ds.contents, _GMT_DATASET)
16491649
True
16501650
>>>
16511651
>>> # Create a virtual file for storing the output grid.
16521652
>>> with Session() as lib:
1653-
... with lib.virtualfile_to_data(kind="grid") as voutgrd:
1653+
... with lib.virtualfile_out(kind="grid") as voutgrd:
16541654
... lib.call_module("read", f"@earth_relief_01d_g {voutgrd} -Tg")
16551655
... outgrd = lib.read_virtualfile(voutgrd, kind="grid")
16561656
>>> isinstance(outgrd.contents, _GMT_GRID)
@@ -1659,7 +1659,7 @@ def virtualfile_to_data(
16591659
>>> # Write data to file without creating a virtual file
16601660
>>> with GMTTempFile(suffix=".nc") as tmpfile:
16611661
... with Session() as lib:
1662-
... with lib.virtualfile_to_data(
1662+
... with lib.virtualfile_out(
16631663
... kind="grid", fname=tmpfile.name
16641664
... ) as voutgrd:
16651665
... lib.call_module("read", f"@earth_relief_01d_g {voutgrd} -Tg")

0 commit comments

Comments
 (0)