24 from lsst.daf.butler.cli.opt
import (repo_argument,
34 from lsst.daf.butler.cli.utils
import (
37 typeStrAcceptsMultiple
39 from ..opt
import instrument_argument
40 from ...
import script
44 fits_re =
r"\.fit[s]?\b"
47 @click.command(short_help=
"Convert a gen2 repo to gen3.", cls=ButlerCommand)
48 @repo_argument(required=
True,
49 help=
"REPO is the URI or path to the gen3 repository. Will be created if it does not already "
51 @click.option(
"--gen2root", required=
True,
52 help=
"Root path of the gen 2 repo to be converted.")
53 @click.option(
"--skymap-name",
54 help=
"Name of the new gen3 skymap (e.g. 'discrete/ci_hsc').")
55 @click.option(
"--skymap-config",
56 help=
"Path to skymap config file defining the new gen3 skymap.")
57 @click.option(
"--calibs",
58 help=
"Path to the gen 2 calibration repo. It can be absolute or relative to gen2root.")
59 @click.option(
"--reruns", multiple=
True, callback=split_commas, metavar=typeStrAcceptsMultiple,
60 help=(
"List of rerun paths to convert. Output collection names will be "
61 "guessed, which can fail if the Gen2 repository paths do not follow a "
62 "recognized convention. In this case, the command-line interface cannot "
64 @transfer_option(help=
"Mode to use to transfer files into the new repository.")
66 @config_file_option(help=
"Path to a `ConvertRepoConfig` override to be included after the Instrument config "
67 "overrides are applied.")
68 @options_file_option()
70 """Convert one or more Butler gen 2 repositories into a gen 3 repository.
72 This is a highly simplified interface that should only be used to convert
73 suites of gen 2 repositories that contain at most one calibration repo and
74 has no chained reruns. Custom scripts that call ConvertRepoTask should be
75 used on more complex suites of repositories.
77 script.convert(*args, **kwargs)
80 @click.command(short_help=
"Define visits from exposures.", cls=ButlerCommand)
81 @repo_argument(required=
True)
83 @config_file_option(help=
"Path to a pex_config override to be included after the Instrument config overrides "
85 @click.option(
"--collections",
86 help=
"The collections to be searched (in order) when reading datasets.",
88 callback=split_commas,
89 metavar=typeStrAcceptsMultiple)
91 @options_file_option()
93 """Define visits from exposures in the butler registry."""
94 script.defineVisits(*args, **kwargs)
97 @click.command(short_help=
"Ingest raw frames.", cls=ButlerCommand)
98 @repo_argument(required=
True)
99 @locations_argument(help=
"LOCATIONS specifies files to ingest and/or locations to search for files.",
101 @regex_option(default=fits_re,
102 help=
"Regex string used to find files in directories listed in LOCATIONS. "
103 "Searches for fits files by default.")
104 @config_option(metavar=
"TEXT=TEXT", multiple=
True)
105 @config_file_option(type=click.Path(exists=
True, writable=
False, file_okay=
True, dir_okay=
False))
106 @run_option(required=
False)
109 @click.option(
"--ingest-task", default=
"lsst.obs.base.RawIngestTask", help=
"The fully qualified class name "
110 "of the ingest task to use.")
111 @options_file_option()
113 """Ingest raw frames into from a directory into the butler registry"""
114 script.ingestRaws(*args, **kwargs)
117 @click.command(short_help=
"Add an instrument to the repository", cls=ButlerCommand)
118 @repo_argument(required=
True)
119 @
instrument_argument(required=
True, nargs=-1, help=
"The fully-qualified name of an Instrument subclass.")
121 """Add an instrument to the data repository.
123 script.registerInstrument(*args, **kwargs)
126 @click.command(short_help=
"Add an instrument's curated calibrations.", cls=ButlerCommand)
127 @repo_argument(required=
True)
129 @click.option(
"--collection", required=
False,
130 help=
"Name of the calibration collection that associates datasets with validity ranges.")
131 @click.option(
"--label",
"labels", multiple=
True,
132 help=(
"Extra strings to include (with automatic delimiters) in all RUN collection names, "
133 "as well as the calibration collection name if it is not provided via --collection."))
134 @options_file_option()
136 """Add an instrument's curated calibrations to the data repository.
138 script.writeCuratedCalibrations(*args, **kwargs)