<commit_before>import click
from rasterio.dtypes import dtype_ranges
from rasterio.enums import Resampling
from rasterio.rio.options import creation_options
import tilematrix
import tqdm

import mapchete
from mapchete import commands
from mapchete.cli import options
from mapchete.formats import available_output_formats

OUTPUT_FORMATS = available_output_formats()


def _validate_bidx(ctx, param, bidx):
    if bidx:
        try:
            return list(map(int, bidx.split(",")))
        except ValueError:
            raise click.BadParameter("band indexes must be positive integer values")


@click.command(help="Convert outputs or other geodata.")
@options.arg_tiledir
@options.arg_output
@options.opt_zoom
@options.opt_bounds
@options.opt_bounds_crs
@options.opt_area
@options.opt_area_crs
@options.opt_point
@options.opt_point_crs
@click.option(
    "--clip-geometry",
    "-c",
    type=click.Path(exists=True),
    help="Clip output by geometry.",
)
@click.option("--bidx", callback=_validate_bidx, help="Band indexes to copy.")
@click.option(
    "--output-pyramid",
    type=click.STRING,
    help="Output pyramid to write to.",
)
@click.option(
    "--output-metatiling",
    type=click.INT,
    help="Output metatiling.",
)
@click.option(
    "--output-format",
    type=click.Choice(OUTPUT_FORMATS),
    help="Output format.",
)
@click.option(
    "--output-dtype",<commit_msg>allow remote files for --clip<commit_after>import click
from rasterio.dtypes import dtype_ranges
from rasterio.enums import Resampling
from rasterio.rio.options import creation_options
import tilematrix
import tqdm

import mapchete
from mapchete import commands
from mapchete.cli import options
from mapchete.formats import available_output_formats

OUTPUT_FORMATS = available_output_formats()


def _validate_bidx(ctx, param, bidx):
    if bidx:
        try:
            return list(map(int, bidx.split(",")))
        except ValueError:
            raise click.BadParameter("band indexes must be positive integer values")


@click.command(help="Convert outputs or other geodata.")
@options.arg_tiledir
@options.arg_output
@options.opt_zoom
@options.opt_bounds
@options.opt_bounds_crs
@options.opt_area
@options.opt_area_crs
@options.opt_point
@options.opt_point_crs
@click.option(
    "--clip-geometry",
    "-c",
    type=click.Path(),
    help="Clip output by geometry.",
)
@click.option("--bidx", callback=_validate_bidx, help="Band indexes to copy.")
@click.option(
    "--output-pyramid",
    type=click.STRING,
    help="Output pyramid to write to.",
)
@click.option(
    "--output-metatiling",
    type=click.INT,
    help="Output metatiling.",
)
@click.option(
    "--output-format",
    type=click.Choice(OUTPUT_FORMATS),
    help="Output format.",
)
@click.option(
    "--output-dtype",
{'fraction_non_alphanumeric': 0.12011473646468268, 'fraction_numerical': 0.0, 'mean_word_length': 4.214953271028038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1532664', 'n_tokens_mistral': 902, 'n_tokens_neox': 895, 'n_words': 207}