Skip to content

Commit

Permalink
Merge pull request #48 from lsst/tickets/DM-27147
Browse files Browse the repository at this point in the history
DM-27147: Move writing the skyMap dataset next to registering it.
  • Loading branch information
TallJimbo committed Nov 26, 2020
2 parents 97dc21a + 7688729 commit cbc8587
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions python/lsst/skymap/baseSkyMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,20 @@ def updateSha1(self, sha1):
"""
raise NotImplementedError()

def register(self, name, registry):
SKYMAP_RUN_COLLECTION_NAME = "skymaps"

SKYMAP_DATASET_TYPE_NAME = "skyMap"

def register(self, name, butler):
"""Add skymap, tract, and patch Dimension entries to the given Gen3
Butler Registry.
Butler.
Parameters
----------
name : `str`
The name of the skymap.
registry : `lsst.daf.butler.Registry`
The registry to add to.
butler : `lsst.daf.butler.Butler`
The butler to add to.
Raises
------
Expand Down Expand Up @@ -354,7 +358,20 @@ def register(self, name, registry):
"patch_nx_max": nxMax,
"patch_ny_max": nyMax,
}
with registry.transaction():
if registry.syncDimensionData("skymap", skyMapRecord):
registry.insertDimensionData("tract", *tractRecords)
registry.insertDimensionData("patch", *patchRecords)
butler.registry.registerRun(self.SKYMAP_RUN_COLLECTION_NAME)
# Kind of crazy that we've got three different capitalizations of
# "skymap" here, but that's what the various conventions (or at least
# precedents) dictate.
from lsst.daf.butler import DatasetType
datasetType = DatasetType(
name=self.SKYMAP_DATASET_TYPE_NAME,
dimensions=["skymap"],
storageClass="SkyMap",
universe=butler.registry.dimensions
)
butler.registry.registerDatasetType(datasetType)
with butler.transaction():
if butler.registry.syncDimensionData("skymap", skyMapRecord):
butler.registry.insertDimensionData("tract", *tractRecords)
butler.registry.insertDimensionData("patch", *patchRecords)
butler.put(self, datasetType, {"skymap": name}, run=self.SKYMAP_RUN_COLLECTION_NAME)

0 comments on commit cbc8587

Please sign in to comment.