CSV

class openpnm.io.CSV[source]

Reads and writes CSV (comma-separated-value files) containing pore and throat data

Notes

There are a few rules governing how the data is be stored:

1. The first row of the file (column headers) must contain the property names. The subsequent rows contain the data.

2. The property names should be in the usual OpenPNM format, such as of pore.volume or throat.surface_area.

3. Each column represents a specific property. For Np x 1 or Nt x 1 data such as pore.volume this is straightforward. For Np x m or Nt x m data, each of the m columns should have their own column in in the CSV file, with a numpy-style index indicating which axis it corresponds to. For instance, the pore.coords values should be stored as three separate columns with the headings: pore.coords[0], pore.coords[1], and pore.coords[2]. OpenPNM will convert that back into an Np x m array upon loading.

  1. The file can contain both or either pore and throat data.

5. Labels can be imported by placing the characters TRUE and FALSE in a column corresponding to the label name (i.e. pore.front). TRUE indicates where the label applies and FALSE otherwise.

Methods

export_data([network, phases, filename, delim])

Save all the pore and throat property data on the Network (and optionally on any Phases objects) to CSV files.

import_data(filename[, project, delim])

Opens a 'csv' file, reads in the data, and adds it to the Network