def process_image(path, bands=None, verbose=False, pansharpen=False, force_unzip=None, ndvi=False, cloudmask=False): """ Handles constructing and image process. :param path: The path to the image that has to be processed :type path: String :param bands: List of bands that has to be processed. (optional) :type bands: List :param verbose: Sets the level of verbosity. Default is False. :type verbose: boolean :param pansharpen: Whether to pansharpen the image. Default is False. :type pansharpen: boolean :returns: (String) path to the processed image """ try: bands = convert_to_integer_list(bands) if isinstance(ndvi, str): p = Process(path, bands=[4,5], verbose=verbose, force_unzip=force_unzip) else: p = Process(path, bands=bands, verbose=verbose, force_unzip=force_unzip) except IOError: exit("Zip file corrupted", 1) except FileDoesNotExist as e: exit(e.message, 1) if isinstance(ndvi, str): out=[p.run_ndvi(mode=ndvi,cmask=cloudmask)] else: out=[p.run_rgb(pansharpen)] return out