22 __all__ = [
"CoaddDataIdContainer",
"ExistingCoaddDataIdContainer"]
30 """A version of lsst.pipe.base.DataIdContainer specialized for coaddition.
32 Required because butler.subset does not support patch and tract
34 This code was originally in pipe_tasks (coaddBase.py)
38 """Only retrieve skymap if required"""
39 if not hasattr(self,
"_skymap"):
40 self.
_skymap = namespace.butler.get(namespace.config.coaddName +
"Coadd_skyMap")
44 """Make self.refList from self.idList
46 validKeys = namespace.butler.getKeys(datasetType=self.datasetType, level=self.level)
48 for dataId
in self.idList:
50 if key
in (
"tract",
"patch"):
54 raise argparse.ArgumentError(
None,
"--id must include " + key)
57 if "tract" not in dataId:
59 raise RuntimeError(
"'patch' cannot be specified without 'tract'")
60 addList = [dict(tract=tract.getId(), patch=
"%d,%d" % patch.getIndex(), **dataId)
61 for tract
in self.
getSkymap(namespace)
for patch
in tract]
62 elif "patch" not in dataId:
63 tract = self.
getSkymap(namespace)[dataId[
"tract"]]
64 addList = [dict(patch=
"%d,%d" % patch.getIndex(), **dataId)
for patch
in tract]
68 self.refList += [namespace.butler.dataRef(datasetType=self.datasetType, dataId=addId)
73 """A version of CoaddDataIdContainer that only produces references that exist"""