Skip to content

Commit 711142c

Browse files
committed
Rename return_dataset to virtualfile_to_dataset
1 parent 796f1cc commit 711142c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

doc/api/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ conversion of Python variables to GMT virtual files:
294294
clib.Session.virtualfile_from_grid
295295
clib.Session.virtualfile_in
296296
clib.Session.virtualfile_out
297-
clib.Session.return_dataset
297+
clib.Session.virtualfile_to_dataset
298298

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

pygmt/clib/session.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ def read_virtualfile(
17381738
dtype = {"dataset": _GMT_DATASET, "grid": _GMT_GRID}[kind]
17391739
return ctp.cast(pointer, ctp.POINTER(dtype))
17401740

1741-
def return_dataset(
1741+
def virtualfile_to_dataset(
17421742
self,
17431743
output_type: Literal["pandas", "numpy", "file"],
17441744
vfile: str,
@@ -1794,7 +1794,7 @@ def return_dataset(
17941794
... kind="dataset", fname=outtmp.name
17951795
... ) as vouttbl:
17961796
... lib.call_module("read", f"{tmpfile.name} {vouttbl} -Td")
1797-
... result = lib.return_dataset(
1797+
... result = lib.virtualfile_to_dataset(
17981798
... output_type="file", vfile=vouttbl
17991799
... )
18001800
... assert result is None
@@ -1804,21 +1804,25 @@ def return_dataset(
18041804
... with Session() as lib:
18051805
... with lib.virtualfile_out(kind="dataset") as vouttbl:
18061806
... lib.call_module("read", f"{tmpfile.name} {vouttbl} -Td")
1807-
... outnp = lib.return_dataset(output_type="numpy", vfile=vouttbl)
1807+
... outnp = lib.virtualfile_to_dataset(
1808+
... output_type="numpy", vfile=vouttbl
1809+
... )
18081810
... assert isinstance(outnp, np.ndarray)
18091811
...
18101812
... # pandas output
18111813
... with Session() as lib:
18121814
... with lib.virtualfile_out(kind="dataset") as vouttbl:
18131815
... lib.call_module("read", f"{tmpfile.name} {vouttbl} -Td")
1814-
... outpd = lib.return_dataset(output_type="pandas", vfile=vouttbl)
1816+
... outpd = lib.virtualfile_to_dataset(
1817+
... output_type="pandas", vfile=vouttbl
1818+
... )
18151819
... assert isinstance(outpd, pd.DataFrame)
18161820
...
18171821
... # pandas output with specified column names
18181822
... with Session() as lib:
18191823
... with lib.virtualfile_out(kind="dataset") as vouttbl:
18201824
... lib.call_module("read", f"{tmpfile.name} {vouttbl} -Td")
1821-
... outpd2 = lib.return_dataset(
1825+
... outpd2 = lib.virtualfile_to_dataset(
18221826
... output_type="pandas",
18231827
... vfile=vouttbl,
18241828
... column_names=["col1", "col2", "col3", "coltext"],

0 commit comments

Comments
 (0)