earthaccess icon indicating copy to clipboard operation
earthaccess copied to clipboard

`earthaccess.open()` usage unintuitive for single item

Open danielfromearth opened this issue 1 year ago • 2 comments

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

danielfromearth avatar May 14 '24 21:05 danielfromearth

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.

mfisher87 avatar May 14 '24 22:05 mfisher87

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.

chuckwondo avatar May 14 '24 22:05 chuckwondo