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

Handle opening multi-file granules #394

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

jrbourbeau
Copy link
Collaborator

Marking as WIP as this doesn't handle all the open + download code paths yet and I think mypy isn't happy right now either. Just wanted to get a quick +1 for this general direction before finishing up.

Closes #393

Copy link

github-actions bot commented Dec 4, 2023

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

I will automatically update this comment whenever this PR is modified

Binder 👈 Launch a binder notebook on this branch for commit 4de8af6

Binder 👈 Launch a binder notebook on this branch for commit 11bb43b

)
)

url_mapping = _get_url_granule_mapping(granules, access)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The basic idea here is we now construct this mapping from filename to granule that contains the file. Currently we just have a list of files and list of granules, which isn't quite what we need

@jrbourbeau jrbourbeau changed the title [WIP] Handle multi-file granules Handle multi-file granules Dec 4, 2023
@jrbourbeau jrbourbeau changed the title Handle multi-file granules Handle opening multi-file granules Dec 4, 2023
@betolink betolink self-requested a review December 4, 2023 19:59
Copy link
Member

@betolink betolink left a comment

Choose a reason for hiding this comment

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

I just tested #394 and worked as expected, thanks @jrbourbeau !!

return EarthAccessFile(fs.open(urls), granule)

fileset = pqdm(zip(data_links, granules), multi_thread_open, n_jobs=threads)
fileset = pqdm(url_mapping.items(), multi_thread_open, n_jobs=threads)
Copy link
Member

Choose a reason for hiding this comment

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

awesome, this is it!

@jrbourbeau jrbourbeau merged commit 68bea76 into nsidc:main Dec 4, 2023
7 checks passed
@jrbourbeau jrbourbeau deleted the multi-file-granule branch December 4, 2023 20:21
@betolink betolink mentioned this pull request Dec 5, 2023
3 tasks
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.

open() is not handling multi-file granules properly
2 participants