@click.command(help="<STR_LIT>")<EOL>@utils.arg_mapchete_files<EOL>@utils.opt_zoom<EOL>@utils.opt_bounds<EOL>@utils.opt_point<EOL>@utils.opt_wkt_geometry<EOL>@utils.opt_tile<EOL>@utils.opt_overwrite<EOL>@utils.opt_multi<EOL>@utils.opt_input_file<EOL>@utils.opt_logfile<EOL>@utils.opt_verbose<EOL>@utils.opt_no_pbar<EOL>@utils.opt_debug<EOL>@utils.opt_max_chunksize<EOL>@utils.opt_vrt<EOL>@utils.opt_idx_out_dir<EOL>def execute(<EOL>mapchete_files,<EOL>zoom=None,<EOL>bounds=None,<EOL>point=None,<EOL>wkt_geometry=None,<EOL>tile=None,<EOL>overwrite=False,<EOL>multi=None,<EOL>input_file=None,<EOL>logfile=None,<EOL>verbose=False,<EOL>no_pbar=False,<EOL>debug=False,<EOL>max_chunksize=None,<EOL>vrt=False,<EOL>idx_out_dir=None<EOL>):
multi = multi if multi else cpu_count()<EOL>mode = "<STR_LIT>" if overwrite else "<STR_LIT>"<EOL>if debug or not verbose:<EOL><INDENT>verbose_dst = open(os.devnull, '<STR_LIT:w>')<EOL><DEDENT>else:<EOL><INDENT>verbose_dst = sys.stdout<EOL><DEDENT>for mapchete_file in mapchete_files:<EOL><INDENT>tqdm.tqdm.write("<STR_LIT>" % mapchete_file, file=verbose_dst)<EOL>with click_spinner.spinner(disable=debug) as spinner:<EOL><INDENT>if tile:<EOL><INDENT>tile = raw_conf_process_pyramid(raw_conf(mapchete_file)).tile(*tile)<EOL>with mapchete.open(<EOL>mapchete_file,<EOL>mode=mode,<EOL>bounds=tile.bounds,<EOL>zoom=tile.zoom,<EOL>single_input_file=input_file<EOL>) as mp:<EOL><INDENT>spinner.stop()<EOL>tqdm.tqdm.write("<STR_LIT>", file=verbose_dst)<EOL>for result in mp.batch_processor(tile=tile):<EOL><INDENT>utils.write_verbose_msg(result, dst=verbose_dst)<EOL><DEDENT>tqdm.tqdm.write(<EOL>"<STR_LIT>" % mapchete_file, file=verbose_dst<EOL>)<EOL>if vrt:<EOL><INDENT>tqdm.tqdm.write("<STR_LIT>", file=verbose_dst)<EOL>for tile in tqdm.tqdm(<EOL>zoom_index_gen(<EOL>mp=mp,<EOL>zoom=tile.zoom,<EOL>out_dir=(<EOL>idx_out_dir if idx_out_dir else mp.config.output.path<EOL>),<EOL>vrt=vrt,<EOL>),<EOL>total=mp.count_tiles(tile.zoom, tile.zoom),<EOL>unit="<STR_LIT>",<EOL>disable=debug or no_pbar<EOL>):<EOL><INDENT>logger.debug("<STR_LIT>", tile)<EOL><DEDENT>tqdm.tqdm.write(<EOL>"<STR_LIT>" % mapchete_file,<EOL>file=verbose_dst<EOL>)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>with mapchete.open(<EOL>mapchete_file,<EOL>mode=mode,<EOL>zoom=zoom,<EOL>bounds=bounds_from_opts(<EOL>wkt_geometry=wkt_geometry,<EOL>point=point,<EOL>bounds=bounds,<EOL>raw_conf=raw_conf(mapchete_file)<EOL>),<EOL>single_input_file=input_file<EOL>) as mp:<EOL><INDENT>spinner.stop()<EOL>tiles_count = mp.count_tiles(<EOL>min(mp.config.init_zoom_levels),<EOL>max(mp.config.init_zoom_levels)<EOL>)<EOL>tqdm.tqdm.write(<EOL>"<STR_LIT>" % (tiles_count, multi),<EOL>file=verbose_dst<EOL>)<EOL>for process_info in tqdm.tqdm(<EOL>mp.batch_processor(<EOL>multi=multi, zoom=zoom, max_chunksize=max_chunksize<EOL>),<EOL>total=tiles_count,<EOL>unit="<STR_LIT>",<EOL>disable=debug or no_pbar<EOL>):<EOL><INDENT>utils.write_verbose_msg(process_info, dst=verbose_dst)<EOL><DEDENT>tqdm.tqdm.write(<EOL>"<STR_LIT>" % mapchete_file, file=verbose_dst<EOL>)<EOL>if vrt:<EOL><INDENT>tqdm.tqdm.write("<STR_LIT>", file=verbose_dst)<EOL>for tile in tqdm.tqdm(<EOL>zoom_index_gen(<EOL>mp=mp,<EOL>zoom=mp.config.init_zoom_levels,<EOL>out_dir=(<EOL>idx_out_dir if idx_out_dir<EOL>else mp.config.output.path<EOL>),<EOL>vrt=vrt<EOL>),<EOL>total=mp.count_tiles(<EOL>min(mp.config.init_zoom_levels),<EOL>max(mp.config.init_zoom_levels)<EOL>),<EOL>unit="<STR_LIT>",<EOL>disable=debug or no_pbar<EOL>):<EOL><INDENT>logger.debug("<STR_LIT>", tile)<EOL><DEDENT>tqdm.tqdm.write(<EOL>"<STR_LIT>" % mapchete_file,<EOL>file=verbose_dst<EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>
Execute a Mapchete process.