earth2studio icon indicating copy to clipboard operation
earth2studio copied to clipboard

🚀[FEA]: Package system doesn't natively work with Zarr Stores

Open dallasfoster opened this issue 1 year ago • 1 comments

Version

main

On which installation method(s) does this occur?

Pip, Source

Describe the issue

The package .resolve method uses fsspec._open under the hood, which fails if the file in question is interpreted as a directory, as is the case with Zarr stores.

store = package.resolve('metadata.zarr')
package.resolve("metadata.zarr")
  File "/usr/local/lib/python3.10/dist-packages/earth2studio/models/auto.py", line 319, in resolve
    with self.open(file_path) as file:
  File "/usr/local/lib/python3.10/dist-packages/earth2studio/models/auto.py", line 301, in open
    return self.fs.open(full_path, callback=callback)
  File "/usr/local/lib/python3.10/dist-packages/fsspec/spec.py", line 1293, in open
    f = self._open(
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 197, in _open
    return LocalFileOpener(path, mode, fs=self, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 322, in __init__
    self._open()
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 327, in _open
    self.f = open(self.path, mode=self.mode)
IsADirectoryError: [Errno 21] Is a directory: '/path/to/file/metadata.zarr'

dallasfoster avatar Aug 16 '24 20:08 dallasfoster

Updating to feature request, doing this on NGC will potentially be quite challenging due to how file access works... specifically for authenticated users.

NickGeneva avatar Sep 24 '24 17:09 NickGeneva

For anyone looking through this issue, the method currently used to resolve this is to save the zarr store as a DirectoryStore and zipping it so that the Package sees the store as a single file.

dallasfoster avatar Feb 21 '25 20:02 dallasfoster