-
Notifications
You must be signed in to change notification settings - Fork 80
Feature/added feature image opening #27
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| *.pyc | ||
|
|
||
| **/.vscode/ | ||
| dist/ | ||
| build/ | ||
| *.egg-info/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| from felicette.utils.sys_utils import exit_cli, remove_dir | ||
| from felicette.sat_processor import process_landsat_data | ||
|
|
||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all formatting errors, like 'newline', 'deleted lines', is black used?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I have not used black but certainly will use it improve the code formatting. Thank for feedback. |
||
| def trigger_download_and_processing(landsat_item, bands): | ||
| # download data | ||
| data_id = download_landsat_data(landsat_item, bands) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||
| from satsearch import Search | ||||
| import sys | ||||
| from rich import print as rprint | ||||
|
|
||||
| import logging | ||||
| from felicette.utils.geo_utils import get_tiny_bbox | ||||
| from felicette.utils.sys_utils import exit_cli | ||||
| from felicette.constants import band_tag_map | ||||
|
|
@@ -10,7 +10,7 @@ | |||
| data_file_exists, | ||||
| file_paths_wrt_id, | ||||
| ) | ||||
|
|
||||
| from felicette.utils.sys_utils import display_file | ||||
|
|
||||
| def handle_prompt_response(response): | ||||
| if response in ["n", "N"]: | ||||
|
|
@@ -24,6 +24,21 @@ def handle_prompt_response(response): | |||
| exit_cli(rprint, "[red]Sorry, invalid response. Exiting :([/red]") | ||||
|
|
||||
|
|
||||
| def handle_img_prompt_response(response_show_image,paths,key,message): | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function is redundant, because then we are asking twice if the user wants to go ahead with the download. felicette/felicette/sat_downloader.py Line 63 in df507be
|
||||
|
|
||||
| if response_show_image in ["n", "N"]: | ||||
| return None | ||||
| elif response_show_image in ["y", "Y", ""]: | ||||
| display_file(paths[str(key)]) | ||||
| return | ||||
| else: | ||||
| rprint("[red]Sorry, invalid response.([/red]") | ||||
|
|
||||
| response_show_image = input(message) | ||||
| handle_img_prompt_response(response_show_image,paths,key,message) | ||||
|
|
||||
| return | ||||
|
|
||||
| def search_landsat_data(coordinates, cloud_cover_lt): | ||||
| search = Search( | ||||
| bbox=get_tiny_bbox(coordinates), | ||||
|
|
@@ -37,6 +52,7 @@ def search_landsat_data(coordinates, cloud_cover_lt): | |||
| # improvement: filter by date, cloud cover here | ||||
|
|
||||
| search_items = search.items() | ||||
| print("Date at which picture was taken : " + str(search_items[0].date)) | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we save this to a felicette/felicette/sat_downloader.py Line 43 in df507be
you'll see cloud cover, radiance and other factors. Please explore and suggest how the '.metadata' file will be for an image?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will do that. |
||||
| if not len(search_items): | ||||
| exit_cli(print, "No data matched your search, please try different parameters.") | ||||
| landsat_item = search_items[0] | ||||
|
|
@@ -58,6 +74,12 @@ def preview_landsat_image(landsat_item): | |||
| # print success info | ||||
| rprint("[blue]Preview image saved at:[/blue]") | ||||
| print(paths["preview"]) | ||||
| logging.info("preview imagery !!!") | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refer to comment on |
||||
|
|
||||
| message="Do you want to have a look at the downloaded preview image ? [Y/n]" | ||||
| response_show_image = input(message) | ||||
| handle_img_prompt_response(response_show_image,paths,"preview",message) | ||||
|
|
||||
| # prompt a confirm option | ||||
| response = input( | ||||
| "Are you sure you want to see an enhanced version of the image at the path shown above? [Y/n]" | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't a single
*suffice?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will change this .