{
    "command": "sgoutcsv",
    "description": "Write selected scalar fields or numeric samples as CSV rows. Fields mode writes\none row per input column, including complete fixed-width text cells. Vector mode\nwrites one selected numeric field as a row per input column. Vectors mode writes\nselected numeric fields from only the first input column as CSV columns.\n\nSelections must name existing fields; empty or unknown names are errors.\nFields mode accepts numeric/complex scalars and fixed-width cN text. Numeric\nvector modes require equal sample counts in vectors mode; one-sample numeric\nfields are allowed. Float/double values use round-trip significant-digit\nprecision, and integers retain their native precision. Complex values retain\nthe real+imaginaryI notation, with full precision for both components.\n\nText is bounded by its field width. Empty text becomes an empty cell; trailing\nNUL padding is omitted, but spaces are preserved. Embedded NULs followed by\nnon-padding data are rejected. Quoted CSV is not supported: commas, double\nquotes, line breaks and other ASCII control bytes in text or headers are errors.\nCSV does not preserve field types, text widths, units or sampling metadata;\nrecord these separately when exchanging data.",
    "examples": [
        {
            "command": "sgoutcsv mode=fields fields=label,value <measurements.sg >measurements.csv",
            "expected": "Each input column becomes a CSV row under the label,value header. label is a\nfixed-width text field; value is a numeric scalar. Empty labels remain empty\ncells, and floating-point values retain round-trip precision.",
            "title": "Export labels and measurements as CSV columns"
        },
        {
            "command": "sgoutcsv mode=vectors vectors=time,data <traces.sg >samples.csv",
            "expected": "time and data must have equal sample counts. The header is time,data and each\nfollowing row contains one sample pair from the first input column only.",
            "title": "Export paired numeric vectors from the first input column"
        }
    ],
    "input_description": "input SOIG dataset containing the selected scalar/text fields or numeric sample arrays",
    "notes": [],
    "output_description": "output CSV table in the selected layout, preserving numeric precision and fields-mode text",
    "package": "sigclear-io",
    "parameters": [
        {
            "choices": [
                "fields",
                "vector",
                "vectors"
            ],
            "default": "fields",
            "default_known": true,
            "description": "output layout:\nfields: selected numeric/complex scalars and fixed-width text, one row per input column\nvector: samples of one numeric field, one CSV row per input column, without a header\nvectors: equal-length numeric fields from the first input column, with one sample per row",
            "name": "mode",
            "required": false,
            "type": "enum",
            "units": null
        },
        {
            "choices": [],
            "default": "stdin",
            "default_known": false,
            "description": "input SOIG dataset containing the selected scalar/text fields or numeric sample arrays",
            "name": "in",
            "required": false,
            "type": "ifile",
            "units": null
        },
        {
            "choices": [],
            "default": null,
            "default_known": false,
            "description": "required comma-separated scalar/text field names, in output order",
            "name": "fields",
            "required": null,
            "type": "strs",
            "units": null
        },
        {
            "choices": [],
            "default": "data",
            "default_known": true,
            "description": "numeric field to export in vector mode; defaults to data",
            "name": "vector",
            "required": false,
            "type": "str",
            "units": null
        },
        {
            "choices": [],
            "default": "\"data\"",
            "default_known": false,
            "description": "comma-separated numeric field names in vectors mode; defaults to data",
            "name": "vectors",
            "required": null,
            "type": "strs",
            "units": null
        },
        {
            "choices": [],
            "default": "stdout",
            "default_known": false,
            "description": "output CSV table in the selected layout, preserving numeric precision and fields-mode text",
            "name": "out",
            "required": false,
            "type": "ofile",
            "units": null
        }
    ],
    "related": [],
    "schema_version": 1,
    "summary": "Export selected dataset fields or vectors as CSV",
    "synopsis": "sgoutcsv mode=fields <stdin fields= vector=\"data\" vectors=\"data\" >stdout",
    "version": "1.0.2"
}