Tabular_aseg

Inheritance diagram of gspy.src.classes.data.tabular_aseg
class gspy.src.classes.data.tabular_aseg.Tabular_aseg(xarray_obj)

Accessor to xarray.Dataset that handles ASEG Tabular data

Tabular_aseg.read(data_filename, metadata_file, spatial_ref, **kwargs)

Parameters:
  • filename (str) – Filename to read from.

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

  • spatial_ref (dict or 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

Tabular.read

Class method for reading file into class

survey.Spatial_ref

For Spatial reference instantiation.

property cols

Get the columns of an ASEG file

Return type:

dict

property column_names

Get all the column name from the file

Return type:

list of str

property file_handler

Class to handle file IO

Return type:

aseg_gdf2

static get_attrs(file_handle, variable, **kwargs)

Retrieve attribute information from ASEG field definitions

Handle aseg gdf read errors and overload entries with gspy metadata. Metadata is read from the GDF file, but gspy json files take precedence and will overwrite the GDF information.

Parameters:
  • file (aseg_gdf2 file handler) – File handler

  • variable (str) – Name of variable

  • long_name (str, optional) – CF convention long name

  • null_value (int or float, optional) – Number that represents unusable data. default is ‘not_defined’

  • standard_name (str, optional) – CF convention standard name

  • units (str, optional) – units of the coordinate

Returns:

out – dictionary of metadata for current variable

Return type:

dict

write_aseg_dfn_file(filename, default_f32='f10.3', default_f64='g12.6')
write_metadata_template(filename='aseg_md.yml')

Write metadata template for an ASEG dataset

Creates a template metadata file needed for adding ASEG data. Most metadata is pulled from the aseg definition file, but we require extra attributes to honour the CF convention. Additional dictionaries can be optionally added to document more information or ancillary metadata relevant to the specific variables.

Raises:

Exception – Tells user to specify metadata file when instantiating