pydata / pydata/xarray

mfdataset using glob syntax from S3 not working since zarr v3

Open
#10,108 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-zarr usage question
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What happened?

Hello,
Since the package update to implement the new zarr specification, the glob syntax for loading S3 files is not working anymore.

For example, the following code:

import xarray as xr

xr.open_mfdataset("s3://mybucket/myzarr/*.zarr", engine="zarr")

no longer works. The error is the following:

TypeError: Unsupported type for store_like: 'FSMap'

Reading the latest documentation, I see that you now suggest the explicit utilization of a mutablemapping instance. In my case, I would have to do something like this:

from s3fs import S3FileSystem
import xarray as xr

s3 = S3FileSystem()
xr.open_mfdataset(["s3://" + file for file in s3.glob("s3://mybucket/myzarr/*.zarr")], engine="zarr")

All of a sudden the code becomes twice as long, I have to import s3fs explicitly and use a list-comprehension to append the "s3://" prefix to the file names.

Are you planning to re-implement the old behavior? There is something that I'm missing here?

What did you expect to happen?

I would expect the previous syntax to remain working.

Minimal Complete Verifiable Example

MVCE confirmation
  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
  • Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output

Anything else we need to know?

No response

Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.11.11 | packaged by conda-forge | (main, Mar 3 2025, 20:43:55) [GCC 13.3.0] python-bits: 64 OS: Linux OS-release: 6.8.0-1021-aws machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.14.4 libnetcdf: 4.9.2

xarray: 2025.1.2
pandas: 2.2.3
numpy: 2.2.3
scipy: 1.15.2
netCDF4: 1.7.2
pydap: 3.5.3
h5netcdf: None
h5py: 3.12.1
zarr: 3.0.4
cftime: 1.6.4
nc_time_axis: None
iris: None
bottleneck: None
dask: 2025.2.0
distributed: 2025.2.0
matplotlib: 3.10.1
cartopy: None
seaborn: None
numbagg: None
fsspec: 2025.2.0
cupy: None
pint: None
sparse: None
flox: 0.10.0
numpy_groupies: 0.11.2
setuptools: 75.8.2
pip: 25.0.1
conda: None
pytest: None
mypy: None
IPython: 9.0.1
sphinx: None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported call to xr.open_mfdataset with engine="zarr" and the S3 glob pattern from the issue, using the stated xarray, zarr, fsspec, and dask versions. Trace how the glob path is handled before the zarr store is opened. Done means the previous S3 glob syntax works again without requiring the explicit s3fs glob-and-list workaround, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.