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
registryRegistry

Registry to export from.

datastoreDatastore

Datastore to export from.

backendRepoExportBackend

Implementation class for a particular export file format.

directorystr, optional

Directory to pass to Datastore.export.

transferstr, 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
dataIdsiterable of ExpandedDataCoordinate.

Fully-expanded data IDs to export.

elementsiterable 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
refsiterable of DatasetRef

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

elementsiterable of DimensionElement, optional

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

rewritecallable, 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.