Tabular

Inheritance diagram of gspy.gs_dataset.Tabular
class gspy.gs_dataset.Tabular.Tabular(xarray_obj)

Accessor to xarray.Dataset that handles Tabular data

See also

gspy.Spatial_ref

For Spatial reference instantiation.

get_fortran_format(key, default_f32='f10.3', default_f64='g16.6')
static metadata_template(data, metadata_file=None, system=None, file_type=None, **kwargs)

Metadata template for some tabular data.

Parameters:
  • data (str or pandas.DataFrame or gspy.file_handlers.file_handler) – The data to describe, as a filename, a table already read in, or a handler that has already read one.

  • metadata_file (str or dict, optional) – Existing metadata, whether complete or partial. Its entries win over the template’s placeholders.

  • system (xarray.DataTree, optional) – Needed by formats whose columns are named after a system’s channels.

  • file_type (str, optional) – Name a format explicitly instead of detecting it, e.g. ‘loupe’.

Return type:

gspy.Metadata

classmethod read(data, metadata_file=None, spatial_ref=None, **kwargs)

Instantiate a Tabular class from tabular data

When reading the metadata and data file, the following are established in order * User defined dimensions * User defined coordinates * Columns are read in and/or combined and added to the Dataset as variables

Parameters:
  • data (str or pandas.DataFrame or gspy.file_handlers.file_handler) –

    The data to ingest, as any of

    • a filename, read with whichever handler recognises it

    • a DataFrame already in memory, for data that needed work before GSPy saw it

    • a handler that has already read its file, so a second pass over a large file is not needed

  • metadata_file (str, optional) – Json file name, by default None

  • spatial_ref (dict, gspy.Spatial_ref, or xarray.DataArray, optional) – Spatial ref object, by default None

Returns:

Dataset with all data read in.

Return type:

xarray.Dataset

See also

survey.Spatial_ref

For information on creating a spatial ref

gspy.file_handlers.open_datafile

How each form of data is handled

to_file(filename, **kwargs)

Write this dataset out in one of the tabular file formats.