File I/O

This modules holds all of the neccesarry functions and classes for reading NUFT input data into the classes described in spec.

NuftMesh

class nuftio.fileio.NuftMesh(h=None, x0=None, **kwargs)[source]

Bases: discretize.TensorMesh.TensorMesh

This is an extension of discretize``s ``TensorMesh to provide
file IO for NUFT simulation results

Required Properties:

  • h (a list of Array): h is a list containing the cell widths of the tensor mesh in each dimension., a list (each item is a list or numpy array of <class ‘float’> with shape (*)) with length between 0 and 3
  • x0 (Array): origin of the mesh (dim, ), a list or numpy array of <class ‘float’> with shape (*)
classmethod readNuft(filename, fix_indices=True)[source]

Run the Foo algorithm on an input number nub.

Parameters:
  • filename (str) – the relative or absolute file name
  • fix_indices (bool) – If True, decrease the indexing arrays by one because someone chose to use +1 indexing in the NUFT format.

Parser

class nuftio.fileio.Parser(**kwargs)[source]

Bases: properties.base.base.HasProperties

Parses NUFT data files

COMMENTS = ';'
static parseFile(filename, comments=';', skiprows=0, opener='(', closer=')')[source]

Parses general NUFT data file into a disctionary. If it is a table then use the parseTabFile method.

static parseString(text, opener='(', closer=')')[source]

Perses a string of text in NUFT data format to nested dictionaries

static parseTabFile(filename, comments=';', skiprows=0, opener='(', closer=')', names=None)[source]

Reads the NUFT table data format (.tab files).

read_genmsh

nuftio.fileio.read_genmsh(filename, comments=';', skiprows=0, opener='(', closer=')', usnt=False)[source]

Reads genmsh specifiation files

read_rocktab

nuftio.fileio.read_rocktab(filename, comments=';', skiprows=0, opener='(', closer=')')[source]

Reads rocktab material specification files

read_tab

nuftio.fileio.read_tab(filename, comments=';', skiprows=0, opener='(', closer=')', names=None)[source]

Reads the NUFT table data format (.tab files).

read_usnt

nuftio.fileio.read_usnt(fname_mesh, fname_rtab, comments=';', skiprows=0, opener='(', closer=')')[source]

Reads mesh specifications and rock property table into one data object