Skip to content

Commit dfdd3ed

Browse files
committed
Rename virtualfile_from_data to virtualfile_in
1 parent a633abf commit dfdd3ed

44 files changed

Lines changed: 59 additions & 60 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/api/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ conversion of Python variables to GMT virtual files:
288288

289289
.. autosummary::
290290
:toctree: generated
291-
292-
clib.Session.virtualfile_from_data
291+
293292
clib.Session.virtualfile_from_matrix
294293
clib.Session.virtualfile_from_vectors
295294
clib.Session.virtualfile_from_grid
295+
clib.Session.virtualfile_in
296296
clib.Session.virtualfile_out
297297

298298

pygmt/clib/session.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ def virtualfile_from_grid(self, grid):
14781478
yield vfile
14791479

14801480
@fmt_docstring
1481-
def virtualfile_from_data( # noqa: PLR0912
1481+
def virtualfile_in( # noqa: PLR0912
14821482
self,
14831483
check_kind=None,
14841484
data=None,
@@ -1535,7 +1535,7 @@ def virtualfile_from_data( # noqa: PLR0912
15351535
... ),
15361536
... )
15371537
>>> with Session() as ses:
1538-
... with ses.virtualfile_from_data(check_kind="vector", data=data) as fin:
1538+
... with ses.virtualfile_in(check_kind="vector", data=data) as fin:
15391539
... # Send the output to a file so that we can read it
15401540
... with GMTTempFile() as fout:
15411541
... ses.call_module("info", fin + " ->" + fout.name)
@@ -1609,6 +1609,9 @@ def virtualfile_from_data( # noqa: PLR0912
16091609

16101610
return file_context
16111611

1612+
# virtualfile_from_data is the old name for virtualfile_in
1613+
virtualfile_from_data = virtualfile_in
1614+
16121615
@contextlib.contextmanager
16131616
def virtualfile_out(
16141617
self, kind: Literal["dataset", "grid"] = "dataset", fname: str | None = None

pygmt/src/binstats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def binstats(data, **kwargs):
111111
"""
112112
with GMTTempFile(suffix=".nc") as tmpfile:
113113
with Session() as lib:
114-
file_context = lib.virtualfile_from_data(check_kind="vector", data=data)
114+
file_context = lib.virtualfile_in(check_kind="vector", data=data)
115115
with file_context as infile:
116116
if (outgrid := kwargs.get("G")) is None:
117117
kwargs["G"] = outgrid = tmpfile.name # output to tmpfile

pygmt/src/blockm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _blockm(block_method, data, x, y, z, outfile, **kwargs):
4343
"""
4444
with GMTTempFile(suffix=".csv") as tmpfile:
4545
with Session() as lib:
46-
table_context = lib.virtualfile_from_data(
46+
table_context = lib.virtualfile_in(
4747
check_kind="vector", data=data, x=x, y=y, z=z, required_z=True
4848
)
4949
# Run blockm* on data table

pygmt/src/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def contour(self, data=None, x=None, y=None, z=None, **kwargs):
115115
kwargs = self._preprocess(**kwargs)
116116

117117
with Session() as lib:
118-
file_context = lib.virtualfile_from_data(
118+
file_context = lib.virtualfile_in(
119119
check_kind="vector", data=data, x=x, y=y, z=z, required_z=True
120120
)
121121
with file_context as fname:

pygmt/src/dimfilter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def dimfilter(grid, **kwargs):
151151

152152
with GMTTempFile(suffix=".nc") as tmpfile:
153153
with Session() as lib:
154-
file_context = lib.virtualfile_from_data(check_kind="raster", data=grid)
154+
file_context = lib.virtualfile_in(check_kind="raster", data=grid)
155155
with file_context as infile:
156156
if (outgrid := kwargs.get("G")) is None:
157157
kwargs["G"] = outgrid = tmpfile.name # output to tmpfile

pygmt/src/filter1d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def filter1d(data, output_type="pandas", outfile=None, **kwargs):
119119

120120
with GMTTempFile() as tmpfile:
121121
with Session() as lib:
122-
file_context = lib.virtualfile_from_data(check_kind="vector", data=data)
122+
file_context = lib.virtualfile_in(check_kind="vector", data=data)
123123
with file_context as infile:
124124
if outfile is None:
125125
outfile = tmpfile.name

pygmt/src/grd2cpt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def grd2cpt(grid, **kwargs):
184184
if kwargs.get("W") is not None and kwargs.get("Ww") is not None:
185185
raise GMTInvalidInput("Set only categorical or cyclic to True, not both.")
186186
with Session() as lib:
187-
file_context = lib.virtualfile_from_data(check_kind="raster", data=grid)
187+
file_context = lib.virtualfile_in(check_kind="raster", data=grid)
188188
with file_context as infile:
189189
if kwargs.get("H") is None: # if no output is set
190190
arg_str = build_arg_string(kwargs, infile=infile)

pygmt/src/grd2xyz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def grd2xyz(grid, output_type="pandas", outfile=None, **kwargs):
158158

159159
with GMTTempFile() as tmpfile:
160160
with Session() as lib:
161-
file_context = lib.virtualfile_from_data(check_kind="raster", data=grid)
161+
file_context = lib.virtualfile_in(check_kind="raster", data=grid)
162162
with file_context as infile:
163163
if outfile is None:
164164
outfile = tmpfile.name

pygmt/src/grdclip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def grdclip(grid, **kwargs):
9797
"""
9898
with GMTTempFile(suffix=".nc") as tmpfile:
9999
with Session() as lib:
100-
file_context = lib.virtualfile_from_data(check_kind="raster", data=grid)
100+
file_context = lib.virtualfile_in(check_kind="raster", data=grid)
101101
with file_context as infile:
102102
if (outgrid := kwargs.get("G")) is None:
103103
kwargs["G"] = outgrid = tmpfile.name # output to tmpfile

0 commit comments

Comments
 (0)