Delimited File I/O

Delimited Points Reader Base

class PVGeo.readers.delimited.DelimitedPointsReaderBase(**kwargs)[source]

Bases: DelimitedTextReader

A base class for delimited text readers that produce vtkPolyData points.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to get data for current timestep and populate the output data object.

description = 'PVGeo: Delimited Points'
get_copy_z()[source]

Get the status of whether or not to copy the Z-component of the points to the Point Data

set_copy_z(flag)[source]

Set whether or not to copy the Z-component of the points to the Point Data

Delimited Text Reader

class PVGeo.readers.delimited.DelimitedTextReader(nOutputPorts=1, outputType='vtkTable', **kwargs)[source]

Bases: ReaderBase

This reader will take in any delimited text file and make a vtkTable from it. This is not much different than the default .txt or .csv reader in ParaView, however it gives us room to use our own extensions and a little more flexibility in the structure of the files we import.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to get data for current timestep and populate the output data object.

_extract_header(content)[source]

Override this. Removes header from single file’s content.

_extract_headers(contents)[source]

Should NOT be overridden. This is a convienance methods to iteratively get all file contents. Your should override _extract_header.

_file_contents_to_data_frame(contents)[source]

Should NOT need to be overridden. After _extract_headers handles removing the file header from the file contents, this method will parse the remainder of the contents into a pandas DataFrame with column names generated from the titles resulting from in _extract_headers.

_get_delimiter()[source]

For itenral use only!

_get_file_contents(idx=None)[source]

This grabs the lines of the input data file as a string array. This allows us to load the file contents, parse the header then use numpy or pandas to parse the data.

_get_raw_data(idx=0)[source]

This will return the proper data for the given timestep as a dataframe

_read_up_front()[source]

Should not need to be overridden.

description = 'PVGeo: Delimited Text Files'
extensions = 'dat csv txt text ascii xyz tsv ntab'
get_skip_rows()[source]

Get the integer number of rows to skip at the top of the file.

get_split_on_white_space()[source]

Returns the status of how the delimiter interprets whitespace

get_titles()[source]
has_titles()[source]

Get the boolean for if the delimited file has header titles for the data arrays.

set_comments(identifier)[source]

The character identifier for comments within the file.

set_delimiter(deli)[source]

The input file’s delimiter. To use a tab delimiter please use set_split_on_white_space()

Parameters:

deli (str) – a string delimiter/separator

set_has_titles(flag)[source]

Set the boolean for if the delimited file has header titles for the data arrays.

set_skip_rows(skip)[source]

Set the integer number of rows to skip at the top of the file.

set_split_on_white_space(flag)[source]

Set a boolean flag to override the set_delimiter() and use any white space as a delimiter.

XYZ Text Reader

class PVGeo.readers.delimited.XYZTextReader(**kwargs)[source]

Bases: DelimitedTextReader

A makeshift reader for XYZ files where titles have comma delimiter and data has space delimiter.

_extract_header(content)[source]

Internal helper to parse header details for XYZ files

description = 'PVGeo: XYZ Delimited Text Files where header has comma delimiter.'