Binary/Serialized File I/O

Madagascar SSRSF Reader

class PVGeo.readers.binaries.MadagascarReader(**kwargs)[source]

Bases: PackedBinariesReader

This reads in float or double data that is packed into a Madagascar binary file format with a leader header. The reader ignores all of the ascii header details by searching for the sequence of three special characters: EOL EOL EOT and it will treat the following binary packed data as one long array and make a vtkTable with one column of that data. The reader uses defaults to import as floats with native endianness. Use the Table to Uniform Grid or the Reshape Table filters to give more meaning to the data. We will later implement the ability to create a gridded volume from the header info. This reader is a quick fix for Samir. We chose to use a vtkTable object as the output of this reader because it gives us more flexibility in the filters we can apply to this data down the pipeline and keeps thing simple when using filters in this repository. Details Here.

_read_raw_file(filename)[source]

Reads the raw data from the file for Madagascar SSRSF files

description = 'PVGeo: Madagascar Single Stream RSF Files'

Packed Binaries Reader

class PVGeo.readers.binaries.PackedBinariesReader(**kwargs)[source]

Bases: ReaderBase

This reads in float or double data that is packed into a binary file format. It will treat the data as one long array and make a vtkTable with one column of that data. The reader uses defaults to import as floats with native endianness. Use the Table to Uniform Grid or the Reshape Table filters to give more meaning to the data. We chose to use a vtkTable object as the output of this reader because it gives us more flexibility in the filters we can apply to this data down the pipeline and keeps things simple when using filters in this repository.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to request data for current timestep

_get_file_contents(idx=None)[source]

Internal helper to get all contents for all files

_get_raw_data(idx=0)[source]

This will return the proper data for the given timestep

_read_raw_file(filename)[source]

Internal helper to read the raw data from the file

_read_up_front()[source]

Should not need to be overridden

convert_array(arr)[source]

Converts the numpy array to a vtkDataArray

description = 'PVGeo: Packed Binaries Reader'
extensions = 'H@ bin rsf rsf@ HH npz'
get_data_name()[source]

Get name used for the data array

get_data_types()[source]

Get the data type of the binary file

get_endian()[source]

Get the endianness of the data file.

set_data_name(data_name)[source]

The string name of the data array generated from the input file.

set_data_type(dtype)[source]

Set the data type of the binary file: double=’d’, float=’f’, int=’i’

set_endian(endian)[source]

Set the endianness of the data file.

Parameters:

endian (int or char) – no preference = ‘’ or 0, Little = 1 or < or Big = 2 >.