Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active January 16, 2025 05:44
Show Gist options
  • Save mdsumner/c2403994068eca009ef37e2f8d4603d6 to your computer and use it in GitHub Desktop.
Save mdsumner/c2403994068eca009ef37e2f8d4603d6 to your computer and use it in GitHub Desktop.
docker run -it --rm pangeo/pangeo-notebook:latest bash

pip install arraylake xarray netcdf4 dask pooch
import xarray as xr
from arraylake import Client

client = Client()
repo = client.get_repo("AustralianAntarcticDivision/aadrepo")
import xarray as xr


air_temp = xr.tutorial.open_dataset("air_temperature").chunk("1mb")
air_temp.to_zarr(repo.store, group='air_temperature')



<stdin>:1: SerializationWarning: saving variable None with floating point data as an integer dtype without any _FillValue to use for NaNs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/xarray/core/dataset.py", line 2595, in to_zarr
    return to_zarr(  # type: ignore[call-overload,misc]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/xarray/backends/api.py", line 2239, in to_zarr
    dump_to_store(dataset, zstore, writer, encoding=encoding)
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/xarray/backends/api.py", line 1919, in dump_to_store
    store.store(variables, attrs, check_encoding, writer, unlimited_dims=unlimited_dims)
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/xarray/backends/zarr.py", line 908, in store
    zarr.consolidate_metadata(self.zarr_group.store, **kwargs)
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/zarr/convenience.py", line 1296, in consolidate_metadata
    return open_consolidated(store, metadata_key=metadata_key, path=path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/zarr/convenience.py", line 1364, in open_consolidated
    return open(store=meta_store, chunk_store=chunk_store, mode=mode, path=path, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/conda/envs/notebook/lib/python3.12/site-packages/zarr/convenience.py", line 137, in open
    raise PathNotFoundError(path)
zarr.errors.PathNotFoundError: nothing found at path ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment