def _format_info(): # noinspection PyUnresolvedReferences input_processors = get_obj_registry().get_all(type=InputProcessor) output_writers = query_dataset_io(lambda ds_io: 'w' in ds_io.modes) help_text = '\ninput processors to be used with option --proc:\n' help_text += _format_input_processors(input_processors) help_text += '\nFor more input processors use existing "xcube-gen-..." plugins ' \ "from the xcube's GitHub organisation or write your own plugin.\n" help_text += '\n' help_text += '\noutput formats to be used with option --format:\n' help_text += _format_dataset_ios(output_writers) help_text += '\n' return help_text
def _format_info(): from xcube.api.gen.iproc import InputProcessor from xcube.util.dsio import query_dataset_io from xcube.util.objreg import get_obj_registry input_processors = get_obj_registry().get_all(type=InputProcessor) output_writers = query_dataset_io(lambda ds_io: 'w' in ds_io.modes) help_text = '\ninput processors to be used with option --proc:\n' help_text += _format_input_processors(input_processors) help_text += '\nFor more input processors use existing "xcube-gen-..." plugins ' \ "from the xcube's GitHub organisation or write your own plugin.\n" help_text += '\n' help_text += '\noutput formats to be used with option --format:\n' help_text += _format_dataset_ios(output_writers) help_text += '\n' return help_text
def test_query_dataset_io_with_fn(self): ds_ios = query_dataset_io(lambda ds_io: ds_io.name == 'mem') self.assertEqual(1, len(ds_ios)) self.assertIsInstance(ds_ios[0], MemDatasetIO)
def test_query_dataset_io(self): ds_ios = query_dataset_io() self.assertEqual(4, len(ds_ios))
import click from xcube.api.gen.config import get_config_dict from xcube.api.gen.defaults import DEFAULT_OUTPUT_PATH, DEFAULT_OUTPUT_RESAMPLING from xcube.api.gen.gen import gen_cube from xcube.api.gen.iproc import InputProcessor from xcube.util.dsio import query_dataset_io from xcube.util.objreg import get_obj_registry from xcube.util.reproject import NAME_TO_GDAL_RESAMPLE_ALG input_processor_names = [ input_processor.name for input_processor in get_obj_registry().get_all(type=InputProcessor) ] output_writer_names = [ ds_io.name for ds_io in query_dataset_io(lambda ds_io: 'w' in ds_io.modes) ] resampling_algs = NAME_TO_GDAL_RESAMPLE_ALG.keys() # noinspection PyShadowingBuiltins @click.command(name='gen', context_settings={"ignore_unknown_options": True}) @click.argument('inputs', nargs=-1) @click.option( '--proc', '-p', type=click.Choice(input_processor_names), help=f'Input processor type name. ' f'The choices as input processor and additional information about input processors ' ' can be accessed by calling xcube gen --info . Defaults to "default" - the default input processor ' 'that can deal with most common datasets conforming with the CF conventions.'