pygmt.clib.Session.virtualfile_from_stringio
- Session.virtualfile_from_stringio(stringio)[source]
- Store a - io.StringIOobject in a virtual file.- Store the contents of a - io.StringIOobject in a GMT_DATASET container and create a virtual file to pass to a GMT module.- For simplicity, currently we make following assumptions in the StringIO object - "#"indicates a comment line.
- ">"indicates a segment header.
 - Parameters:
- stringio ( - StringIO) – The- io.StringIOobject containing the data to be stored in the virtual file.
- Yields:
- fname – The name of the virtual file. 
- Return type:
 - Examples - >>> import io >>> from pygmt.clib import Session >>> # A StringIO object containing legend specifications >>> stringio = io.StringIO( ... "# Comment\n" ... "H 24p Legend\n" ... "N 2\n" ... "S 0.1i c 0.15i p300/12 0.25p 0.3i My circle\n" ... ) >>> with Session() as lib: ... with lib.virtualfile_from_stringio(stringio) as fin: ... lib.virtualfile_to_dataset(vfname=fin, output_type="pandas") 0 0 H 24p Legend 1 N 2 2 S 0.1i c 0.15i p300/12 0.25p 0.3i My circle