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