DatasetType

class lsst.daf.butler.DatasetType(name, dimensions, storageClass)

Bases: object

A named category of Datasets that defines how they are organized, related, and stored.

A concrete, final class whose instances represent DatasetTypes. DatasetType instances may be constructed without a Registry, but they must be registered via Registry.registerDatasetType() before corresponding Datasets may be added. DatasetType instances are immutable.

Parameters:
name : str

A string name for the Dataset; must correspond to the same DatasetType across all Registries.

dimensions : DimensionGraph or iterable of str

Dimensions used to label and relate instances of this DatasetType, or string names thereof.

storageClass : StorageClass or str

Instance of a StorageClass or name of StorageClass that defines how this DatasetType is persisted.

Attributes Summary

dimensions The Dimensions that label and relate instances of this DatasetType (DimensionGraph or DimensionNameSet).
name A string name for the Dataset; must correspond to the same DatasetType across all Registries.
storageClass StorageClass instance that defines how this DatasetType is persisted.

Methods Summary

component() Component name (if defined)
componentTypeName(component) Given a component name, derive the datasetTypeName of that component
isComponent() Boolean indicating whether this DatasetType refers to a component of a composite.
isComposite() Boolean indicating whether this DatasetType is a composite type.
nameAndComponent() Return the root name of this dataset type and the component name (if defined).
nameWithComponent(datasetTypeName, componentName) Form a valid DatasetTypeName from a parent and component.
normalize(universe) Ensure the dimensions and storage class name are valid, and make self.dimensions a true DimensionGraph instance if it isn’t already.
splitDatasetTypeName(datasetTypeName) Given a dataset type name, return the root name and the component name.

Attributes Documentation

dimensions

The Dimensions that label and relate instances of this DatasetType (DimensionGraph or DimensionNameSet).

If this DatasetType was not obtained from or registered with a Registry, this will typically be a DimensionNameSet, with much less functionality (just an unsorted .names and comparison operators) than a full DimensionGraph.

name

A string name for the Dataset; must correspond to the same DatasetType across all Registries.

storageClass

StorageClass instance that defines how this DatasetType is persisted. Note that if DatasetType was constructed with a name of a StorageClass then Butler has to be initialized before using this property.

Methods Documentation

component()

Component name (if defined)

Returns:
comp : str

Name of component part of DatasetType name. None if this DatasetType is not associated with a component.

componentTypeName(component)

Given a component name, derive the datasetTypeName of that component

Parameters:
component : str

Name of component

Returns:
derived : str

Compound name of this DatasetType and the component.

Raises:
KeyError

Requested component is not supported by this DatasetType.

isComponent()

Boolean indicating whether this DatasetType refers to a component of a composite.

Returns:
isComponent : bool

True if this DatasetType is a component, False otherwise.

isComposite()

Boolean indicating whether this DatasetType is a composite type.

Returns:
isComposite : bool

True if this DatasetType is a composite type, False otherwise.

nameAndComponent()

Return the root name of this dataset type and the component name (if defined).

Returns:
rootName : str

Root name for this DatasetType without any components.

componentName : str

The component if it has been specified, else None.

static nameWithComponent(datasetTypeName, componentName)

Form a valid DatasetTypeName from a parent and component.

No validation is performed.

Parameters:
datasetTypeName : str

Base type name.

componentName : str

Name of component.

Returns:
compTypeName : str

Name to use for component DatasetType.

normalize(universe)

Ensure the dimensions and storage class name are valid, and make self.dimensions a true DimensionGraph instance if it isn’t already.

Parameters:
universe : DimensionGraph

The set of all known dimensions.

Raises:
ValueError

Raised if the DatasetType is invalid, either because one or more dimensions in self.dimensions is not in universe, or the storage class name is not recognized.

static splitDatasetTypeName(datasetTypeName)

Given a dataset type name, return the root name and the component name.

Parameters:
datasetTypeName : str

The name of the dataset type, can include a component using a “.”-separator.

Returns:
rootName : str

Root name without any components.

componentName : str

The component if it has been specified, else None.

Notes

If the dataset type name is a.b.c this method will return a root name of a and a component name of b.c.