read_table

../../_images/TABLEREADER.png

Reads ASCII table file with various formatting and reading options allowing a wide variety of ASCII data tables to be parsed. See ASCII Tables for more details.

Note

This function performs the same task as the Table Reader icon in Metview’s user interface. It accepts its parameters as keyword arguments, described below.

read_table(**kwargs)

Reads ASCII table data with various formatting and reading options allowing a wide variety of ASCII data tables to be parsed.

Parameters
  • data (Table, Geopoints or Note) – Object representing an ASCII table file.

  • table_filename (str) – Specifies the path to the input table file. This parameter, if set, overrides data.

  • table_delimiter (str, default: ",") – Specifies the (single) character that separates values in the table.

  • table_combine_delimiters ({"on", "off"}, default: "off") – If “on”, then consecutive delimiters will be considered as one. This is often the case when whitespace is used to separate values which are aligned in columns. Note that in this case, it is not possible to represent missing values in the table. If “off”, then a delimiter not surrounded by two data values indicates there is a missing value on at least one side of it. See the discussion in ASCII Tables macro_table> for more details.

  • table_header_row (number, default: 1) – Specifies which row of the table file contains the names of the columns. This row, if present, should contain the one entry for each data column, separated with the same delimiter as the data. The first row of the table is number 1. Set this parameter to 0 in order to indicate that there is no header row.

  • table_data_row_offset (number, default: 1) – Specifies how many rows after the header row the first data row appears. Normally this is 1, since data tends to start on the row after the column headers. If there is no header row, then this number is equivalent to the first data row (e.g. if the data starts on row 3, then set this parameter to 3).

  • table_meta_data_rows (list[number]) – Specifies the rows (if any) which contain meta-data in a form which can be parsed by Metview. See ASCII Tables for more details.

  • table_columns (list[number]) – In order to conserve resources, it is possible to choose to load only a specified set of data columns. The first column is numbered 1.

  • table_column_types (list[str]) – If Metview does not correctly determine the data types of the columns, this parameter makes it possible to specify the data types as a list of type names. Possible type names are “number” and “string”. If table_columns is set, only that subset of columns should be represented by the list of types.

Return type

Table