24 from lsst.daf.butler.cli.opt
import (repo_argument, config_option, config_file_option, locations_argument,
25 options_file_option, regex_option, run_option, transfer_option)
26 from lsst.daf.butler.cli.utils
import (cli_handle_exception, split_commas, typeStrAcceptsMultiple)
27 from ..opt
import instrument_argument, instrument_option
28 from ...
import script
32 fits_re =
r"\.fit[s]?\b"
35 @click.command(short_help=
"Convert a gen2 repo to gen3.")
36 @repo_argument(required=
True,
37 help=
"REPO is the URI or path to the gen3 repository. Will be created if it does not already "
39 @click.option(
"--gen2root", required=
True,
40 help=
"Root path of the gen 2 repo to be converted.")
41 @click.option(
"--skymap-name",
42 help=
"Name of the new gen3 skymap (e.g. 'discrete/ci_hsc').")
43 @click.option(
"--skymap-config",
44 help=
"Path to skymap config file defining the new gen3 skymap.")
45 @click.option(
"--calibs",
46 help=
"Path to the gen 2 calibration repo. It can be absolute or relative to gen2root.")
47 @click.option(
"--reruns", multiple=
True, callback=split_commas, metavar=typeStrAcceptsMultiple,
48 help=
"List of gen 2 reruns to convert.")
49 @transfer_option(help=
"Mode to use to transfer files into the new repository.")
50 @config_file_option(help=
"Path to a `ConvertRepoConfig` override to be included after the Instrument config "
51 "overrides are applied.")
52 @options_file_option()
54 """Convert a Butler gen 2 repository into a gen 3 repository."""
55 cli_handle_exception(script.convert, *args, **kwargs)
58 @click.command(short_help=
"Define visits from exposures.")
59 @repo_argument(required=
True)
60 @config_file_option(help=
"Path to a pex_config override to be included after the Instrument config overrides "
62 @click.option(
"--collections",
63 help=
"The collections to be searched (in order) when reading datasets.",
65 callback=split_commas,
66 metavar=typeStrAcceptsMultiple)
68 @options_file_option()
70 """Define visits from exposures in the butler registry."""
71 cli_handle_exception(script.defineVisits, *args, **kwargs)
74 @click.command(short_help=
"Ingest raw frames.")
75 @repo_argument(required=
True)
76 @locations_argument(help=
"LOCATIONS specifies files to ingest and/or locations to search for files.",
78 @regex_option(default=fits_re,
79 help=
"Regex string used to find files in directories listed in LOCATIONS. "
80 "Searches for fits files by default.")
81 @config_option(metavar=
"TEXT=TEXT", multiple=
True)
82 @config_file_option(type=click.Path(exists=
True, writable=
False, file_okay=
True, dir_okay=
False))
83 @run_option(required=
False)
85 @click.option(
"--ingest-task", default=
"lsst.obs.base.RawIngestTask", help=
"The fully qualified class name "
86 "of the ingest task to use.")
87 @options_file_option()
89 """Ingest raw frames into from a directory into the butler registry"""
90 cli_handle_exception(script.ingestRaws, *args, **kwargs)
93 @click.command(short_help=
"Add an instrument to the repository")
94 @repo_argument(required=
True)
95 @
instrument_argument(required=
True, nargs=-1, help=
"The fully-qualified name of an Instrument subclass.")
97 """Add an instrument to the data repository.
99 cli_handle_exception(script.registerInstrument, *args, **kwargs)
102 @click.command(short_help=
"Add an instrument's curated calibrations.")
103 @repo_argument(required=
True)
105 @run_option(required=
False)
106 @options_file_option()
108 """Add an instrument's curated calibrations to the data repository.
110 cli_handle_exception(script.writeCuratedCalibrations, *args, **kwargs)