Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest earthaccess.download returns the full local path(s) instead of filename #284

Closed
andypbarrett opened this issue Aug 22, 2023 · 2 comments

Comments

@andypbarrett
Copy link
Collaborator

Currently, earthaccess.download(results, access='external') returns the local_filename. For workflows in which files are downloaded to a local machine and then some analysis performed on them, it would be useful if the full path to those files were returned. This would allow the files to be processed directly using the returned paths without having to glob the download path. For example:

DOWNLOAD_PATH = Path.cwd() / "smap_data"
DOWNLOAD_PATH.mkdir(parents=True, exist_ok=True)  # creates parents if they don't exist and fails silently if path exists

smap_files = earthaccess.download(results, DOWNLOAD_PATH)

Then...

for f in smap_files:
    do_something_with(f)

I'm also wondering if it makes sense to return a list of pathlib.Path objects rather than a string.

@MattF-NSIDC
Copy link

I'm also wondering if it makes sense to return a list of pathlib.Path objects rather than a string.

💯 yes!

@jrbourbeau
Copy link
Collaborator

Thanks @andypbarrett. I'm closing this issue as #317 updated earthaccess.download(...) to return the full local path (I ran into the same issue as you and thought the full path would be nicer) and #319 should cover the remaining pathlib.Path portion of this issue. Though let me know if I'm missing something and we can always re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants