- class openpnm.io.CSV¶
Reads and writes CSV (comma-separated-value files) containing pore and throat data
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
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, pore.coords, and pore.coords. OpenPNM will convert that back into an Np x m array upon loading.
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.
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