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

Minor earthaccess.download updates #317

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Conversation

jrbourbeau
Copy link
Collaborator

This PR contains a few ergonomic updates to earthaccess.download. Specifically:

  1. earthaccess.download now accepts a single granule as input in addition to a list of granules
  2. The files returned by earthaccess.download are now the fully qualified local paths. This makes it easier to do things with the paths that are returned (currently there is some extra os.path.join that needs to happen)
files = earthaccess.download(...)
for file in files:
    with open(file) as f:
        ...
  1. Technically local_path can be None when using earthaccess.download. We weren't accounting for that possibility in all the possible download cases (e.g. downloading from S3). This PR moves the local_path=None logic higher up in the call stack to account for these cases.

@github-actions
Copy link

Binder 👈 Launch a binder notebook on this branch for commit bbe0aff

I will automatically update this comment whenever this PR is modified

@betolink
Copy link
Member

This is great! one of the things that confuses new users is that we only worked with list of results, thanks @jrbourbeau !!

@jrbourbeau
Copy link
Collaborator Author

one of the things that confuses new users is that we only worked with list of results

Me too : )

@betolink betolink merged commit 250848d into nsidc:main Oct 13, 2023
7 checks passed
@jrbourbeau jrbourbeau deleted the download-minor branch October 13, 2023 19:36
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

Successfully merging this pull request may close these issues.

2 participants