FileTemplate¶
-
class
lsst.daf.butler.FileTemplate(template)¶ Bases:
objectFormat a path template into a fully expanded path.
Parameters: - template :
str Template string.
Notes
The templates use the standard Format Specification Mini-Language with the caveat that only named fields can be used. The field names are taken from the DataUnits along with several additional fields:
- datasetType:
str,DatasetType.name - component:
str, name of the StorageClass component - collection:
str,Run.collection - run:
int,Run.id
At least one or both of
runorcollectionmust be provided to ensure unique filenames.The mini-language is extended to understand a “?” in the format specification. This indicates that a field is optional. If that DataUnit is missing the field, along with the text before the field, unless it is a path separator, will be removed from the output path.
Methods Summary
format(ref)Format a template string into a full path. Methods Documentation
-
format(ref)¶ Format a template string into a full path.
Parameters: - ref :
DatasetRef The dataset to be formatted.
Returns: - path :
str Expanded path.
Raises: - KeyError
Requested field is not defined and the field is not optional. Or,
componentis specified but “component” was not part of the template.
- ref :
- template :