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

earthaccess.open() usage unintuitive for single item #574

Open
danielfromearth opened this issue May 14, 2024 · 2 comments
Open

earthaccess.open() usage unintuitive for single item #574

danielfromearth opened this issue May 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@danielfromearth
Copy link
Collaborator

danielfromearth commented May 14, 2024

mimic xarray, with something like open and open_many, to avoid being forced to use lists

earthaccess.open only takes a list of results, so to open one granule, one must use results[0:1]; in addition, earthaccess.open returns a list, so one ends up with:
temp

@mfisher87
Copy link
Collaborator

Other ideas:

What about having earthaccess.open() accept Granule | list[Granule]? Doesn't address the problem of the output being a list.

Or having earthaccess.open() only operate on a single thing, so if you want to open many you can use Python facilities to do so, e.g. [earthaccess.open(g) for g in results] . I personally really like this option.

@chuckwondo
Copy link
Collaborator

I prefer open to open 1 thing, since that's how all other "open"s I'm familiar with work, but this would be a breaking change, so we need to take that into consideration. We should also make it a context manager.

@mfisher87 mfisher87 changed the title mimic xarray, with something like open and open_many, to avoid being forced to use lists earthaccess.open() usage unintuitive for single item May 15, 2024
@mfisher87 mfisher87 added the enhancement New feature or request label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants