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
.
- registry
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.
- dataIdsiterable of
-
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 beNone
. 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 modifiedFileDataset
. This is typically used to rewrite the path generated by the datastore. IfNone
, theFileDataset
returned byDatastore.export
will be used directly.
- refsiterable of