Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.pyc

**/.vscode/
Copy link
Copy Markdown
Owner

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change this .

dist/
build/
*.egg-info/
Expand Down
1 change: 1 addition & 0 deletions felicette/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from felicette.utils.sys_utils import exit_cli, remove_dir
from felicette.sat_processor import process_landsat_data


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all formatting errors, like 'newline', 'deleted lines', is black used?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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)
Expand Down
26 changes: 24 additions & 2 deletions felicette/sat_downloader.py
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
Expand All @@ -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"]:
Expand All @@ -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):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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.

"Are you sure you want to see an enhanced version of the image at the path shown above? [Y/n]"


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),
Expand All @@ -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))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we save this to a .metadata file? Not just the date but if you try and print

return landsat_item

you'll see cloud cover, radiance and other factors. Please explore and suggest how the '.metadata' file will be for an image?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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]
Expand All @@ -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 !!!")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to comment on handle_img_prompt_response.


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]"
Expand Down
15 changes: 12 additions & 3 deletions felicette/sat_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from felicette.utils.file_manager import file_paths_wrt_id
from felicette.utils.image_processing_utils import process_sat_image
from felicette.utils.sys_utils import display_file

from felicette.sat_downloader import handle_img_prompt_response
# increase PIL image processing pixels count limit
PIL.Image.MAX_IMAGE_PIXELS = 933120000

Expand Down Expand Up @@ -74,7 +74,11 @@ def process_landsat_vegetation(id, bands):
rprint("[blue]JPEG image saved at:[/blue]")
print(paths["vegetation_path_jpeg"])
# display generated image
display_file(paths["vegetation_path_jpeg"])
# display_file(paths["vegetation_path_jpeg"]
message="Do you want to have a look at the downloaded enhanced image with vegetation ? [Y/n]"
response_show_image = input(message)
handle_img_prompt_response(response_show_image,paths,"vegetation_path_jpeg",message)



def process_landsat_rgb(id, bands):
Expand Down Expand Up @@ -145,7 +149,12 @@ def process_landsat_rgb(id, bands):
rprint("[blue]JPEG image saved at:[/blue]")
print(paths["output_path_jpeg"])
# display generated image
display_file(paths["output_path_jpeg"])
# display_file(paths["output_path_jpeg"])
message="Do you want to have a look at the downloaded pan enhanced image? [Y/n]"
response_show_image = input(message)
handle_img_prompt_response(response_show_image,paths,"output_path_jpeg",message)




def process_landsat_data(id, bands):
Expand Down