RepoExport

class lsst.daf.butler.RepoExport(registry: Registry, datastore: Datastore, backend: RepoExportBackend, *, directory: Optional[str] = None, transfer: Optional[str] = None)

Bases: object

Public interface for exporting a subset of a data repository.

Instances of this class are obtained by calling Butler.export as the value returned by that context manager:

with butler.export(filename="export.yaml") as export:
    export.saveDataIds(...)
    export.saveDatasts(...)
Parameters:
registry : Registry

Registry to export from.

datastore : Datastore

Datastore to export from.

backend : RepoExportBackend

Implementation class for a particular export file format.

directory : str, optional

Directory to pass to Datastore.export.

transfer : str, optional

Transfer mdoe to pass to Datastore.export.

Methods Summary

saveDataIds(dataIds, *, elements) Export the dimension records associated with one or more data IDs.
saveDatasets(refs, *, elements, rewrite, …) Export one or more datasets.

Methods Documentation

saveDataIds(dataIds: Iterable[ExpandedDataCoordinate], *, elements: Optional[Iterable[DimensionElement]] = None)

Export the dimension records associated with one or more data IDs.

Parameters:
dataIds : iterable of ExpandedDataCoordinate.

Fully-expanded data IDs to export.

elements : iterable of DimensionElement, optional

Dimension elements whose records should be exported. If None, records for all dimensions will be exported.

saveDatasets(refs: Iterable[DatasetRef], *, elements: Optional[Iterable[DimensionElement]] = None, rewrite: Optional[Callable[[FileDataset], FileDataset]] = None)

Export one or more datasets.

This automatically exports any DatasetType, Run, and dimension records associated with the datasets.

Parameters:
refs : iterable of DatasetRef

References to the datasets to export. Their DatasetRef.id attributes must not be None. Duplicates are automatically ignored.

elements : iterable of DimensionElement, optional

Dimension elements whose records should be exported; this is forwarded to saveDataIds when exporting the data IDs of the given datasets.

rewrite : callable, optional

A callable that takes a single FileDataset argument and returns a modified FileDataset. This is typically used to rewrite the path generated by the datastore. If None, the FileDataset returned by Datastore.export will be used directly.

Notes

At present, this only associates datasets with the collection that matches their run name. Other collections will be included in the export in the future (once Registry provides a way to look up that information).