Variables#

class metacatalog.models.variable.Unit(**kwargs)#

Model to represent units.

id#

Unique id of the record. If not specified, the database will assign it.

Type:

int

name#

Full name of the Unit

Type:

str

symbol#

A max. 12 letter symbol that is commonly used to represent the unit

Type:

str

si#

Optional. If applicable, the conversion if the unit into SI units. If the unit is i.e. m/km the si would be m*1000^-1*m^-1

Type:

str

variables#

Lazy loaded list of Variables that use the current unit

Type:

list

to_dict(deep: bool = False) dict#

To dict

Return the model as a python dictionary.

Parameters:

deep (bool) – If True, all related objects will be included as dictionary. Defaults to False

Returns:

obj – The Model as dict

Return type:

dict

class metacatalog.models.variable.Variable(**kwargs)#

Model to represent variables. The variable is any kind of oberservation, that can be represented by one data type. metacatalog does not take the definition of variables too strict. It is however common to keep variables as atomic as possbile.

However, technically, you can also create a new variable that describes a combined data type and reference a newly created table via DataSource. This can make sense if in the scope and context of the metacatalog installation a sensor like a Decagon 5TE always records three parameters at a time like Temperature, Moisture and Conductance. That can be implemented as a new ‘5TE’ variable and the datasource would point to a table containing all three measurements.

id#

Unique id of the record. If not specified, the database will assign it.

Type:

int

name#

Full name of the Unit

Type:

str

symbol#

A max. 12 letter symbol that is commonly used to represent the unit

Type:

str

si#

Optional. If applicable, the conversion if the unit into SI units. If the unit is i.e. m/km the si would be m*1000^-1*m^-1

Type:

str

variables#

Lazy loaded list of Variables that use the current unit

Type:

list

column_names#

New in version 0.3.0.

List of default column names that will be displayed when exporting the data. The columns are named in the same order as they appear in the list.

Type:

list

classmethod from_dict(data: dict, session: Session) Variable#

Create a new Variable from a python dictionary.

Parameters:
  • data (dict) – The dictionary containing the data

  • session (Session) – The database session

Returns:

obj – The new Variable

Return type:

Variable

to_dict(deep: bool = False) dict#

To dict

Return the model as a python dictionary.

Parameters:

deep (bool) – If True, all related objects will be included as dictionary. Defaults to False

Returns:

obj – The Model as dict

Return type:

dict