tsdat.config.dataset_definition

Classes

DatasetDefinition

Wrapper for the dataset_definition portion of the pipeline config

class tsdat.config.dataset_definition.DatasetDefinition(dictionary: Dict, datastream_name: str)[source]

Wrapper for the dataset_definition portion of the pipeline config file.

Parameters
  • dictionary (Dict) – The portion of the config file corresponding with the dataset definition.

  • datastream_name (str) – The name of the datastream that the config file is for.

Class Methods

get_attr

Retrieves the value of the attribute requested, or None if it does

get_coordinates

Returns the coordinate VariableDefinition object(s) that dimension

get_static_variables

Retrieves a list of static VariableDefinition objects. A variable is

get_variable

Attemps to retrieve the requested variable. First searches the data

get_variable_names

Retrieves the list of variable names. Note that this excludes

Method Descriptions

get_attr(self, attribute_name)Any[source]

Retrieves the value of the attribute requested, or None if it does not exist.

Parameters

attribute_name (str) – The name of the attribute to retrieve.

Returns

The value of the attribute, or None.

Return type

Any

get_coordinates(self, variable: tsdat.config.variable_definition.VariableDefinition)List[tsdat.config.variable_definition.VariableDefinition][source]

Returns the coordinate VariableDefinition object(s) that dimension the requested VariableDefinition.

Parameters

variable (VariableDefinition) – The VariableDefinition whose coordinate variables should be retrieved.

Returns

A list of VariableDefinition coordinate variables that dimension the provided VariableDefinition.

Return type

List[VariableDefinition]

get_static_variables(self)List[tsdat.config.variable_definition.VariableDefinition][source]

Retrieves a list of static VariableDefinition objects. A variable is defined as static if it has a “data” section in the config file, which would mean that the variable’s data is defined statically. For example, in the config file snippet below, “depth” is a static variable:

depth:
  data: [4, 8, 12]
  dims: [depth]
  type: int
  attrs:
    long_name: Depth
    units: m
Returns

The list of static VariableDefinition objects.

Return type

List[VariableDefinition]

get_variable(self, variable_name: str)tsdat.config.variable_definition.VariableDefinition[source]

Attemps to retrieve the requested variable. First searches the data variables, then searches the coordinate variables. Returns None if no data or coordinate variables have been defined with the requested variable name.

Parameters

variable_name (str) – The name of the variable to retrieve.

Returns

Returns the VariableDefinition for the variable, or None if the variable could not be found.

Return type

VariableDefinition

get_variable_names(self)List[str][source]

Retrieves the list of variable names. Note that this excludes coordinate variables.

Returns

The list of variable names.

Return type

List[str]