def setup_arguments(self): # Call method on super class # super(self.__class__, self).setup_arguments() CellTool.setup_arguments(self) self.parser.add_argument("--dataset-type", help="The type(s) of dataset to retrieve", action="store", dest="dataset_type", type=dataset_type_arg, nargs="+", choices=self.get_supported_dataset_types(), default=DatasetType.ARG25, required=True, metavar=" ".join([s.name for s in self.get_supported_dataset_types()])) self.parser.add_argument("--output-directory", help="Output directory", action="store", dest="output_directory", type=writeable_dir, required=True) self.parser.add_argument("--overwrite", help="Over write existing output file", action="store_true", dest="overwrite", default=False) self.parser.add_argument("--list-only", help="List the datasets that would be retrieved rather than retrieving them", action="store_true", dest="list_only", default=False) self.parser.add_argument("--output-format", help="The format of the output dataset", action="store", dest="output_format", type=output_format_arg, choices=OutputFormat, default=OutputFormat.GEOTIFF, metavar=" ".join([f.name for f in OutputFormat]))
def process_arguments(self, args): # Call method on super class # super(self.__class__, self).process_arguments(args) CellTool.process_arguments(self, args) self.dataset_types = args.dataset_type self.output_directory = args.output_directory self.overwrite = args.overwrite self.list_only = args.list_only self.output_format = args.output_format
def __init__(self, name): # Call method on super class # super(self.__class__, self).__init__(name) CellTool.__init__(self, name) self.dataset_types = None self.output_directory = None self.overwrite = None self.list_only = None self.output_format = None
def log_arguments(self): # Call method on super class # super(self.__class__, self).log_arguments() CellTool.log_arguments(self) _log.info(""" datasets to retrieve = {dataset_type} output directory = {output} over write existing = {overwrite} list only = {list_only} output format = {output_format} """.format(dataset_type=" ".join([d.name for d in self.dataset_types]), output=self.output_directory, overwrite=self.overwrite, list_only=self.list_only, output_format=self.output_format.name))
def process_arguments(self, args): # Call method on super class # super(self.__class__, self).process_arguments(args) CellTool.process_arguments(self, args) self.dataset_type = args.dataset_type if args.bands == BandListType.ALL: self.bands = get_band_name_union(self.dataset_type, self.satellites) else: self.bands = get_band_name_intersection(self.dataset_type, self.satellites) self.output_directory = args.output_directory self.overwrite = args.overwrite self.list_only = args.list_only self.output_format = args.output_format
def setup_arguments(self): # Call method on super class # super(self.__class__, self).setup_arguments() CellTool.setup_arguments(self) self.parser.add_argument("--dataset-type", help="The type(s) of dataset to retrieve", action="store", dest="dataset_type", type=dataset_type_arg, choices=self.get_supported_dataset_types(), default=DatasetType.ARG25, required=True, metavar=" ".join([s.name for s in self.get_supported_dataset_types()])) group = self.parser.add_mutually_exclusive_group() # TODO explicit list of bands # group.add_argument("--bands", help="List of bands to retrieve", action="store") group.add_argument("--bands-all", help="Retrieve all bands with NULL values where the band is N/A", action="store_const", dest="bands", const=BandListType.ALL) group.add_argument("--bands-common", help="Retrieve only bands in common across all satellites", action="store_const", dest="bands", const=BandListType.COMMON) self.parser.set_defaults(bands=BandListType.ALL) self.parser.add_argument("--output-directory", help="Output directory", action="store", dest="output_directory", type=writeable_dir, required=True) self.parser.add_argument("--overwrite", help="Over write existing output file", action="store_true", dest="overwrite", default=False) self.parser.add_argument("--list-only", help="List the datasets that would be retrieved rather than retrieving them", action="store_true", dest="list_only", default=False) self.parser.add_argument("--output-format", help="The format of the output dataset", action="store", dest="output_format", type=output_format_arg, choices=OutputFormat, default=OutputFormat.GEOTIFF, metavar=" ".join([f.name for f in OutputFormat]))