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,
help="REPO is the URI or path to the gen3 repository. Will be created if it does not already "
"exist")
49 @click.option("--gen2root", required=True,
help="Root path of the gen 2 repo to be converted.")
50 @click.option("--skymap-name",
help="Name of the new gen3 skymap (e.g. 'discrete/ci_hsc').
")
51 @click.option("--skymap-config",
help="Path to skymap config file defining the new gen3 skymap.")
52 @click.option("--calibs",
help="Path to the gen 2 calibration repo. It can be absolute or relative to gen2root.")
53 @click.option("--reruns", multiple=True, callback=split_commas, metavar=typeStrAcceptsMultiple,
help=("List of rerun paths to convert. Output collection names will be "
"guessed, which can fail if the Gen2 repository paths do not follow a "
"recognized convention. In this case, the command-line interface cannot "
"be used."))
54 @transfer_option(help="Mode to use to transfer files into the new repository.")
56 @config_file_option(help="Path to a `ConvertRepoConfig` override to be included after the Instrument config "
"overrides are applied.")
57 @options_file_option()
59 """Convert one or more Butler gen 2 repositories into a gen 3 repository.
61 This is a highly simplified interface that should only be used to convert
62 suites of gen 2 repositories that contain at most one calibration repo and
63 has no chained reruns. Custom scripts that call ConvertRepoTask should be
64 used on more complex suites of repositories.
66 script.convert(*args, **kwargs)
69 @click.command(short_help="Define visits from exposures.", cls=ButlerCommand)
70 @repo_argument(required=True)
71 @instrument_argument(required=True)
72 @config_file_option(help="Path to a pex_config override to be included after the Instrument config overrides "
"are applied.")
73 @click.option("--collections",
help="The collections to be searched (in order) when reading datasets.
",
75 callback=split_commas,
76 metavar=typeStrAcceptsMultiple)
78 @options_file_option()
79 def define_visits(*args, **kwargs):
80 """Define visits from exposures in the butler registry."""
81 script.defineVisits(*args, **kwargs)
84 @click.command(short_help="Ingest raw frames.", cls=ButlerCommand)
85 @repo_argument(required=True)
86 @locations_argument(help="LOCATIONS specifies files to ingest and/or locations to search for files.",
required=True)
87 @regex_option(default=fits_re,
help="Regex string used to find files in directories listed in LOCATIONS. "
"Searches for fits files by default.")
88 @config_option(metavar="TEXT=TEXT", multiple=True)
89 @config_file_option(type=click.Path(exists=True, writable=False, file_okay=True, dir_okay=False))
90 @run_option(required=False)
93 @click.option("--ingest-task", default="lsst.obs.base.RawIngestTask", help="The fully qualified class name "
"of the ingest task to use.")
94 @options_file_option()
95 def ingest_raws(*args, **kwargs):
96 """Ingest raw frames into from a directory into the butler registry"""
97 script.ingestRaws(*args, **kwargs)
100 @click.command(short_help="Add an instrument to the repository", cls=ButlerCommand)
101 @repo_argument(required=True)
102 @instrument_argument(required=True, nargs=-1, help="The fully-qualified name of an Instrument subclass.")
103 def register_instrument(*args, **kwargs):
104 """Add an instrument to the data repository.
106 script.registerInstrument(*args, **kwargs)
109 @click.command(short_help="Add an instrument's curated calibrations.", cls=ButlerCommand)
110 @repo_argument(required=True)
111 @instrument_argument(required=True)
112 @click.option("--collection", required=False,
help="Name of the calibration collection that associates datasets with validity ranges.")
113 @click.option("--label", "labels", multiple=True,
help=("Extra strings to include (with automatic delimiters) in all RUN collection names,
"
114 "as well as the calibration collection name if it is not provided via --collection."))
115 @options_file_option()
116 def write_curated_calibrations(*args, **kwargs):
117 """Add an instrument's curated calibrations to the data repository.
119 script.writeCuratedCalibrations(*args, **kwargs)
120 def convert(repo, gen2root, skymap_name, skymap_config, calibs, reruns, config_file, transfer, processes=1)