ertkit.ves.read_csv#

ertkit.ves.read_csv(path, error=None, *, encoding='utf-8-sig')#

Read a sounding from a CSV file.

The file has a header row and one row per reading. Column names are not case sensitive. Required columns are ab2 and mn2 (half-spacings in meters) and either rhoa (apparent resistivity in ohm meters) or resistance (transfer resistance in ohms). Lines starting with # are comments, empty rows (such as the ,, rows spreadsheets leave) are skipped, and other columns are ignored. Columns may be separated by commas, semicolons or tabs; numbers must use a decimal point.

For a Wenner sounding with spacing \(a\), write ab2 as \(1.5a\) and mn2 as \(0.5a\).

Parameters:
pathstr or path-like

The CSV file.

errorErrorModel, optional

Error model for the data. Default ErrorModel().

encodingstr, optional

Text encoding of the file. The default, "utf-8-sig", reads UTF-8 files with or without the byte-order mark that spreadsheet programs write; files exported by some instruments need, for example, "latin-1".

Returns:
Sounding
Raises:
ValueError

If the file cannot be decoded (try another encoding), if the header is missing or has duplicate or missing columns, if there are no readings, if a value is not a number or a spacing is invalid (MN/2 must be positive and smaller than AB/2; the message gives the line), or if no reading is usable.

Warns:
DataWarning

If readings are removed (see Sounding).

Examples

A file with these lines:

# Site 12, Minna
ab2,mn2,rhoa
1.5,0.3,120.3
2.5,0.3,98.7

is read with read_csv("site12.csv").