-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from LCOGT/feature/tif-downloads
get_tif analysis action
- Loading branch information
Showing
4 changed files
with
516 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from datalab.datalab_session.util import create_tif, get_fits, add_file_to_bucket, key_exists, get_s3_url | ||
|
||
def get_tif(input: dict): | ||
""" | ||
Checks bucket for tif file and returns the url | ||
if the file doesn't exist, generates a new tif file | ||
input: dict | ||
basename: str | ||
source: str | ||
""" | ||
|
||
basename = input["basename"] | ||
file_key = f'{basename}/{basename}.tif' | ||
|
||
# Check in bucket for tif file | ||
if(key_exists(file_key)): | ||
tif_url = get_s3_url(file_key) | ||
else: | ||
# If tif file doesn't exist, generate a new tif file | ||
fits_path = get_fits(basename) | ||
tif_path = create_tif(basename, fits_path) | ||
tif_url = add_file_to_bucket(file_key, tif_path) | ||
|
||
return {"tif_url": tif_url} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.