h5rdmtoolbox.convention.standard_names.table.StandardNameTable

h5rdmtoolbox.convention.standard_names.table.StandardNameTable#

class h5rdmtoolbox.convention.standard_names.table.StandardNameTable(name, version, meta, standard_names=None, affixes=None, download_url=None)[source]#

Standard Name Table (SNT) class

Parameters:
  • name (str) – Name of the SNT

  • version (str) – Version of the table. Must be something like v1.0

  • meta (Dict) – Meta data of the table

  • affixes (Dict) – Contains all entries in the YAML file, which is not meta. Currently expected:

    • table: Dict

      The table containing ‘units’ and ‘description’

    • alias: Dict

      Dictionary containing the aliases

    • devices: List[str]

      List of defined devices to be used in transformations like difference_of_<standard_name>_across_<Device>

    • locations: List[str]

      List of defined locations to be used in transformations like difference_of_<standard_name>_between_<location>_and_<location>

Notes

Call StandardNameTable.transformations to get a list of available transformations

Examples

>>> from h5rdmtoolbox.convention.standard_names.table import StandardNameTable
>>> table = StandardNameTable.from_yaml('standard_name_table.yaml')
>>> # check a standard name
>>> table.check('x_velocity')
>>> # check a transformed standard name
>>> table.check('derivative_of_x_velocity_wrt_to_x_coordinate')
__init__(name, version, meta, standard_names=None, affixes=None, download_url=None)[source]#

Methods

__init__(name, version, meta[, ...])

add_affix(affix)

Add an affix to the standard name table

add_transformation(transformation)

Appending a transformation to the standard name table

check(standard_name[, units])

check the standard name against the table.

check_hdf_file(filename[, recursive])

Check file for standard names

check_hdf_group(h5grp[, recursive])

Check group datasets.

check_name(standard_name)

check the standard name against the table.

dump([sort_by])

pretty representation of the table for jupyter notebooks

dumps([sort_by])

Dumps (prints) the content as string

from_dict(snt_dict)

Initialize a StandardNameTable from a dictionary

from_gitlab(url, project_id, ref_name, file_path)

Download a file from a gitlab repository and provide StandardNameTable based on this.

from_web(url[, known_hash, name])

Create a StandardNameTable from an online resource.

from_xml(xml_filename[, name])

Create a StandardNameTable from an xml file

from_yaml(yaml_filename)

Initialize a StandardNameTable from a YAML file

from_zenodo([source, doi_or_recid])

Download a standard name table from Zenodo based on its DOI.

get_pretty_table([sort_by])

string representation of the SNT in form of a table

get_registered()

Return sorted list of standard names files

load_registered(name)

Load from user data dir

print_registered()

Return sorted list of standard names files

register([overwrite])

Register the standard name table under its versionname.

sort()

Sorts the standard name table

to_dict()

Export a StandardNameTable to a dictionary

to_html(html_filename[, open_in_browser])

Export the SNT to html and optionally open it directly if open_in_browser is True

to_json()

Export a StandardNameTable to a JSON string

to_latex(latex_filename[, column_parameter, ...])

Export a StandardNameTable to a LaTeX file

to_markdown(markdown_filename)

Export the SNT to a markdown file

to_sdict()

Export a StandardNameTable to a dictionary as string

to_yaml(yaml_filename)

Export the SNT to a YAML file

update(**standard_names)

Update the table with new standard names

Attributes

aliases

returns a dictionary of alias names and the respective standard name

contact

Return version_number

institution

Return institution name

list_of_aliases

Returns list of available aliases

meta

Return meta data dictionary

name

Return name of the Standard Name Table

names

Return list of standard names

pattern

Return pattern

standard_names

Return the table containing all standard names with their units and descriptions

transformations

List of available transformations

valid_characters

Return valid_characters

version

Return version number of the Standard Name Table

versionname

<name>-<version>