Skip to content

Commit bd52024

Browse files
committed
Improve the docstrings
1 parent 1843b35 commit bd52024

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

pygmt/clib/session.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ def read_virtualfile(self, vfname):
17081708
@contextmanager
17091709
def virtualfile_to_gmtdataset(self):
17101710
"""
1711-
Create a virtual file for writing a GMT_GRID object.
1711+
Create a virtual file for writing a GMT_DATASET object.
17121712
17131713
Yields
17141714
------
@@ -1721,12 +1721,26 @@ def virtualfile_to_gmtdataset(self):
17211721
yield vfile
17221722

17231723
def gmtdataset_to_vectors(self, vfile):
1724-
data = ctp.cast(self.read_virtualfile(f"{vfile}"), ctp.POINTER(GMT_DATASET))
1725-
ds = data.contents
1724+
"""
1725+
Read GMT_DATASET object from a virtual file and convert to vectors.
1726+
1727+
Parameters
1728+
----------
1729+
vfile : str
1730+
Name of the virtual file.
1731+
1732+
Returns
1733+
-------
1734+
vectors : list of 1-D arrays
1735+
List of vectors containing the data from the GMT_DATASET object.
1736+
"""
1737+
# Read the virtual file and cast it to a pointer to a GMT_DATASET
1738+
ds = ctp.cast(self.read_virtualfile(vfile), ctp.POINTER(GMT_DATASET)).contents
17261739

1740+
# Loop over the tables, segments, and columns to get the data as vectors
17271741
vectors = []
1728-
for itble in range(ds.n_tables):
1729-
dtbl = ds.table[itble].contents
1742+
for itbl in range(ds.n_tables):
1743+
dtbl = ds.table[itbl].contents
17301744
for iseg in range(dtbl.n_segments):
17311745
dseg = dtbl.segment[iseg].contents
17321746
for icol in range(dseg.n_columns):

0 commit comments

Comments
 (0)