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

ValueError when decoding virtual reference: Filenames containing trailing '/#\d+/' are not supported #402

Closed
TomNicholas opened this issue Nov 21, 2024 · 6 comments

Comments

@TomNicholas
Copy link
Contributor

Not sure if this is virtualizarr or icechunk's fault but the error was raised inside icechunk so I'm raising it here.

MCVE

import xarray as xr

ds_original = xr.tutorial.open_dataset('air_temperature')


from virtualizarr import open_virtual_dataset

vds = open_virtual_dataset('air_temps.nc', indexes={})


import icechunk

storage_config = icechunk.StorageConfig.filesystem(
    "/Users/tom/Documents/Work/Code/experimentation/icechunk/MET_office_demo",
)
store = icechunk.IcechunkStore.create(
    storage=storage_config,
    read_only=False,
)

vds.virtualize.to_icechunk(store)
store.commit("wrote virtual references")

ds = xr.open_zarr(
    store, 
    zarr_format=3,
    consolidated=False,
    chunks={},
)

Error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:451](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=450), in decode_cf_variables(variables, attributes, concat_characters, mask_and_scale, decode_times, decode_coords, drop_variables, use_cftime, decode_timedelta)
    450 try:
--> 451     new_vars[k] = decode_cf_variable(
    452         k,
    453         v,
    454         concat_characters=_item_or_default(concat_characters, k, True),
    455         mask_and_scale=_item_or_default(mask_and_scale, k, True),
    456         decode_times=_item_or_default(decode_times, k, True),
    457         stack_char_dim=stack_char_dim,
    458         use_cftime=_item_or_default(use_cftime, k, None),
    459         decode_timedelta=_item_or_default(decode_timedelta, k, None),
    460     )
    461 except Exception as e:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:292](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=291), in decode_cf_variable(name, var, concat_characters, mask_and_scale, decode_times, decode_endianness, stack_char_dim, use_cftime, decode_timedelta)
    291 if decode_times:
--> 292     var = times.CFDatetimeCoder(use_cftime=use_cftime).decode(var, name=name)
    294 if decode_endianness and not var.dtype.isnative:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py:1001](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py#line=1000), in CFDatetimeCoder.decode(self, variable, name)
   1000 calendar = pop_to(attrs, encoding, "calendar")
-> 1001 dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
   1002 transform = partial(
   1003     decode_cf_datetime,
   1004     units=units,
   1005     calendar=calendar,
   1006     use_cftime=self.use_cftime,
   1007 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py:214](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py#line=213), in _decode_cf_datetime_dtype(data, units, calendar, use_cftime)
    212 values = indexing.ImplicitToExplicitIndexingAdapter(indexing.as_indexable(data))
    213 example_value = np.concatenate(
--> 214     [first_n_items(values, 1) or [0], last_item(values) or [0]]
    215 )
    217 try:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/formatting.py:97](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/formatting.py#line=96), in first_n_items(array, n_desired)
     96     array = array._data
---> 97 return np.ravel(to_duck_array(array))[:n_desired]

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/namedarray/pycompat.py:138](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/namedarray/pycompat.py#line=137), in to_duck_array(data, **kwargs)
    137 else:
--> 138     return np.asarray(data)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:578](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=577), in ImplicitToExplicitIndexingAdapter.__array__(self, dtype, copy)
    577 if Version(np.__version__) >= Version("2.0.0"):
--> 578     return np.asarray(self.get_duck_array(), dtype=dtype, copy=copy)
    579 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:583](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=582), in ImplicitToExplicitIndexingAdapter.get_duck_array(self)
    582 def get_duck_array(self):
--> 583     return self.array.get_duck_array()

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:657](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=656), in LazilyIndexedArray.get_duck_array(self)
    654 else:
    655     # If the array is not an ExplicitlyIndexedNDArrayMixin,
    656     # it may wrap a BackendArray so use its __getitem__
--> 657     array = self.array[self.key]
    659 # self.array[self.key] is now a numpy array when
    660 # self.array is a BackendArray subclass
    661 # and self.key is BasicIndexer((slice(None, None, None),))
    662 # so we need the explicit check for ExplicitlyIndexed

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:166](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=165), in ZarrArrayWrapper.__getitem__(self, key)
    165     method = self._oindex
--> 166 return indexing.explicit_indexing_adapter(
    167     key, array.shape, indexing.IndexingSupport.VECTORIZED, method
    168 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:1018](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=1017), in explicit_indexing_adapter(key, shape, indexing_support, raw_indexing_method)
   1017 raw_key, numpy_indices = decompose_indexer(key, shape, indexing_support)
-> 1018 result = raw_indexing_method(raw_key.tuple)
   1019 if numpy_indices.tuple:
   1020     # index the loaded np.ndarray

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:156](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=155), in ZarrArrayWrapper._getitem(self, key)
    155 def _getitem(self, key):
--> 156     return self._array[key]

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:1660](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=1659), in Array.__getitem__(self, selection)
   1659 elif is_pure_orthogonal_indexing(pure_selection, self.ndim):
-> 1660     return self.get_orthogonal_selection(pure_selection, fields=fields)
   1661 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/_compat.py:43](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/_compat.py#line=42), in _deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
     42 if extra_args <= 0:
---> 43     return f(*args, **kwargs)
     45 # extra_args > 0

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:2102](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=2101), in Array.get_orthogonal_selection(self, selection, out, fields, prototype)
   2101 indexer = OrthogonalIndexer(selection, self.shape, self.metadata.chunk_grid)
-> 2102 return sync(
   2103     self._async_array._get_selection(
   2104         indexer=indexer, out=out, fields=fields, prototype=prototype
   2105     )
   2106 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py:141](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py#line=140), in sync(coro, loop, timeout)
    140 if isinstance(return_result, BaseException):
--> 141     raise return_result
    142 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py:100](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py#line=99), in _runner(coro)
     99 try:
--> 100     return await coro
    101 except Exception as ex:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:961](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=960), in AsyncArray._get_selection(self, indexer, prototype, out, fields)
    959 if product(indexer.shape) > 0:
    960     # reading chunks and decoding them
--> 961     await self.codec_pipeline.read(
    962         [
    963             (
    964                 self.store_path [/](http://localhost:8888/) self.metadata.encode_chunk_key(chunk_coords),
    965                 self.metadata.get_chunk_spec(chunk_coords, self.order, prototype=prototype),
    966                 chunk_selection,
    967                 out_selection,
    968             )
    969             for chunk_coords, chunk_selection, out_selection in indexer
    970         ],
    971         out_buffer,
    972         drop_axes=indexer.drop_axes,
    973     )
    974 return out_buffer.as_ndarray_like()

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py:440](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py#line=439), in BatchedCodecPipeline.read(self, batch_info, out, drop_axes)
    434 async def read(
    435     self,
    436     batch_info: Iterable[tuple[ByteGetter, ArraySpec, SelectorTuple, SelectorTuple]],
    437     out: NDBuffer,
    438     drop_axes: tuple[int, ...] = (),
    439 ) -> None:
--> 440     await concurrent_map(
    441         [
    442             (single_batch_info, out, drop_axes)
    443             for single_batch_info in batched(batch_info, self.batch_size)
    444         ],
    445         self.read_batch,
    446         config.get("async.concurrency"),
    447     )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:64](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=63), in concurrent_map(items, func, limit)
     62         return await func(*item)
---> 64 return await asyncio.gather(*[asyncio.ensure_future(run(item)) for item in items])

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:62](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=61), in concurrent_map.<locals>.run(item)
     61 async with sem:
---> 62     return await func(*item)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py:262](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py#line=261), in BatchedCodecPipeline.read_batch(self, batch_info, out, drop_axes)
    261 else:
--> 262     chunk_bytes_batch = await concurrent_map(
    263         [
    264             (byte_getter, array_spec.prototype)
    265             for byte_getter, array_spec, _, _ in batch_info
    266         ],
    267         lambda byte_getter, prototype: byte_getter.get(prototype),
    268         config.get("async.concurrency"),
    269     )
    270     chunk_array_batch = await self.decode_batch(
    271         [
    272             (chunk_bytes, chunk_spec)
   (...)
    276         ],
    277     )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:64](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=63), in concurrent_map(items, func, limit)
     62         return await func(*item)
---> 64 return await asyncio.gather(*[asyncio.ensure_future(run(item)) for item in items])

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:62](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=61), in concurrent_map.<locals>.run(item)
     61 async with sem:
---> 62     return await func(*item)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/storage/common.py:71](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/storage/common.py#line=70), in StorePath.get(self, prototype, byte_range)
     70     prototype = default_buffer_prototype()
---> 71 return await self.store.get(self.path, prototype=prototype, byte_range=byte_range)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/icechunk/__init__.py:469](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/icechunk/__init__.py#line=468), in IcechunkStore.get(self, key, prototype, byte_range)
    468 try:
--> 469     result = await self._store.get(key, byte_range)
    470 except KeyNotFound as _e:
    471     # Zarr python expects None to be returned if the key does not exist
    472     # but an IcechunkStore returns an error if the key does not exist

ValueError: store error: unsuccessful repository operation: `error when handling virtual reference error fetching virtual reference Generic LocalFileSystem error: Filenames containing trailing '[/](http://localhost:8888/)#\d+[/](http://localhost:8888/)' are not supported: `

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
Cell In[11], line 1
----> 1 ds = xr.open_zarr(
      2     store, 
      3     zarr_format=3,
      4     consolidated=False,
      5     chunks={},
      6 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:1337](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=1336), in open_zarr(store, group, synchronizer, chunks, decode_cf, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, consolidated, overwrite_encoded_chunks, chunk_store, storage_options, decode_timedelta, use_cftime, zarr_version, zarr_format, use_zarr_fill_value_as_mask, chunked_array_type, from_array_kwargs, **kwargs)
   1322     raise TypeError(
   1323         "open_zarr() got unexpected keyword arguments " + ",".join(kwargs.keys())
   1324     )
   1326 backend_kwargs = {
   1327     "synchronizer": synchronizer,
   1328     "consolidated": consolidated,
   (...)
   1334     "zarr_format": zarr_format,
   1335 }
-> 1337 ds = open_dataset(
   1338     filename_or_obj=store,
   1339     group=group,
   1340     decode_cf=decode_cf,
   1341     mask_and_scale=mask_and_scale,
   1342     decode_times=decode_times,
   1343     concat_characters=concat_characters,
   1344     decode_coords=decode_coords,
   1345     engine="zarr",
   1346     chunks=chunks,
   1347     drop_variables=drop_variables,
   1348     chunked_array_type=chunked_array_type,
   1349     from_array_kwargs=from_array_kwargs,
   1350     backend_kwargs=backend_kwargs,
   1351     decode_timedelta=decode_timedelta,
   1352     use_cftime=use_cftime,
   1353     zarr_version=zarr_version,
   1354     use_zarr_fill_value_as_mask=use_zarr_fill_value_as_mask,
   1355 )
   1356 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/api.py:671](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/api.py#line=670), in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs)
    659 decoders = _resolve_decoders_kwargs(
    660     decode_cf,
    661     open_backend_dataset_parameters=backend.open_dataset_parameters,
   (...)
    667     decode_coords=decode_coords,
    668 )
    670 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None)
--> 671 backend_ds = backend.open_dataset(
    672     filename_or_obj,
    673     drop_variables=drop_variables,
    674     **decoders,
    675     **kwargs,
    676 )
    677 ds = _dataset_from_backend_dataset(
    678     backend_ds,
    679     filename_or_obj,
   (...)
    689     **kwargs,
    690 )
    691 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:1427](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=1426), in ZarrBackendEntrypoint.open_dataset(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta, group, mode, synchronizer, consolidated, chunk_store, storage_options, stacklevel, zarr_version, zarr_format, store, engine, use_zarr_fill_value_as_mask)
   1425 store_entrypoint = StoreBackendEntrypoint()
   1426 with close_on_error(store):
-> 1427     ds = store_entrypoint.open_dataset(
   1428         store,
   1429         mask_and_scale=mask_and_scale,
   1430         decode_times=decode_times,
   1431         concat_characters=concat_characters,
   1432         decode_coords=decode_coords,
   1433         drop_variables=drop_variables,
   1434         use_cftime=use_cftime,
   1435         decode_timedelta=decode_timedelta,
   1436     )
   1437 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/store.py:46](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/store.py#line=45), in StoreBackendEntrypoint.open_dataset(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta)
     43 vars, attrs = filename_or_obj.load()
     44 encoding = filename_or_obj.get_encoding()
---> 46 vars, attrs, coord_names = conventions.decode_cf_variables(
     47     vars,
     48     attrs,
     49     mask_and_scale=mask_and_scale,
     50     decode_times=decode_times,
     51     concat_characters=concat_characters,
     52     decode_coords=decode_coords,
     53     drop_variables=drop_variables,
     54     use_cftime=use_cftime,
     55     decode_timedelta=decode_timedelta,
     56 )
     58 ds = Dataset(vars, attrs=attrs)
     59 ds = ds.set_coords(coord_names.intersection(vars))

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:462](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=461), in decode_cf_variables(variables, attributes, concat_characters, mask_and_scale, decode_times, decode_coords, drop_variables, use_cftime, decode_timedelta)
    451     new_vars[k] = decode_cf_variable(
    452         k,
    453         v,
   (...)
    459         decode_timedelta=_item_or_default(decode_timedelta, k, None),
    460     )
    461 except Exception as e:
--> 462     raise type(e)(f"Failed to decode variable {k!r}: {e}") from e
    463 if decode_coords in [True, "coordinates", "all"]:
    464     var_attrs = new_vars[k].attrs

ValueError: Failed to decode variable 'time': store error: unsuccessful repository operation: `error when handling virtual reference error fetching virtual reference Generic LocalFileSystem error: Filenames containing trailing '[/](http://localhost:8888/)#\d+[/](http://localhost:8888/)' are not supported: `

Environment

# packages in environment at /Users/tom/miniconda3/envs/coiled:
#
# Name                    Version                   Build  Channel
aiobotocore               2.15.1             pyhd8ed1ab_0    conda-forge
aiohappyeyeballs          2.4.3              pyhd8ed1ab_0    conda-forge
aiohttp                   3.10.10         py312h906988d_0    conda-forge
aioitertools              0.12.0             pyhd8ed1ab_0    conda-forge
aiosignal                 1.3.1              pyhd8ed1ab_0    conda-forge
anyio                     4.6.2.post1        pyhd8ed1ab_0    conda-forge
aom                       3.9.1                h7bae524_0    conda-forge
appnope                   0.1.4              pyhd8ed1ab_0    conda-forge
argon2-cffi               23.1.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py312h024a12e_5    conda-forge
arrow                     1.3.0              pyhd8ed1ab_0    conda-forge
asciitree                 0.3.3                      py_2    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
async-lru                 2.0.4              pyhd8ed1ab_0    conda-forge
attrs                     24.2.0             pyh71513ae_0    conda-forge
aws-c-auth                0.8.0                ha41d1bc_4    conda-forge
aws-c-cal                 0.8.0                hfd083d3_0    conda-forge
aws-c-common              0.9.31               h7ab814d_0    conda-forge
aws-c-compression         0.3.0                hfd083d3_0    conda-forge
aws-c-event-stream        0.5.0                h159f268_2    conda-forge
aws-c-http                0.9.0                h8d4912c_3    conda-forge
aws-c-io                  0.15.0               h1e7b4f6_2    conda-forge
aws-c-mqtt                0.11.0               h27f15a1_2    conda-forge
aws-c-s3                  0.7.0                hd60ad1a_5    conda-forge
aws-c-sdkutils            0.2.0                hfd083d3_0    conda-forge
aws-checksums             0.2.0                hfd083d3_0    conda-forge
aws-crt-cpp               0.29.1               h5fee195_0    conda-forge
aws-sdk-cpp               1.11.407             h8ede6c8_7    conda-forge
azure-core-cpp            1.14.0               hd50102c_0    conda-forge
azure-identity-cpp        1.10.0               hc602bab_0    conda-forge
azure-storage-blobs-cpp   12.13.0              h7585a09_1    conda-forge
azure-storage-common-cpp  12.8.0               h9ca1f76_1    conda-forge
azure-storage-files-datalake-cpp 12.12.0              hcdd55da_1    conda-forge
babel                     2.14.0             pyhd8ed1ab_0    conda-forge
backoff                   2.2.1              pyhd8ed1ab_0    conda-forge
bcrypt                    4.2.0           py312he431725_1    conda-forge
beautifulsoup4            4.12.3             pyha770c72_0    conda-forge
bleach                    6.2.0              pyhd8ed1ab_0    conda-forge
blosc                     1.21.6               h5499902_0    conda-forge
bokeh                     3.6.0              pyhd8ed1ab_0    conda-forge
boto3                     1.35.23            pyhd8ed1ab_0    conda-forge
botocore                  1.35.23         pyge310_1234567_0    conda-forge
brotli                    1.1.0                hd74edd7_2    conda-forge
brotli-bin                1.1.0                hd74edd7_2    conda-forge
brotli-python             1.1.0           py312hde4cb15_2    conda-forge
brunsli                   0.1                  h9f76cd9_0    conda-forge
bzip2                     1.0.8                h99b78c6_7    conda-forge
c-ares                    1.34.2               h7ab814d_0    conda-forge
c-blosc2                  2.15.1               h5063078_0    conda-forge
ca-certificates           2024.8.30            hf0a4a13_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2024.8.30          pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py312h0fad829_0    conda-forge
cftime                    1.6.4           py312h755e627_1    conda-forge
charls                    2.4.2                h13dd4ca_0    conda-forge
charset-normalizer        3.4.0              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
cloudpickle               3.1.0              pyhd8ed1ab_1    conda-forge
coiled                    1.59.0             pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.2.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.3.0           py312h4721b07_2    conda-forge
cramjam                   2.8.4rc3        py312h51b60f1_2    conda-forge
crc32c                    2.7.1                    pypi_0    pypi
cryptography              43.0.3          py312h5fad481_0    conda-forge
cytoolz                   1.0.0           py312h024a12e_1    conda-forge
dask                      2024.10.0          pyhd8ed1ab_0    conda-forge
dask-core                 2024.10.0          pyhd8ed1ab_0    conda-forge
dask-expr                 1.1.16             pyhd8ed1ab_0    conda-forge
dav1d                     1.2.1                hb547adb_0    conda-forge
debugpy                   1.8.7           py312hde4cb15_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
deprecated                1.2.14             pyh1a96a4e_0    conda-forge
distributed               2024.10.0          pyhd8ed1ab_0    conda-forge
donfig                    0.8.1.post1              pypi_0    pypi
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_0    conda-forge
executing                 2.1.0              pyhd8ed1ab_0    conda-forge
fabric                    3.2.2              pyhd8ed1ab_0    conda-forge
fasteners                 0.17.3             pyhd8ed1ab_0    conda-forge
fastparquet               2024.5.0        py312h147345f_2    conda-forge
filelock                  3.16.1             pyhd8ed1ab_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_0    conda-forge
freetype                  2.12.1               hadb7bae_2    conda-forge
frozenlist                1.5.0           py312h0bf5046_0    conda-forge
fsspec                    2024.10.0          pyhff2d567_0    conda-forge
gflags                    2.2.2             hf9b8971_1005    conda-forge
giflib                    5.2.2                h93a5062_0    conda-forge
gilknocker                0.4.1           py312he431725_4    conda-forge
glog                      0.7.1                heb240a5_0    conda-forge
h11                       0.14.0             pyhd8ed1ab_0    conda-forge
h2                        4.1.0              pyhd8ed1ab_0    conda-forge
h5netcdf                  1.4.0              pyhd8ed1ab_0    conda-forge
h5py                      3.12.1          nompi_py312h3cd0824_102    conda-forge
hdf4                      4.2.15               h2ee6834_7    conda-forge
hdf5                      1.14.3          nompi_hec07895_105    conda-forge
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
httpcore                  1.0.6              pyhd8ed1ab_0    conda-forge
httpx                     0.27.2             pyhd8ed1ab_0    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
icechunk                  0.1.0a4                  pypi_0    pypi
icu                       75.1                 hfee45f7_0    conda-forge
idna                      3.10               pyhd8ed1ab_0    conda-forge
imagecodecs               2024.9.22       py312h232c411_0    conda-forge
importlib-metadata        8.5.0              pyha770c72_0    conda-forge
importlib_metadata        8.5.0                hd8ed1ab_0    conda-forge
importlib_resources       6.4.5              pyhd8ed1ab_0    conda-forge
iniconfig                 2.0.0              pyhd8ed1ab_0    conda-forge
invoke                    2.2.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.29.5             pyh57ce528_0    conda-forge
ipython                   8.29.0             pyh707e725_0    conda-forge
ipywidgets                8.1.5              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.4              pyhd8ed1ab_0    conda-forge
jmespath                  1.0.1              pyhd8ed1ab_0    conda-forge
json5                     0.9.25             pyhd8ed1ab_0    conda-forge
jsondiff                  2.0.0              pyhd8ed1ab_0    conda-forge
jsonpointer               3.0.0           py312h81bd7bf_1    conda-forge
jsonschema                4.23.0             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2024.10.1          pyhd8ed1ab_0    conda-forge
jsonschema-with-format-nongpl 4.23.0               hd8ed1ab_0    conda-forge
jupyter-lsp               2.2.5              pyhd8ed1ab_0    conda-forge
jupyter-resource-usage    1.1.0              pyhd8ed1ab_0    conda-forge
jupyter_client            8.6.3              pyhd8ed1ab_0    conda-forge
jupyter_core              5.7.2              pyh31011fe_1    conda-forge
jupyter_events            0.10.0             pyhd8ed1ab_0    conda-forge
jupyter_server            2.14.2             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.3              pyhd8ed1ab_0    conda-forge
jupyterlab                4.3.0              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_1    conda-forge
jupyterlab_server         2.27.3             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.13             pyhd8ed1ab_0    conda-forge
jxrlib                    1.1                  h93a5062_3    conda-forge
kerchunk                  0.0.post999              pypi_0    pypi
krb5                      1.21.3               h237132a_0    conda-forge
lcms2                     2.16                 ha0e7c42_0    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libabseil                 20240722.0      cxx17_hf9b8971_1    conda-forge
libaec                    1.1.3                hebf3989_0    conda-forge
libarrow                  18.0.0           h8cfe2e2_2_cpu    conda-forge
libarrow-acero            18.0.0           h286801f_2_cpu    conda-forge
libarrow-dataset          18.0.0           h286801f_2_cpu    conda-forge
libarrow-substrait        18.0.0           h6a6e5c5_2_cpu    conda-forge
libavif16                 1.1.1                h45b7238_2    conda-forge
libblas                   3.9.0           25_osxarm64_openblas    conda-forge
libbrotlicommon           1.1.0                hd74edd7_2    conda-forge
libbrotlidec              1.1.0                hd74edd7_2    conda-forge
libbrotlienc              1.1.0                hd74edd7_2    conda-forge
libcblas                  3.9.0           25_osxarm64_openblas    conda-forge
libcrc32c                 1.1.2                hbdafb3b_0    conda-forge
libcurl                   8.10.1               h13a7ad3_0    conda-forge
libcxx                    19.1.3               ha82da77_0    conda-forge
libdeflate                1.22                 hd74edd7_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h93a5062_2    conda-forge
libevent                  2.1.12               h2757513_1    conda-forge
libexpat                  2.6.3                hf9b8971_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_3    conda-forge
libgfortran5              13.2.0               hf226fd6_3    conda-forge
libgoogle-cloud           2.30.0               h8d8be31_1    conda-forge
libgoogle-cloud-storage   2.30.0               h7081f7f_1    conda-forge
libgrpc                   1.67.1               hc70892a_0    conda-forge
libhwy                    1.1.0                h2ffa867_0    conda-forge
libiconv                  1.17                 h0d3ecfb_2    conda-forge
libjpeg-turbo             3.0.0                hb547adb_1    conda-forge
libjxl                    0.11.0               hbabf80f_2    conda-forge
liblapack                 3.9.0           25_osxarm64_openblas    conda-forge
libnetcdf                 4.9.2           nompi_he469be0_114    conda-forge
libnghttp2                1.64.0               h6d7220d_0    conda-forge
libopenblas               0.3.28          openmp_hf332438_1    conda-forge
libparquet                18.0.0           hda0ea68_2_cpu    conda-forge
libpng                    1.6.44               hc14010f_0    conda-forge
libprotobuf               5.28.2               h8f0b736_0    conda-forge
libre2-11                 2024.07.02           h2348fd5_1    conda-forge
libsodium                 1.0.20               h99b78c6_0    conda-forge
libsqlite                 3.47.0               hbaaea75_1    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libthrift                 0.21.0               h64651cc_0    conda-forge
libtiff                   4.7.0                hfce79cd_1    conda-forge
libutf8proc               2.8.0                h1a8c8d9_0    conda-forge
libwebp-base              1.4.0                h93a5062_0    conda-forge
libxcb                    1.17.0               hdb1d25a_0    conda-forge
libxml2                   2.13.4               h8424949_2    conda-forge
libzip                    1.11.2               h1336266_0    conda-forge
libzlib                   1.3.1                h8359307_2    conda-forge
libzopfli                 1.0.3                h9f76cd9_0    conda-forge
llvm-openmp               19.1.3               hb52a8e5_0    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
lz4                       4.3.3           py312h11d1bbd_1    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
markdown-it-py            3.0.0              pyhd8ed1ab_0    conda-forge
markupsafe                3.0.2           py312ha0ccf2a_0    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_0    conda-forge
mdurl                     0.1.2              pyhd8ed1ab_0    conda-forge
mistune                   3.0.2              pyhd8ed1ab_0    conda-forge
msgpack-python            1.1.0           py312h6142ec9_0    conda-forge
multidict                 6.1.0           py312hdb8e49c_1    conda-forge
nbclient                  0.10.0             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.16.4             pyhd8ed1ab_1    conda-forge
nbformat                  5.10.4             pyhd8ed1ab_0    conda-forge
ncurses                   6.5                  h7bae524_1    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_0    conda-forge
netcdf4                   1.7.1           nompi_py312hd88a8d4_102    conda-forge
notebook-shim             0.2.4              pyhd8ed1ab_0    conda-forge
numcodecs                 0.14.0                   pypi_0    pypi
numpy                     2.1.3           py312h94ee1e1_0    conda-forge
openjpeg                  2.5.2                h9f1df11_0    conda-forge
openssl                   3.4.0                h39f12f2_0    conda-forge
orc                       2.0.2                hcb3c8b3_2    conda-forge
overrides                 7.7.0              pyhd8ed1ab_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pandas                    2.2.3           py312hcd31e36_1    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
paramiko                  3.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.4              pyhd8ed1ab_0    conda-forge
partd                     1.4.2              pyhd8ed1ab_0    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    11.0.0          py312haf37ca6_0    conda-forge
pip                       24.3.1             pyh8b19718_0    conda-forge
pip-requirements-parser   32.0.1             pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
platformdirs              4.3.6              pyhd8ed1ab_0    conda-forge
pluggy                    1.5.0              pyhd8ed1ab_0    conda-forge
pooch                     1.8.2              pyhd8ed1ab_0    conda-forge
prometheus_client         0.21.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.48             pyha770c72_0    conda-forge
propcache                 0.2.0           py312h024a12e_2    conda-forge
psutil                    5.9.8           py312he37b823_0    conda-forge
pthread-stubs             0.4               hd74edd7_1002    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.3              pyhd8ed1ab_0    conda-forge
pyarrow                   18.0.0          py312ha814d7c_0    conda-forge
pyarrow-core              18.0.0          py312hc40f475_0_cpu    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pygments                  2.18.0             pyhd8ed1ab_0    conda-forge
pynacl                    1.5.0           py312h024a12e_4    conda-forge
pyobjc-core               10.3.1          py312hd24fc31_1    conda-forge
pyobjc-framework-cocoa    10.3.1          py312hd24fc31_1    conda-forge
pyparsing                 3.2.0              pyhd8ed1ab_1    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytest                    8.3.3              pyhd8ed1ab_0    conda-forge
python                    3.12.7          h739c21a_0_cpython    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.20.0             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python-tzdata             2024.2             pyhd8ed1ab_0    conda-forge
python_abi                3.12                    5_cp312    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.2           py312h024a12e_1    conda-forge
pyzmq                     26.2.0          py312hf8a1cbd_3    conda-forge
rav1e                     0.6.6                h69fbcac_2    conda-forge
re2                       2024.07.02           hcd0e937_1    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
referencing               0.35.1             pyhd8ed1ab_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rich                      13.9.4             pyhd8ed1ab_0    conda-forge
rpds-py                   0.20.1          py312hcd83bfe_0    conda-forge
s3fs                      2024.10.0          pyhd8ed1ab_0    conda-forge
s3transfer                0.10.3             pyhd8ed1ab_0    conda-forge
scipy                     1.14.1          py312h20deb59_1    conda-forge
send2trash                1.8.3              pyh31c8845_0    conda-forge
setuptools                75.3.0             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.2.1                hd02b534_0    conda-forge
sniffio                   1.3.1              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
svt-av1                   2.3.0                hf24288c_0    conda-forge
tblib                     3.0.0              pyhd8ed1ab_0    conda-forge
terminado                 0.18.1             pyh31c8845_0    conda-forge
tifffile                  2024.9.20          pyhd8ed1ab_0    conda-forge
tinycss2                  1.4.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.2              pyhd8ed1ab_0    conda-forge
toolz                     1.0.0              pyhd8ed1ab_0    conda-forge
tornado                   6.4.1           py312h024a12e_1    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.9.0.20241003     pyhff2d567_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
ujson                     5.10.0          py312hde4cb15_1    conda-forge
universal_pathlib         0.2.5              pyhd8ed1ab_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_0    conda-forge
urllib3                   2.2.3              pyhd8ed1ab_0    conda-forge
virtualizarr              1.1.0                    pypi_0    pypi
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
webcolors                 24.8.0             pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_2    conda-forge
websocket-client          1.8.0              pyhd8ed1ab_0    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.13             pyhd8ed1ab_0    conda-forge
wrapt                     1.16.0          py312h024a12e_1    conda-forge
xarray                    2024.10.0          pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               hd74edd7_1    conda-forge
xorg-libxdmcp             1.1.5                hd74edd7_0    conda-forge
xyzservices               2024.9.0           pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
yarl                      1.16.0          py312h0bf5046_0    conda-forge
zarr                      3.0.0b1                  pypi_0    pypi
zeromq                    4.3.5                h9f5b81c_6    conda-forge
zfp                       1.0.1                h1c5d8ea_2    conda-forge
zict                      3.0.0              pyhd8ed1ab_0    conda-forge
zipp                      3.20.2             pyhd8ed1ab_0    conda-forge
zlib                      1.3.1                h8359307_2    conda-forge
zlib-ng                   2.2.2                hf9b8971_0    conda-forge
zstandard                 0.23.0          py312h15fbf35_1    conda-forge
zstd                      1.5.6                hb46c0d2_0    conda-forge
@TomNicholas
Copy link
Contributor Author

TomNicholas commented Nov 21, 2024

Okay, as the error said something about filenames I tried to run the example in the icechunk docs instead (https://icechunk.io/icechunk-python/virtual/#creating-a-virtual-dataset-with-virtualizarr), which is different files with different names on S3 instead of local and got

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:451](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=450), in decode_cf_variables(variables, attributes, concat_characters, mask_and_scale, decode_times, decode_coords, drop_variables, use_cftime, decode_timedelta)
    450 try:
--> 451     new_vars[k] = decode_cf_variable(
    452         k,
    453         v,
    454         concat_characters=_item_or_default(concat_characters, k, True),
    455         mask_and_scale=_item_or_default(mask_and_scale, k, True),
    456         decode_times=_item_or_default(decode_times, k, True),
    457         stack_char_dim=stack_char_dim,
    458         use_cftime=_item_or_default(use_cftime, k, None),
    459         decode_timedelta=_item_or_default(decode_timedelta, k, None),
    460     )
    461 except Exception as e:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:292](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=291), in decode_cf_variable(name, var, concat_characters, mask_and_scale, decode_times, decode_endianness, stack_char_dim, use_cftime, decode_timedelta)
    291 if decode_times:
--> 292     var = times.CFDatetimeCoder(use_cftime=use_cftime).decode(var, name=name)
    294 if decode_endianness and not var.dtype.isnative:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py:1001](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py#line=1000), in CFDatetimeCoder.decode(self, variable, name)
   1000 calendar = pop_to(attrs, encoding, "calendar")
-> 1001 dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)
   1002 transform = partial(
   1003     decode_cf_datetime,
   1004     units=units,
   1005     calendar=calendar,
   1006     use_cftime=self.use_cftime,
   1007 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py:214](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/coding/times.py#line=213), in _decode_cf_datetime_dtype(data, units, calendar, use_cftime)
    212 values = indexing.ImplicitToExplicitIndexingAdapter(indexing.as_indexable(data))
    213 example_value = np.concatenate(
--> 214     [first_n_items(values, 1) or [0], last_item(values) or [0]]
    215 )
    217 try:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/formatting.py:97](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/formatting.py#line=96), in first_n_items(array, n_desired)
     96     array = array._data
---> 97 return np.ravel(to_duck_array(array))[:n_desired]

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/namedarray/pycompat.py:138](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/namedarray/pycompat.py#line=137), in to_duck_array(data, **kwargs)
    137 else:
--> 138     return np.asarray(data)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:578](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=577), in ImplicitToExplicitIndexingAdapter.__array__(self, dtype, copy)
    577 if Version(np.__version__) >= Version("2.0.0"):
--> 578     return np.asarray(self.get_duck_array(), dtype=dtype, copy=copy)
    579 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:583](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=582), in ImplicitToExplicitIndexingAdapter.get_duck_array(self)
    582 def get_duck_array(self):
--> 583     return self.array.get_duck_array()

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:657](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=656), in LazilyIndexedArray.get_duck_array(self)
    654 else:
    655     # If the array is not an ExplicitlyIndexedNDArrayMixin,
    656     # it may wrap a BackendArray so use its __getitem__
--> 657     array = self.array[self.key]
    659 # self.array[self.key] is now a numpy array when
    660 # self.array is a BackendArray subclass
    661 # and self.key is BasicIndexer((slice(None, None, None),))
    662 # so we need the explicit check for ExplicitlyIndexed

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:166](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=165), in ZarrArrayWrapper.__getitem__(self, key)
    165     method = self._oindex
--> 166 return indexing.explicit_indexing_adapter(
    167     key, array.shape, indexing.IndexingSupport.VECTORIZED, method
    168 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py:1018](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/core/indexing.py#line=1017), in explicit_indexing_adapter(key, shape, indexing_support, raw_indexing_method)
   1017 raw_key, numpy_indices = decompose_indexer(key, shape, indexing_support)
-> 1018 result = raw_indexing_method(raw_key.tuple)
   1019 if numpy_indices.tuple:
   1020     # index the loaded np.ndarray

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:156](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=155), in ZarrArrayWrapper._getitem(self, key)
    155 def _getitem(self, key):
--> 156     return self._array[key]

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:1660](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=1659), in Array.__getitem__(self, selection)
   1659 elif is_pure_orthogonal_indexing(pure_selection, self.ndim):
-> 1660     return self.get_orthogonal_selection(pure_selection, fields=fields)
   1661 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/_compat.py:43](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/_compat.py#line=42), in _deprecate_positional_args.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
     42 if extra_args <= 0:
---> 43     return f(*args, **kwargs)
     45 # extra_args > 0

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:2102](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=2101), in Array.get_orthogonal_selection(self, selection, out, fields, prototype)
   2101 indexer = OrthogonalIndexer(selection, self.shape, self.metadata.chunk_grid)
-> 2102 return sync(
   2103     self._async_array._get_selection(
   2104         indexer=indexer, out=out, fields=fields, prototype=prototype
   2105     )
   2106 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py:141](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py#line=140), in sync(coro, loop, timeout)
    140 if isinstance(return_result, BaseException):
--> 141     raise return_result
    142 else:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py:100](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/sync.py#line=99), in _runner(coro)
     99 try:
--> 100     return await coro
    101 except Exception as ex:

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py:961](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/array.py#line=960), in AsyncArray._get_selection(self, indexer, prototype, out, fields)
    959 if product(indexer.shape) > 0:
    960     # reading chunks and decoding them
--> 961     await self.codec_pipeline.read(
    962         [
    963             (
    964                 self.store_path [/](http://localhost:8888/) self.metadata.encode_chunk_key(chunk_coords),
    965                 self.metadata.get_chunk_spec(chunk_coords, self.order, prototype=prototype),
    966                 chunk_selection,
    967                 out_selection,
    968             )
    969             for chunk_coords, chunk_selection, out_selection in indexer
    970         ],
    971         out_buffer,
    972         drop_axes=indexer.drop_axes,
    973     )
    974 return out_buffer.as_ndarray_like()

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py:440](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py#line=439), in BatchedCodecPipeline.read(self, batch_info, out, drop_axes)
    434 async def read(
    435     self,
    436     batch_info: Iterable[tuple[ByteGetter, ArraySpec, SelectorTuple, SelectorTuple]],
    437     out: NDBuffer,
    438     drop_axes: tuple[int, ...] = (),
    439 ) -> None:
--> 440     await concurrent_map(
    441         [
    442             (single_batch_info, out, drop_axes)
    443             for single_batch_info in batched(batch_info, self.batch_size)
    444         ],
    445         self.read_batch,
    446         config.get("async.concurrency"),
    447     )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:64](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=63), in concurrent_map(items, func, limit)
     62         return await func(*item)
---> 64 return await asyncio.gather(*[asyncio.ensure_future(run(item)) for item in items])

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:62](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=61), in concurrent_map.<locals>.run(item)
     61 async with sem:
---> 62     return await func(*item)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py:262](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/codecs/pipeline.py#line=261), in BatchedCodecPipeline.read_batch(self, batch_info, out, drop_axes)
    261 else:
--> 262     chunk_bytes_batch = await concurrent_map(
    263         [
    264             (byte_getter, array_spec.prototype)
    265             for byte_getter, array_spec, _, _ in batch_info
    266         ],
    267         lambda byte_getter, prototype: byte_getter.get(prototype),
    268         config.get("async.concurrency"),
    269     )
    270     chunk_array_batch = await self.decode_batch(
    271         [
    272             (chunk_bytes, chunk_spec)
   (...)
    276         ],
    277     )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:64](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=63), in concurrent_map(items, func, limit)
     62         return await func(*item)
---> 64 return await asyncio.gather(*[asyncio.ensure_future(run(item)) for item in items])

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py:62](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/core/common.py#line=61), in concurrent_map.<locals>.run(item)
     61 async with sem:
---> 62     return await func(*item)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/storage/common.py:71](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/zarr/storage/common.py#line=70), in StorePath.get(self, prototype, byte_range)
     70     prototype = default_buffer_prototype()
---> 71 return await self.store.get(self.path, prototype=prototype, byte_range=byte_range)

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/icechunk/__init__.py:469](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/icechunk/__init__.py#line=468), in IcechunkStore.get(self, key, prototype, byte_range)
    468 try:
--> 469     result = await self._store.get(key, byte_range)
    470 except KeyNotFound as _e:
    471     # Zarr python expects None to be returned if the key does not exist
    472     # but an IcechunkStore returns an error if the key does not exist

ValueError: store error: unsuccessful repository operation: `error when handling virtual reference error fetching virtual reference dispatch failure`

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
Cell In[43], line 1
----> 1 ds = xr.open_zarr(
      2     store, 
      3     zarr_format=3,
      4     consolidated=False,
      5     chunks={},
      6 )

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:1337](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=1336), in open_zarr(store, group, synchronizer, chunks, decode_cf, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, consolidated, overwrite_encoded_chunks, chunk_store, storage_options, decode_timedelta, use_cftime, zarr_version, zarr_format, use_zarr_fill_value_as_mask, chunked_array_type, from_array_kwargs, **kwargs)
   1322     raise TypeError(
   1323         "open_zarr() got unexpected keyword arguments " + ",".join(kwargs.keys())
   1324     )
   1326 backend_kwargs = {
   1327     "synchronizer": synchronizer,
   1328     "consolidated": consolidated,
   (...)
   1334     "zarr_format": zarr_format,
   1335 }
-> 1337 ds = open_dataset(
   1338     filename_or_obj=store,
   1339     group=group,
   1340     decode_cf=decode_cf,
   1341     mask_and_scale=mask_and_scale,
   1342     decode_times=decode_times,
   1343     concat_characters=concat_characters,
   1344     decode_coords=decode_coords,
   1345     engine="zarr",
   1346     chunks=chunks,
   1347     drop_variables=drop_variables,
   1348     chunked_array_type=chunked_array_type,
   1349     from_array_kwargs=from_array_kwargs,
   1350     backend_kwargs=backend_kwargs,
   1351     decode_timedelta=decode_timedelta,
   1352     use_cftime=use_cftime,
   1353     zarr_version=zarr_version,
   1354     use_zarr_fill_value_as_mask=use_zarr_fill_value_as_mask,
   1355 )
   1356 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/api.py:671](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/api.py#line=670), in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs)
    659 decoders = _resolve_decoders_kwargs(
    660     decode_cf,
    661     open_backend_dataset_parameters=backend.open_dataset_parameters,
   (...)
    667     decode_coords=decode_coords,
    668 )
    670 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None)
--> 671 backend_ds = backend.open_dataset(
    672     filename_or_obj,
    673     drop_variables=drop_variables,
    674     **decoders,
    675     **kwargs,
    676 )
    677 ds = _dataset_from_backend_dataset(
    678     backend_ds,
    679     filename_or_obj,
   (...)
    689     **kwargs,
    690 )
    691 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py:1427](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/zarr.py#line=1426), in ZarrBackendEntrypoint.open_dataset(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta, group, mode, synchronizer, consolidated, chunk_store, storage_options, stacklevel, zarr_version, zarr_format, store, engine, use_zarr_fill_value_as_mask)
   1425 store_entrypoint = StoreBackendEntrypoint()
   1426 with close_on_error(store):
-> 1427     ds = store_entrypoint.open_dataset(
   1428         store,
   1429         mask_and_scale=mask_and_scale,
   1430         decode_times=decode_times,
   1431         concat_characters=concat_characters,
   1432         decode_coords=decode_coords,
   1433         drop_variables=drop_variables,
   1434         use_cftime=use_cftime,
   1435         decode_timedelta=decode_timedelta,
   1436     )
   1437 return ds

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/store.py:46](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/backends/store.py#line=45), in StoreBackendEntrypoint.open_dataset(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta)
     43 vars, attrs = filename_or_obj.load()
     44 encoding = filename_or_obj.get_encoding()
---> 46 vars, attrs, coord_names = conventions.decode_cf_variables(
     47     vars,
     48     attrs,
     49     mask_and_scale=mask_and_scale,
     50     decode_times=decode_times,
     51     concat_characters=concat_characters,
     52     decode_coords=decode_coords,
     53     drop_variables=drop_variables,
     54     use_cftime=use_cftime,
     55     decode_timedelta=decode_timedelta,
     56 )
     58 ds = Dataset(vars, attrs=attrs)
     59 ds = ds.set_coords(coord_names.intersection(vars))

File [~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py:462](http://localhost:8888/lab/tree/~/miniconda3/envs/coiled/lib/python3.12/site-packages/xarray/conventions.py#line=461), in decode_cf_variables(variables, attributes, concat_characters, mask_and_scale, decode_times, decode_coords, drop_variables, use_cftime, decode_timedelta)
    451     new_vars[k] = decode_cf_variable(
    452         k,
    453         v,
   (...)
    459         decode_timedelta=_item_or_default(decode_timedelta, k, None),
    460     )
    461 except Exception as e:
--> 462     raise type(e)(f"Failed to decode variable {k!r}: {e}") from e
    463 if decode_coords in [True, "coordinates", "all"]:
    464     var_attrs = new_vars[k].attrs

ValueError: Failed to decode variable 'time': store error: unsuccessful repository operation: `error when handling virtual reference error fetching virtual reference dispatch failure`

Is there something wrong with my environment / zarr version?

@mpiannucci
Copy link
Contributor

This might be an issue with xarray supporting the latest version of zarr

cc @dcherian

@norlandrhagen
Copy link

Related? #279

@TomNicholas
Copy link
Contributor Author

TomNicholas commented Nov 21, 2024

Thanks @norlandrhagen ! That could well be it. I'll try to address this in VirtualiZarr then (via zarr-developers/VirtualiZarr#243).

But if it actually is #279 (i.e. icechunk doesn't like non-absolute paths) then the error message from icechunk could be a lot clearer.

@mpiannucci
Copy link
Contributor

mpiannucci commented Nov 21, 2024

Ahhhh yeah for now it cant handle relative paths.

+1 on needing better errors #328

@TomNicholas
Copy link
Contributor Author

Now that I've merged zarr-developers/VirtualiZarr#243 this should be closed, as all references in VirtualiZarr are now absolute URIs.

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

No branches or pull requests

3 participants