carputils
Doxygen code documentation for the python framework controlling openCARP
Classes | Functions | Variables
carputils.carpio.txt Namespace Reference

Classes

class  TxtFile
 file IO class for reading ascii files with extensions More...
 

Functions

def open (args, kwargs)
 Open an .dat or .vec file. More...
 
def read (args, kwargs)
 read data based on file extension More...
 
def write (filename, data, kwargs)
 

Variables

 fopen = open
 

Function Documentation

◆ open()

def carputils.carpio.txt.open (   args,
  kwargs 
)

Open an .dat or .vec file.

Convenience method to provide normal python style interface to create a file type object.

Parameters
filenamestr The filename to open
modestr, optional 'r' for read mode (default), 'w' for write mode

◆ read()

def carputils.carpio.txt.read (   args,
  kwargs 
)

read data based on file extension

Handled file types: .elem, .dat, .vec, .vtx, .pts

Parameters
filenamestr The filename to open
modestr, optional 'r' for read mode (default), 'w' for write mode
Returns
When reading an .elem file a tuple containing data, tags, numbe data ... 1D or 2D array of integers or float
tags ... in the case of an .elem file
nelems ... in the case of an .elem file

tags ... in the case of an .elem file
npts ... in case of a .pts file
domain ... in case of .vtx file

◆ write()

def carputils.carpio.txt.write (   filename,
  data,
  kwargs 
)

Variable Documentation

◆ fopen

carputils.carpio.txt.fopen = open