-
Notifications
You must be signed in to change notification settings - Fork 66
Description
from xmitgcm import llcreader
model = llcreader.ECCOPortalLLC4320Model()
ds = model.get_dataset(k_chunksize=90)
I ran the above code and encountered the following Python error:
How can I fix this error? I would be very grateful if you could help me.
OSError Traceback (most recent call last)
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:1109, in TCPConnector._wrap_create_connection(self, addr_infos, req, timeout, client_error, *args, **kwargs)
1106 async with ceil_timeout(
1107 timeout.sock_connect, ceil_threshold=timeout.ceil_threshold
1108 ):
-> 1109 sock = await aiohappyeyeballs.start_connection(
1110 addr_infos=addr_infos,
1111 local_addr_infos=self._local_addr_infos,
1112 happy_eyeballs_delay=self._happy_eyeballs_delay,
1113 interleave=self._interleave,
1114 loop=self._loop,
1115 )
1116 return await self._loop.create_connection(*args, **kwargs, sock=sock)
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohappyeyeballs/impl.py:104, in start_connection(addr_infos, local_addr_infos, happy_eyeballs_delay, interleave, loop)
103 if len(all_exceptions) == 1:
--> 104 raise first_exception
105 else:
106 # If they all have the same str(), raise one.
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohappyeyeballs/impl.py:82, in start_connection(addr_infos, local_addr_infos, happy_eyeballs_delay, interleave, loop)
81 try:
---> 82 sock = await _connect_sock(
83 current_loop, exceptions, addrinfo, local_addr_infos
84 )
85 break
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohappyeyeballs/impl.py:174, in _connect_sock(loop, exceptions, addr_info, local_addr_infos)
173 raise OSError(f"no matching local address with {family=} found")
--> 174 await loop.sock_connect(sock, address)
175 return sock
File ~/.conda/envs/or/lib/python3.9/asyncio/selector_events.py:500, in BaseSelectorEventLoop.sock_connect(self, sock, address)
499 self._sock_connect(fut, sock, address)
--> 500 return await fut
File ~/.conda/envs/or/lib/python3.9/asyncio/selector_events.py:505, in BaseSelectorEventLoop._sock_connect(self, fut, sock, address)
504 try:
--> 505 sock.connect(address)
506 except (BlockingIOError, InterruptedError):
507 # Issue #23618: When the C function connect() fails with EINTR, the
508 # connection runs in background. We have to wait until the socket
509 # becomes writable to be notified when the connection succeed or
510 # fails.
OSError: [Errno 101] Network is unreachable
The above exception was the direct cause of the following exception:
ClientConnectorError Traceback (most recent call last)
File ~/.conda/envs/or/lib/python3.9/site-packages/zarr/storage.py:1446, in FSStore.getitem(self, key)
1445 try:
-> 1446 return self.map[key]
1447 except self.exceptions as e:
File ~/.local/lib/python3.9/site-packages/fsspec/mapping.py:155, in FSMap.getitem(self, key, default)
154 try:
--> 155 result = self.fs.cat(k)
156 except self.missing_exceptions as exc:
File ~/.local/lib/python3.9/site-packages/fsspec/asyn.py:118, in sync_wrapper..wrapper(*args, **kwargs)
117 self = obj or args[0]
--> 118 return sync(self.loop, func, *args, **kwargs)
File ~/.local/lib/python3.9/site-packages/fsspec/asyn.py:103, in sync(loop, func, timeout, *args, **kwargs)
102 elif isinstance(return_result, BaseException):
--> 103 raise return_result
104 else:
File ~/.local/lib/python3.9/site-packages/fsspec/asyn.py:56, in _runner(event, coro, result, timeout)
55 try:
---> 56 result[0] = await coro
57 except Exception as ex:
File ~/.local/lib/python3.9/site-packages/fsspec/asyn.py:465, in AsyncFileSystem._cat(self, path, recursive, on_error, batch_size, **kwargs)
464 if ex:
--> 465 raise ex
466 if (
467 len(paths) > 1
468 or isinstance(path, list)
469 or paths[0] != self._strip_protocol(path)
470 ):
File ~/.local/lib/python3.9/site-packages/fsspec/asyn.py:245, in _run_coros_in_chunks.._run_coro(coro, i)
244 try:
--> 245 return await asyncio.wait_for(coro, timeout=timeout), i
246 except Exception as e:
File ~/.conda/envs/or/lib/python3.9/asyncio/tasks.py:442, in wait_for(fut, timeout, loop)
441 if timeout is None:
--> 442 return await fut
444 if timeout <= 0:
File ~/.local/lib/python3.9/site-packages/fsspec/implementations/http.py:234, in HTTPFileSystem._cat_file(self, url, start, end, **kwargs)
233 session = await self.set_session()
--> 234 async with session.get(self.encode_url(url), **kw) as r:
235 out = await r.read()
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/client.py:1423, in _BaseRequestContextManager.aenter(self)
1422 async def aenter(self) -> _RetType:
-> 1423 self._resp: _RetType = await self._coro
1424 return await self._resp.aenter()
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/client.py:701, in ClientSession._request(self, method, str_or_url, params, data, json, cookies, headers, skip_auto_headers, auth, allow_redirects, max_redirects, compress, chunked, expect100, raise_for_status, read_until_eof, proxy, proxy_auth, timeout, verify_ssl, fingerprint, ssl_context, ssl, server_hostname, proxy_headers, trace_request_ctx, read_bufsize, auto_decompress, max_line_size, max_field_size)
700 try:
--> 701 conn = await self._connector.connect(
702 req, traces=traces, timeout=real_timeout
703 )
704 except asyncio.TimeoutError as exc:
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:544, in BaseConnector.connect(self, req, traces, timeout)
543 await trace.send_connection_create_start()
--> 544 proto = await self._create_connection(req, traces, timeout)
545 if traces:
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:1050, in TCPConnector._create_connection(self, req, traces, timeout)
1049 else:
-> 1050 _, proto = await self._create_direct_connection(req, traces, timeout)
1052 return proto
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:1394, in TCPConnector._create_direct_connection(self, req, traces, timeout, client_error)
1393 assert last_exc is not None
-> 1394 raise last_exc
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:1363, in TCPConnector._create_direct_connection(self, req, traces, timeout, client_error)
1362 try:
-> 1363 transp, proto = await self._wrap_create_connection(
1364 self._factory,
1365 timeout=timeout,
1366 ssl=sslcontext,
1367 addr_infos=addr_infos,
1368 server_hostname=server_hostname,
1369 req=req,
1370 client_error=client_error,
1371 )
1372 except (ClientConnectorError, asyncio.TimeoutError) as exc:
File ~/.conda/envs/or/lib/python3.9/site-packages/aiohttp/connector.py:1124, in TCPConnector._wrap_create_connection(self, addr_infos, req, timeout, client_error, *args, **kwargs)
1123 raise
-> 1124 raise client_error(req.connection_key, exc) from exc
ClientConnectorError: Cannot connect to host storage.googleapis.com:443 ssl:default [Network is unreachable]
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
Cell In[9], line 2
1 from xmitgcm import llcreader
----> 2 model = llcreader.ECCOPortalLLC4320Model()
3 ds = model.get_dataset(k_chunksize=90)
File ~/.local/lib/python3.9/site-packages/xmitgcm/llcreader/known_models.py:212, in ECCOPortalLLC4320Model.init(self)
209 mask_path = 'https://storage.googleapis.com/pangeo-ecco/llc/masks/llc_4320_masks.zarr/'
210 store = stores.NestedStore(fs, base_path=base_path, mask_path=mask_path,
211 grid_path=grid_path, shrunk=True, join_char='/')
--> 212 super(ECCOPortalLLC4320Model, self).init(store)
File ~/.local/lib/python3.9/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 ~/.local/lib/python3.9/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 ~/.local/lib/python3.9/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 ~/.conda/envs/or/lib/python3.9/site-packages/zarr/convenience.py:1360, in open_consolidated(store, metadata_key, mode, **kwargs)
1357 metadata_key = "meta/root/consolidated/" + metadata_key
1359 # setup metadata store
-> 1360 meta_store = ConsolidatedStoreClass(store, metadata_key=metadata_key)
1362 # pass through
1363 chunk_store = kwargs.pop("chunk_store", None) or store
File ~/.conda/envs/or/lib/python3.9/site-packages/zarr/storage.py:3046, in ConsolidatedMetadataStore.init(self, store, metadata_key)
3043 self.store = Store._ensure_store(store)
3045 # retrieve consolidated metadata
-> 3046 meta = json_loads(self.store[metadata_key])
3048 # check format of consolidated metadata
3049 consolidated_format = meta.get("zarr_consolidated_format", None)
File ~/.conda/envs/or/lib/python3.9/site-packages/zarr/storage.py:1448, in FSStore.getitem(self, key)
1446 return self.map[key]
1447 except self.exceptions as e:
-> 1448 raise KeyError(key) from e
KeyError: '.zmetadata'