File I/O

This module contains general grid readers and writers for programs like Surfer.

Esri Grid Reader

class PVGeo.grids.fileio.EsriGridReader(outputType='vtkImageData', **kwargs)[source]

Bases: PVGeo.readers.delimited.DelimitedTextReader

See details: https://en.wikipedia.org/wiki/Esri_grid

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

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

RequestInformation(request, inInfo, outInfo)[source]

Used by pipeline to set grid extents.

SetDataName(dataName)[source]
_ExtractHeader(content)[source]

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

_FileContentsToDataFrame(contents)[source]

Creates a dataframe with a sinlge array for the file data.

_GetRawData(idx=0)[source]

This will return the proper data for the given timestep. This method handles Surfer’s NaN data values and checkes the value range

Landsat XML Reader

class PVGeo.grids.fileio.LandsatReader(**kwargs)[source]

Bases: PVGeo.base.ReaderBaseBase

A reader that will handle ESPA XML files for Landsat Imagery. This reader uses the espatools package to read Landsat rasters (band sets) and creates vtkImageData with each band as point data

CastDataType(flag)[source]

A flag to cast all data arrays as floats/doubles. This will fill invalid values with nans instead of a fill value

static GetColorSchemeNames()[source]
GetDataSelection()[source]

Used by ParaView GUI

GetFileName()[source]

Super class has file names as a list but we will only handle a single project file. This provides a conveinant way of making sure we only access that single file. A user could still access the list of file names using GetFileNames().

Modified(readAgain=False)[source]

Ensure default is overridden to be false so array selector can call.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to generate output

RequestInformation(request, inInfo, outInfo)[source]

Used by pipeline to set grid extents.

SetColorScheme(scheme)[source]

Get an RGB scheme from the raster set. If no scheme is desired, pass any string that is not a defined scheme as the scheme argument.

_BuildImageData(output)[source]

Properly builds the output vtkImageData object

_GetFileContents(idx=None)[source]

Reads XML meta data, no data read.

_GetRawData(idx=0)[source]

Perfroms the read for the selected bands

_ReadUpFront()[source]

Surfer Grid Reader

class PVGeo.grids.fileio.SurferGridReader(outputType='vtkImageData', **kwargs)[source]

Bases: PVGeo.readers.delimited.DelimitedTextReader

Read 2D ASCII Surfer grid files

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

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

RequestInformation(request, inInfo, outInfo)[source]

Used by pipeline to set grid extents.

SetDataName(dataName)[source]
_ExtractHeader(content)[source]

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

_FileContentsToDataFrame(contents)[source]

Creates a dataframe with a sinlge array for the file data.

_GetRawData(idx=0)[source]

This will return the proper data for the given timestep. This method handles Surfer’s NaN data values and checkes the value range

Write Cell Centers To CSV

class PVGeo.grids.fileio.WriteCellCenterData[source]

Bases: PVGeo.base.WriterBase

This writer will save a file of the XYZ points for an input dataset’s cell centers and its cell data. Use in tandom with ParaView’s native CSV writer which saves the PointData.

PerformWriteOut(inputDataObject, filename)[source]

This method must be implemented. This is automatically called by RequestData for single inputs or composite inputs.

SetDelimiter(delimiter)[source]

The string delimiter to use

Write vtkImageData to Surfer Format

class PVGeo.grids.fileio.WriteImageDataToSurfer[source]

Bases: PVGeo.base.WriterBase

Write a 2D vtkImageData object to the Surfer grid format

Apply(inputDataObject, arrayName)[source]

Update the algorithm and get the output data object

PerformWriteOut(inputDataObject, filename)[source]

This method must be implemented. This is automatically called by RequestData for single inputs or composite inputs.

SetInputArrayToProcess(idx, port, connection, field, name)[source]

Used to the inpput array / the data value (z-value) to write for the Surfer format

Parameters:
  • idx (int) – the index of the array to process
  • port (int) – input port (use 0 if unsure)
  • connection (int) – the connection on the port (use 0 if unsure)
  • field (int) – the array field (0 for points, 1 for cells, 2 for field, and 6 for row)
  • name (int) – the name of the array
Write(inputDataObject=None, arrayName=None)[source]

Perfrom the write out.