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
ab2andmn2(half-spacings in meters) and eitherrhoa(apparent resistivity in ohm meters) orresistance(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
ab2as \(1.5a\) andmn2as \(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/2must be positive and smaller thanAB/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").