Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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 

22import click 

23 

24from lsst.daf.butler.cli.opt import (repo_argument, config_option, config_file_option, run_option, 

25 transfer_option) 

26from lsst.daf.butler.cli.utils import (cli_handle_exception, ParameterType, split_commas, 

27 typeStrAcceptsMultiple) 

28from ..opt import instrument_parameter 

29from ... import script 

30 

31 

32@click.command(short_help="Convert a gen2 repo to gen3.") 

33@repo_argument(required=True, 

34 help="REPO is the URI or path to the gen3 repository. Will be created if it does not already " 

35 "exist") 

36@click.option("--gen2root", required=True, 

37 help="Root path of the gen 2 repo to be converted.") 

38@click.option("--skymap-name", 

39 help="Name of the new gen3 skymap (e.g. 'discrete/ci_hsc').") 

40@click.option("--skymap-config", 

41 help="Path to skymap config file defining the new gen3 skymap.") 

42@click.option("--calibs", 

43 help="Path to the gen 2 calibration repo. It can be absolute or relative to gen2root.") 

44@click.option("--reruns", multiple=True, callback=split_commas, metavar=typeStrAcceptsMultiple, 

45 help="List of gen 2 reruns to convert.") 

46@transfer_option(help="Mode to use to transfer files into the new repository.") 

47@config_file_option(help="Path to a `ConvertRepoConfig` override to be included after the Instrument config " 

48 "overrides are applied.") 

49def convert(*args, **kwargs): 

50 """Convert a Butler gen 2 repository into a gen 3 repository.""" 

51 cli_handle_exception(script.convert, *args, **kwargs) 

52 

53 

54@click.command(short_help="Define visits from exposures.") 

55@repo_argument(required=True) 

56@config_file_option(help="Path to a pex_config override to be included after the Instrument config overrides " 

57 "are applied.") 

58@click.option("--collections", 

59 help="The collections to be searched (in order) when reading datasets.", 

60 multiple=True, 

61 callback=split_commas, 

62 metavar=typeStrAcceptsMultiple) 

63@instrument_parameter(required=True) 

64def define_visits(*args, **kwargs): 

65 """Define visits from exposures in the butler registry.""" 

66 cli_handle_exception(script.defineVisits, *args, **kwargs) 

67 

68 

69@click.command(short_help="Ingest raw frames.") 

70@repo_argument(required=True) 

71@config_option(metavar="TEXT=TEXT", multiple=True, split_kv=True) 

72@config_file_option(type=click.Path(exists=True, writable=False, file_okay=True, dir_okay=False)) 

73@run_option(required=False) 

74@click.option("-d", "--dir", "directory", 

75 help="The path to the directory containing the raws to ingest.") 

76@click.option("-f", "--file", help="The name of a file containing raws to ingest.") 

77@transfer_option() 

78@click.option("--ingest-task", default="lsst.obs.base.RawIngestTask", help="The fully qualified class name " 

79 "of the ingest task to use.") 

80def ingest_raws(*args, **kwargs): 

81 """Ingest raw frames into from a directory into the butler registry""" 

82 cli_handle_exception(script.ingestRaws, *args, **kwargs) 

83 

84 

85@click.command(short_help="Add an instrument to the repository") 

86@repo_argument(required=True) 

87@instrument_parameter(parameterType=ParameterType.ARGUMENT, required=True, multiple=True, 

88 help="The fully-qualified name of an Instrument subclass.") 

89def register_instrument(*args, **kwargs): 

90 """Add an instrument to the data repository. 

91 """ 

92 cli_handle_exception(script.registerInstrument, *args, **kwargs) 

93 

94 

95@click.command(short_help="Add an instrument's curated calibrations.") 

96@repo_argument(required=True) 

97@instrument_parameter(required=True) 

98@run_option(required=False) 

99def write_curated_calibrations(*args, **kwargs): 

100 """Add an instrument's curated calibrations to the data repository. 

101 """ 

102 cli_handle_exception(script.writeCuratedCalibrations, *args, **kwargs)