diff --git a/felicette/cli.py b/felicette/cli.py index 2ba135e..62d6666 100644 --- a/felicette/cli.py +++ b/felicette/cli.py @@ -13,12 +13,14 @@ from felicette.utils.sys_utils import exit_cli, remove_dir from felicette.sat_processor import process_landsat_data + def trigger_download_and_processing(landsat_item, bands): # download data data_id = download_landsat_data(landsat_item, bands) # process data process_landsat_data(data_id, bands) + @click.command() @click.option( "-c", @@ -88,7 +90,9 @@ def main(coordinates, location_name, pan_enhancement, no_preview, vegetation, ve try: trigger_download_and_processing(landsat_item, bands) except RasterioIOError: - response = input("Local data for this location is corrupted, felicette will remove existing data to proceed, are you sure? [Y/n]") + response = input( + "Local data for this location is corrupted, felicette will remove existing data to proceed, are you sure? [Y/n]" + ) if response in ["y", "Y", ""]: # remove file dir file_paths = file_paths_wrt_id(landsat_item._data["id"]) @@ -99,6 +103,5 @@ def main(coordinates, location_name, pan_enhancement, no_preview, vegetation, ve exit_cli(print, "") - if __name__ == "__main__": main() diff --git a/felicette/sat_downloader.py b/felicette/sat_downloader.py index a3c7a6f..07347b6 100644 --- a/felicette/sat_downloader.py +++ b/felicette/sat_downloader.py @@ -16,7 +16,7 @@ def handle_prompt_response(response): if response in ["n", "N"]: exit_cli( rprint, - "Why not try a different location next time? I'd suggest [link=https://en.wikipedia.org/wiki/Svalbard]Svalbard[/link] :)" + "Why not try a different location next time? I'd suggest [link=https://en.wikipedia.org/wiki/Svalbard]Svalbard[/link] :)", ) elif response in ["y", "Y", ""]: return None diff --git a/felicette/utils/geo_utils.py b/felicette/utils/geo_utils.py index 55c05fa..a6fe9b3 100644 --- a/felicette/utils/geo_utils.py +++ b/felicette/utils/geo_utils.py @@ -1,6 +1,7 @@ import requests from felicette.utils.sys_utils import exit_cli + def find_first_landsat(items): for index, item in enumerate(items): if "LC" in item._data["id"]: @@ -16,7 +17,10 @@ def geocoder_util(location_name): ) r_json = r.json() if len(r_json) == 0: - exit_cli(print, "Oops, couldn't geocode this location's name. Could you please try with coordinates(-c) option?") + exit_cli( + print, + "Oops, couldn't geocode this location's name. Could you please try with coordinates(-c) option?", + ) # return lat, lon return (float(r_json[0]["lon"]), float(r_json[0]["lat"])) diff --git a/felicette/utils/sys_utils.py b/felicette/utils/sys_utils.py index f3ddeed..f7731f3 100644 --- a/felicette/utils/sys_utils.py +++ b/felicette/utils/sys_utils.py @@ -18,6 +18,7 @@ def display_file(file_name): elif sys.platform.startswith("darwin"): os.system("open %s" % file_name) + def remove_dir(directory): for filename in os.listdir(directory): file_path = os.path.join(directory, filename) @@ -27,5 +28,5 @@ def remove_dir(directory): elif os.path.isdir(file_path): shutil.rmtree(file_path) except Exception as e: - print('Failed to delete %s. Reason: %s' % (file_path, e)) + print("Failed to delete %s. Reason: %s" % (file_path, e)) exit_cli(print, "")