24from lsst.daf.butler
import Butler
25from lsst.resources
import ResourcePath
30_log = logging.getLogger(__name__)
34 """Config for makeSkyMap.
36 name = pexConfig.Field(
37 doc="Name assigned to created skymap in butler registry",
42 skyMap = skyMapRegistry.makeField(
49 raise ValueError(
"The name field must be set to the name of the specific "
50 "skymap to use when writing to the butler")
54 """Construct and save a SkyMap into a gen3 butler repository.
58 butler : `lsst.daf.butler.Butler`
59 Butler repository to which the new skymap will be written.
60 config : `MakeSkyMapConfig` or None
61 Instance of a configuration
class specifying task options.
63 skyMap = config.skyMap.apply()
64 skyMap.logSkyMapInfo(_log)
65 skyMap.register(config.name, butler)
68def registerSkymap(repo, config, config_file):
69 """Make and register a SkyMap in a butler repository.
74 URI to the location of the butler repository.
75 config : `dict` [`str`, `str`] or `
None`
76 Key-value pairs to apply
as overrides to the ingest config.
77 config_file : `str`
or `
None`
78 Path to a config overrides file. Can be a URI.
83 If a config overrides file
is given
and does
not exist.
91 resource = ResourcePath(config_file)
92 with resource.as_local()
as local_config:
93 skyMapConfig.load(local_config.ospath)
96 skyMapConfig.update(**config)
98 butler = Butler(repo, writeable=
True)
makeSkyMap(butler, config)