dlite.datamodel
#
Module that simplifies creating a data model.
Module Contents#
Classes#
Raised if the datamodel is inconsistent. |
|
Raised if a dimension referred to in a property is not defined. |
|
Raised if a dimension is not referred to in any property. |
|
Class for creating a data model. |
- class dlite.datamodel.DataModelError#
Bases:
dlite.DLiteError
Raised if the datamodel is inconsistent.
- class dlite.datamodel.MissingDimensionError#
Bases:
DataModelError
Raised if a dimension referred to in a property is not defined.
- class dlite.datamodel.UnusedDimensionError#
Bases:
DataModelError
Raised if a dimension is not referred to in any property.
- class dlite.datamodel.DataModel(uri, schema=None, description=None)#
Class for creating a data model.
- uri#
- description#
- dimensions#
- properties#
- relations = []#
- schema#
- add_dimension(name, description)#
Add dimension with given name and description to data model.
- add_property(name, type, shape=None, unit=None, description=None, dims=None)#
Add property to data model.
- Parameters:
name – Property label.
type – Property type.
shape – Shape of Property. Default is scalar.
unit – Unit. Default is dimensionless.
description – Human description.
dims – Deprecated alias for shape.
- get_missing_dimensions()#
Returns a set of dimension names referred to in property shapes but is not in dimensions.
- get_unused_dimensions()#
Returns a set of dimensions not referred to in any property shapes.
- validate()#
Raises an exception if there are missing or unused dimensions.
- get()#
Returns a DLite Metadata created from the datamodel.