DataId¶
-
class
lsst.daf.butler.DataId(dataId=None, *, dimensions=None, dimension=None, universe=None, region=None, entries=None, **kwds)¶ Bases:
collections.abc.MappingA dict-like identifier for data usable across multiple collections and
DatasetTypes.Parameters: - dataId :
dictorDataId A
dict-like object containingDimensionlinks. If this is a trueDataIdand the set of dimensions identified does not change, this object will be updated in-place and returned instead of a new instance.- dimensions : iterable of
Dimensionorstr, optional The set of dimensions the
DataIdwill identify, either asDimensioninstances or string names thereof.- dimension :
Dimensionorstr, optional The single dimension this
DataIdwill identify (along with all of its required dependencies).- universe :
DimensionGraph, optional A graph containing all known dimensions and joins. Must be provided if names are passed instead of
Dimensioninstances indimensionsordimension, or when dimensions are inferred from the provided link keys.- region :
lsst.sphgeom.ConvexPolygon, optional Spatial region on the sky associated with this combination of dimension entries.
- entries :
dict, optional A nested dictionary of additional metadata column values associated with these dimensions, with
DimensionElementinstances orstrnames as the outer keys,strcolumn names as inner keys, and column values as inner dictionary values. If thedimensionargument is provided, may also be a non-nested dict containing metadata column values for just that dimension.- kwds :
dict, optional Additional key-value pairs to update
dataIdwith.
Raises: - ValueError
Raised if incomplete or incompatible arguments are provided.
Notes
The keys of a
DataIdcorrespond to the “link” columns of one or moreDimensions, while values identify particular rows in the tables or views for thoseDimensions. In addition to implementing the (immutable)collections.abc.MappingAPI,DataIds have additional attributes to hold additional metadata, regions, and definitions for thoseDimensions. They are also hashable, and hence can be used as keys in dictionaries.The
DataIdclass represents a complete ID that has either been obtained from or validated with the set of knownDimensions. Regulardicts are typically used to represent conceptual data IDs that have not been validated. TheDataIdconstructor serves as a sort of standardization routine; most APIs that conceptually operate onDataIds should accept either trueDataIds or regular dicts via a singledataIdargument, and pass this through theDataIdconstruction (usually with additional keyword arguments forwarded) to guarantee a trueDataId. When convenient, thatDataIdshould also be returned.The set of dimensions a
DataIdidentifies can be provided to the constructor four ways:- Multiple dimensions may be passed via the
dimensionsargument. - A single dimension may be passed via the
dimensionargument. - If a true
DataIdis passed, its dimensions will be used if they are not overridden by one of the above. - If none of the above is provided, the dimensions are inferred from the
set of keys provided in
dataId,extra, andkwds; any dimensions inuniversewhose links are a subset of those keys is included.
Attributes Summary
entriesA nested dictionary of additional values associated with the identified dimension entries ( DimensionKeyDict).Methods Summary
dimensions([implied])Return dimensions this DataIdidentifies.fields(element[, region, metadata])Return the entries for a particular DimensionElement.get(k[,d])implied()Return a new DataIdwith all implied dimensions ofself“upgraded” to required.items()keys()matches(other)Compare two data IDs with possibly differing dimensions. updateHash(message)Add this data ID to a secure hash. values()Attributes Documentation
-
entries¶ A nested dictionary of additional values associated with the identified dimension entries (
DimensionKeyDict).The outer dictionary maps
DimensionElementobjects to dictionaries of field names and values.Entry values are not in general guaranteed to have been validated against any actual
Registryschema.
Methods Documentation
-
dimensions(implied=False)¶ Return dimensions this
DataIdidentifies.Parameters: Returns: - graph :
DimensionGraph
- graph :
-
fields(element, region=True, metadata=True)¶ Return the entries for a particular
DimensionElement.Parameters: - element :
DimensionElementorstr The
DimensionorDimensionJoinfor which fields should be returned.- region :
bool Whether to include the region in the result. Ignored if this
DataIdhas no region or the givenDimensionis not the region holder for it.- metadata :
bool Whether to include metadata (non-link, non-region columns) in the result. Ignored if this
DataIdhas no metadata for the givenDimension.
Returns: - fields :
dict A dictionary of column name-value pairs.
- element :
-
get(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items() → a set-like object providing a view on D's items¶
-
keys() → a set-like object providing a view on D's keys¶
-
matches(other)¶ Compare two data IDs with possibly differing dimensions.
Parameters: Returns:
-
updateHash(message)¶ Add this data ID to a secure hash.
Parameters:
-
values() → an object providing a view on D's values¶
- dataId :