Skip to content

Commit

Permalink
Replace custom code to exit cli with, 'exit_cli' function
Browse files Browse the repository at this point in the history
  • Loading branch information
plant99 committed Jul 24, 2020
1 parent 6026cea commit 9c81d40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions felicette/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
search_landsat_data,
preview_landsat_image,
)
from felicette.utils.sys_utils import exit_cli
from felicette.sat_processor import process_landsat_data


Expand Down Expand Up @@ -44,8 +45,7 @@
def main(coordinates, location_name, pan_enhancement, preview_image, vegetation):
"""Satellite imagery for dummies."""
if not coordinates and not location_name:
click.echo("Please specify either --coordinates or --location-name")
sys.exit(1)
exit_cli("Please specify either --coordinates or --location-name")
if location_name:
coordinates = geocoder_util(location_name)

Expand All @@ -67,6 +67,8 @@ def main(coordinates, location_name, pan_enhancement, preview_image, vegetation)
if vegetation:
bands = [3, 4, 5]

# NB: can't enable pan-enhancement with vegetation

# download data
data_id = download_landsat_data(landsat_item, bands)
# process data
Expand Down
3 changes: 1 addition & 2 deletions felicette/sat_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def search_landsat_data(coordinates, cloud_cover_lt):

search_items = search.items()
if not len(search_items):
print("No data matched your search, please try different parameters.")
sys.exit(0)
exit_cli("No data matched your search, please try different parameters.")
landsat_item = search_items[0]
return landsat_item

Expand Down

0 comments on commit 9c81d40

Please sign in to comment.