lsst.obs.base  20.0.0-37-g38a3e24+8332fa3829
commands.py
Go to the documentation of this file.
1 # This file is part of obs_base.
2 #
3 # Developed for the LSST Data Management System.
4 # This product includes software developed by the LSST Project
5 # (http://www.lsst.org).
6 # See the COPYRIGHT file at the top-level directory of this distribution
7 # for details of code ownership.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 import click
23 
24 from lsst.daf.butler.cli.opt import (repo_argument, config_option, config_file_option, run_option,
25  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
29 
30 
31 @click.command(short_help="Convert a gen2 repo to gen3.")
32 @repo_argument(required=True,
33  help="REPO is the URI or path to the gen3 repository. Will be created if it does not already "
34  "exist")
35 @click.option("--gen2root", required=True,
36  help="Root path of the gen 2 repo to be converted.")
37 @click.option("--skymap-name",
38  help="Name of the new gen3 skymap (e.g. 'discrete/ci_hsc').")
39 @click.option("--skymap-config",
40  help="Path to skymap config file defining the new gen3 skymap.")
41 @click.option("--calibs",
42  help="Path to the gen 2 calibration repo. It can be absolute or relative to gen2root.")
43 @click.option("--reruns", multiple=True, callback=split_commas, metavar=typeStrAcceptsMultiple,
44  help="List of gen 2 reruns to convert.")
45 @transfer_option(help="Mode to use to transfer files into the new repository.")
46 @config_file_option(help="Path to a `ConvertRepoConfig` override to be included after the Instrument config "
47  "overrides are applied.")
48 def convert(*args, **kwargs):
49  """Convert a Butler gen 2 repository into a gen 3 repository."""
50  cli_handle_exception(script.convert, *args, **kwargs)
51 
52 
53 @click.command(short_help="Define visits from exposures.")
54 @repo_argument(required=True)
55 @config_file_option(help="Path to a pex_config override to be included after the Instrument config overrides "
56  "are applied.")
57 @click.option("--collections",
58  help="The collections to be searched (in order) when reading datasets.",
59  multiple=True,
60  callback=split_commas,
61  metavar=typeStrAcceptsMultiple)
62 @instrument_option(required=True)
63 def define_visits(*args, **kwargs):
64  """Define visits from exposures in the butler registry."""
65  cli_handle_exception(script.defineVisits, *args, **kwargs)
66 
67 
68 @click.command(short_help="Ingest raw frames.")
69 @repo_argument(required=True)
70 @config_option(metavar="TEXT=TEXT", multiple=True)
71 @config_file_option(type=click.Path(exists=True, writable=False, file_okay=True, dir_okay=False))
72 @run_option(required=False)
73 @click.option("-d", "--dir", "directory",
74  help="The path to the directory containing the raws to ingest.")
75 @click.option("-f", "--file", help="The name of a file containing raws to ingest.")
76 @transfer_option()
77 @click.option("--ingest-task", default="lsst.obs.base.RawIngestTask", help="The fully qualified class name "
78  "of the ingest task to use.")
79 def ingest_raws(*args, **kwargs):
80  """Ingest raw frames into from a directory into the butler registry"""
81  cli_handle_exception(script.ingestRaws, *args, **kwargs)
82 
83 
84 @click.command(short_help="Add an instrument to the repository")
85 @repo_argument(required=True)
86 @instrument_argument(required=True, nargs=-1, help="The fully-qualified name of an Instrument subclass.")
87 def register_instrument(*args, **kwargs):
88  """Add an instrument to the data repository.
89  """
90  cli_handle_exception(script.registerInstrument, *args, **kwargs)
91 
92 
93 @click.command(short_help="Add an instrument's curated calibrations.")
94 @repo_argument(required=True)
95 @instrument_option(required=True)
96 @run_option(required=False)
97 def write_curated_calibrations(*args, **kwargs):
98  """Add an instrument's curated calibrations to the data repository.
99  """
100  cli_handle_exception(script.writeCuratedCalibrations, *args, **kwargs)
cmd.commands.register_instrument
def register_instrument(*args, **kwargs)
Definition: commands.py:87
cmd.commands.define_visits
def define_visits(*args, **kwargs)
Definition: commands.py:63
cmd.commands.write_curated_calibrations
def write_curated_calibrations(*args, **kwargs)
Definition: commands.py:97
opt.options.instrument_option
instrument_option
Definition: options.py:25
cmd.commands.convert
def convert(*args, **kwargs)
Definition: commands.py:48
cmd.commands.ingest_raws
def ingest_raws(*args, **kwargs)
Definition: commands.py:79
opt.arguments.instrument_argument
instrument_argument
Definition: arguments.py:25