Skip to content

Commit

Permalink
Use conforming dataId for validation of instrument DatasetRef
Browse files Browse the repository at this point in the history
Add fake values for the missing dimensions.
  • Loading branch information
timj committed Jun 16, 2023
1 parent 821c27e commit 78aa265
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/lsst/daf/butler/_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2514,14 +2514,19 @@ def validateConfiguration(
if "instrument" in self.dimensions:
instruments = {record.name for record in self.registry.queryDimensionRecords("instrument")}

dimensions = self.dimensions.extract(("instrument",))
for datasetType in datasetTypes:
if "instrument" in datasetType.dimensions:
# In order to create a conforming dataset ref, create
# fake DataCoordinate values for the non-instrument
# dimensions. The type of the value does not matter here.
dataId = {dim.name: 1 for dim in datasetType.dimensions if dim.name != "instrument"}

for instrument in instruments:
datasetRef = DatasetRef(
datasetType,
DataCoordinate.standardize(instrument=instrument, graph=dimensions),
conform=False,
DataCoordinate.standardize(
dataId, instrument=instrument, graph=datasetType.dimensions
),
run="validate",
)
datasetRefs.append(datasetRef)
Expand Down

0 comments on commit 78aa265

Please sign in to comment.