Skip to main content

Module csv

Module csv 

Source
Expand description

Long CSV - one row per (object, element, property), in metres.

The tabular export: what a geologist pastes into a spreadsheet or loads into pandas. Long format, never wide - one column per property would mean aligning the elements of properties that do not sample in the same places, hence choosing a common grid; refusing to align and writing long is the honest option, and pivoting is a spreadsheet’s job.

Three decisions, stated here:

  • A NaN value is an empty cell. CSV has no convention for “no data”; an empty cell is what every reader understands, where NaN becomes a string half of them refuse to sum. Nodes with no position are removed upstream by crate::registry::prepare, as in every format.
  • A cell value has empty coordinates. A cell has not one position but eight; writing its centroid would be a computed value presented as data from the file. The element column says cell, the index says which one, and x/y/z stay empty.
  • An object with no property is written all the same: one row per node, with empty property columns. Geometry alone is an answer, and an export that yields an empty file for a well with no log looks like a broken export.

A property’s header is its title, its kind and its unit in separate columns - not title (uom) run together, which would force every consumer to re-parse what this writer already knew apart.

Structs§

CsvExporter
Writes long-format CSV.