Skip to content

Error when just executing llcreader #350

@mochell

Description

@mochell

I just installed xmitGCM and try to reproduce the examples.
I try this:

from xmitgcm import llcreader
model = llcreader.ECCOPortalLLC2160Model()

I get this error message

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File /Users/mommehell/Projects/2023_wind_emulator/analysis/test_files/test_load_MITgcm.py:1
----> 1 model = llcreader.ECCOPortalLLC2160Model()

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/xmitgcm/llcreader/known_models.py:200, in ECCOPortalLLC2160Model.__init__(self)
    197 mask_path = 'https://storage.googleapis.com/pangeo-ecco/llc/masks/llc_2160_masks.zarr/'
    198 store = stores.NestedStore(fs, base_path=base_path, mask_path=mask_path,
    199                            grid_path=grid_path, shrunk=True, join_char='/')
--> 200 super(ECCOPortalLLC2160Model, self).__init__(store)

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/xmitgcm/llcreader/llcmodel.py:613, in BaseLLCModel.__init__(self, store)
    611 self.shape = (self.nz, self.nface, self.nx, self.nx)
    612 if self.store.shrunk:
--> 613     self.masks = self._get_masks()
    614     from .shrunk_index import all_index_data
    615     mykey = self.nx if self.domain == 'global' else f'{self.domain}_{self.nx}'

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/xmitgcm/llcreader/llcmodel.py:623, in BaseLLCModel._get_masks(self)
    621 def _get_masks(self):
    622     masks = {}
--> 623     zgroup = self.store.open_mask_group()
    624     for point in ['c', 'w', 's']:
    625         mask_faces = dsa.from_zarr(zgroup['mask_' + point]).astype('bool')

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/xmitgcm/llcreader/stores.py:115, in BaseStore.open_mask_group(self)
    107 """Open the zarr group that contains the masks
    108 
    109 Returns
    110 -------
    111 mask_group : zarr.Group
    112 """
    114 mapper = self.mask_fs.get_mapper(self.mask_path)
--> 115 zgroup = zarr.open_consolidated(mapper)
    116 return zgroup

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/api/synchronous.py:215, in open_consolidated(use_consolidated, *args, **kwargs)
    210 def open_consolidated(*args: Any, use_consolidated: Literal[True] = True, **kwargs: Any) -> Group:
    211     """
    212     Alias for :func:`open_group` with ``use_consolidated=True``.
    213     """
    214     return Group(
--> 215         sync(async_api.open_consolidated(*args, use_consolidated=use_consolidated, **kwargs))
    216     )

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/core/sync.py:163, in sync(coro, loop, timeout)
    160 return_result = next(iter(finished)).result()
    162 if isinstance(return_result, BaseException):
--> 163     raise return_result
    164 else:
    165     return return_result

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/core/sync.py:119, in _runner(coro)
    114 """
    115 Await a coroutine and return the result of running it. If awaiting the coroutine raises an
    116 exception, the exception will be returned.
    117 """
    118 try:
--> 119     return await coro
    120 except Exception as ex:
    121     return ex

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/api/asynchronous.py:352, in open_consolidated(use_consolidated, *args, **kwargs)
    347 if use_consolidated is not True:
    348     raise TypeError(
    349         "'use_consolidated' must be 'True' in 'open_consolidated'. Use 'open' with "
    350         "'use_consolidated=False' to bypass consolidated metadata."
    351     )
--> 352 return await open_group(*args, use_consolidated=use_consolidated, **kwargs)

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/api/asynchronous.py:806, in open_group(store, mode, cache_attrs, synchronizer, path, chunk_store, storage_options, zarr_version, zarr_format, meta_array, attributes, use_consolidated)
    803 if chunk_store is not None:
    804     warnings.warn("chunk_store is not yet implemented", RuntimeWarning, stacklevel=2)
--> 806 store_path = await make_store_path(store, mode=mode, storage_options=storage_options, path=path)
    808 if attributes is None:
    809     attributes = {}

File /opt/anaconda3/envs/py311_flux/lib/python3.11/site-packages/zarr/storage/_common.py:316, in make_store_path(store_like, path, mode, storage_options)
    314     else:
    315         msg = f"Unsupported type for store_like: '{type(store_like).__name__}'"  # type: ignore[unreachable]
--> 316         raise TypeError(msg)
    318     result = await StorePath.open(store, path=path_normalized, mode=mode)
    320 if storage_options and not used_storage_options:

TypeError: Unsupported type for store_like: 'FSMap'

the same appears when trying on Pleiades with
llcreader.PleiadesLLC2160Model()

It is a problem with the zarr module, but I can't pin it down.

versions:
python 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:49:36) [Clang 16.0.6 ]
xarray 2024.10.0
xmitgcm 0.5.2
zarr 3.0.5
dask 2025.5.1

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions