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

Append to icechunk stores #272

Merged
merged 101 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
d3a4048
Initial attempt at appending
abarciauskas-bgse Oct 25, 2024
5d5f9e2
Working on tests for generate chunk key function
abarciauskas-bgse Oct 25, 2024
360ea14
Linting
abarciauskas-bgse Oct 26, 2024
d3c2851
Refactor gen virtual dataset method
abarciauskas-bgse Oct 26, 2024
a7a1e50
Fix spelling
abarciauskas-bgse Oct 27, 2024
0365a45
Linting
abarciauskas-bgse Oct 28, 2024
5846d7e
Linting
abarciauskas-bgse Oct 28, 2024
66bbd6e
Linting
abarciauskas-bgse Oct 30, 2024
000c68f
Passing compression test
abarciauskas-bgse Nov 1, 2024
3131167
Merge branch 'main' into icechunk-append
TomNicholas Nov 5, 2024
5906687
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 5, 2024
80e4dcb
merge main and linting
abarciauskas-bgse Nov 10, 2024
672e5e1
linting
abarciauskas-bgse Nov 10, 2024
0fce71f
Fix test failing due to incorrect dtype
abarciauskas-bgse Nov 10, 2024
41f80f8
Fix conflict in conftest
abarciauskas-bgse Nov 10, 2024
e60437f
linting
abarciauskas-bgse Nov 10, 2024
de2f135
Linting
abarciauskas-bgse Nov 10, 2024
c8a46a6
Remove obsolete test file for appending
abarciauskas-bgse Nov 10, 2024
7663ad7
Create netcdf4 files factor in conftest
abarciauskas-bgse Nov 11, 2024
1d704ff
Linting
abarciauskas-bgse Nov 11, 2024
af5f57d
Refactor to use combineable zarr arrays
abarciauskas-bgse Nov 12, 2024
6f4cfd9
linting
abarciauskas-bgse Nov 12, 2024
98c7052
Implement no append dim test
abarciauskas-bgse Nov 12, 2024
f36adf2
Add test for when append dim is not in dims
abarciauskas-bgse Nov 12, 2024
e922ccd
Fix mypy errors
abarciauskas-bgse Nov 15, 2024
ca80cb2
type ignore import untyped zarr
abarciauskas-bgse Nov 15, 2024
f186d4f
Use Union type for check_combineable_zarr_arrays arg
abarciauskas-bgse Nov 15, 2024
2a90d9c
Fix import
abarciauskas-bgse Nov 15, 2024
0253a8a
Fix imports for get_codecs
abarciauskas-bgse Nov 15, 2024
7369fcf
use new factory in test
abarciauskas-bgse Nov 15, 2024
2949493
Remove need for dask in fixture
abarciauskas-bgse Nov 15, 2024
c305dad
Fix for when zarr is not installed
abarciauskas-bgse Nov 15, 2024
aaede73
Address test failures
abarciauskas-bgse Nov 16, 2024
5d685c6
Add get_codecs file
abarciauskas-bgse Nov 16, 2024
d704de2
Add dask to upstream
abarciauskas-bgse Nov 16, 2024
29ca87c
Merge branch 'main' into icechunk-append
abarciauskas-bgse Nov 16, 2024
d84c58c
Remove dependency on dask and h5netcdf engine
abarciauskas-bgse Nov 17, 2024
f19e3d1
Merge branch 'icechunk-append' of github.com:zarr-developers/virtuali…
abarciauskas-bgse Nov 17, 2024
2505d9e
Remove obsolete comment
abarciauskas-bgse Nov 18, 2024
aaa7f01
Remove duplicate zarr array type check
abarciauskas-bgse Nov 18, 2024
5071ed7
Move codecs module and type output
abarciauskas-bgse Nov 19, 2024
7067b43
Actually add codecs file
abarciauskas-bgse Nov 19, 2024
f867e14
Merge branch 'main' into icechunk-append
abarciauskas-bgse Nov 19, 2024
0ec5084
Fix merge mistake
abarciauskas-bgse Nov 19, 2024
5630b34
Ignore import untyped
abarciauskas-bgse Nov 19, 2024
2fd7fea
Merge branch 'main' into icechunk-append
abarciauskas-bgse Nov 20, 2024
d93f2ce
Add tests for codecs
abarciauskas-bgse Nov 20, 2024
b21daca
Merge branch 'icechunk-append' of github.com:zarr-developers/virtuali…
abarciauskas-bgse Nov 20, 2024
a6c2ccb
Resolve mypy errors
abarciauskas-bgse Nov 20, 2024
98a676d
Fix test
abarciauskas-bgse Nov 20, 2024
db3313f
Import zarr in function
abarciauskas-bgse Nov 20, 2024
145ed0e
Use existing importorskip function
abarciauskas-bgse Nov 20, 2024
80cd358
Modify comments
abarciauskas-bgse Nov 20, 2024
3035f05
Comment updates and spelling of combinable
abarciauskas-bgse Nov 20, 2024
28e05db
Revert change to check compatible encoding
abarciauskas-bgse Nov 20, 2024
2c07cdf
Ignore zarr untyped import errors
abarciauskas-bgse Nov 20, 2024
19837b2
Implement a manifest.utils module
abarciauskas-bgse Nov 21, 2024
532ff38
pass the array into resize_array
abarciauskas-bgse Nov 21, 2024
24f7274
Refactor resize_array
abarciauskas-bgse Nov 21, 2024
113cd2c
Remove unnecessary zarr imports
abarciauskas-bgse Nov 21, 2024
61ce01a
Add pinned version of icechunk as an optional dependency
abarciauskas-bgse Nov 21, 2024
defe7d9
Add append_dim in docstring
abarciauskas-bgse Nov 22, 2024
cb82d40
Kludgy solution to v2 v3 codecs difference
abarciauskas-bgse Nov 22, 2024
2f6cbc2
Add normalize to v3 parameter
abarciauskas-bgse Nov 22, 2024
a442fa4
Add more info to docstring
abarciauskas-bgse Nov 22, 2024
7d1bb36
Fix typing issues
abarciauskas-bgse Nov 22, 2024
39677e8
Add decorator for zarr python v3 test
abarciauskas-bgse Nov 22, 2024
5fa7177
Fix mypy and ruff errors
abarciauskas-bgse Nov 22, 2024
e109c0d
Only append if append_dim in dims
abarciauskas-bgse Nov 23, 2024
eb0e8f2
Add example notebook
abarciauskas-bgse Nov 25, 2024
fd2df4e
Add a runtime
abarciauskas-bgse Nov 25, 2024
1659d21
Add failing test
abarciauskas-bgse Nov 25, 2024
f5976d1
Fix multiple appends
abarciauskas-bgse Nov 25, 2024
f903291
Fix test error message
abarciauskas-bgse Nov 25, 2024
c109626
Add new cell to notebook to display original time chunk
abarciauskas-bgse Nov 26, 2024
dd9c381
Upgrade icechunk to 1.0.0a5
abarciauskas-bgse Nov 26, 2024
7c1fcfa
Upgrade icechunk in upstream.yml
abarciauskas-bgse Nov 26, 2024
1bb2ad0
Updated notebook with kechunk comment an upgraded icechunk version
abarciauskas-bgse Nov 26, 2024
64f2478
Modify test so it fails without updated icechunk
abarciauskas-bgse Dec 4, 2024
13de8d3
Update icechunk dependency
abarciauskas-bgse Dec 4, 2024
4a65e5a
Fix mypy errors
abarciauskas-bgse Dec 4, 2024
64e5277
update icechunk version in pyproject
abarciauskas-bgse Dec 4, 2024
d6ef97f
Merge branch 'main' into icechunk-append
abarciauskas-bgse Dec 4, 2024
9d2f7f8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 4, 2024
53045c3
Remove obsolete comment
abarciauskas-bgse Dec 4, 2024
b21a0e5
Use icechunk 0.1.0a7
abarciauskas-bgse Dec 5, 2024
208e83e
Updated notebook
abarciauskas-bgse Dec 5, 2024
79e0c1b
Updated notebook
abarciauskas-bgse Dec 5, 2024
e38823c
print store
abarciauskas-bgse Dec 5, 2024
ad17b83
Update notebook (#327)
mpiannucci Dec 5, 2024
8b9a830
Add append to examples
abarciauskas-bgse Dec 5, 2024
3f9f58c
Add to releases.rst
abarciauskas-bgse Dec 5, 2024
8496359
Revert change to .gitignore
abarciauskas-bgse Dec 5, 2024
7dc9186
Merge branch 'main' into icechunk-append
TomNicholas Dec 5, 2024
491b701
Update ci/upstream.yml
abarciauskas-bgse Dec 5, 2024
94ef469
Update pyproject.toml
abarciauskas-bgse Dec 5, 2024
fad188b
Update virtualizarr/tests/test_writers/test_icechunk.py
abarciauskas-bgse Dec 5, 2024
8df67e9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 5, 2024
258c92f
Update virtualizarr/accessor.py
abarciauskas-bgse Dec 5, 2024
84a4d01
Separate out multiple arrays test
abarciauskas-bgse Dec 5, 2024
299f580
Merge branch 'icechunk-append' of github.com:zarr-developers/virtuali…
abarciauskas-bgse Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ci/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ dependencies:
- fsspec
- pip
- pip:
- icechunk # Installs zarr v3 as dependency
# - git+https://github.com/fsspec/kerchunk@main # kerchunk is currently incompatible with zarr-python v3 (https://github.com/fsspec/kerchunk/pull/516)
- imagecodecs-numcodecs==2024.6.1
- icechunk==0.1.0a7 # Installs zarr v3 as dependency
abarciauskas-bgse marked this conversation as resolved.
Show resolved Hide resolved
# - git+https://github.com/fsspec/kerchunk@main # kerchunk is currently incompatible with zarr-python v3 (https://github.com/fsspec/kerchunk/pull/516)
- imagecodecs-numcodecs==2024.6.1
48 changes: 28 additions & 20 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any, Dict, Optional

import h5py
import numpy as np
import pytest
Expand Down Expand Up @@ -35,6 +37,32 @@ def netcdf4_file(tmpdir):
return filepath


@pytest.fixture
def netcdf4_files_factory(tmpdir) -> callable:
def create_netcdf4_files(
encoding: Optional[Dict[str, Dict[str, Any]]] = None,
) -> tuple[str, str]:
ds = xr.tutorial.open_dataset("air_temperature")

# Split dataset into two parts
ds1 = ds.isel(time=slice(None, 1460))
ds2 = ds.isel(time=slice(1460, None))

# Save datasets to disk as NetCDF in the temporary directory with the provided encoding
filepath1 = f"{tmpdir}/air1.nc"
filepath2 = f"{tmpdir}/air2.nc"
ds1.to_netcdf(filepath1, encoding=encoding)
ds2.to_netcdf(filepath2, encoding=encoding)

# Close datasets
ds1.close()
ds2.close()

return filepath1, filepath2

return create_netcdf4_files


@pytest.fixture
def netcdf4_file_with_2d_coords(tmpdir):
ds = xr.tutorial.open_dataset("ROMS_example")
Expand Down Expand Up @@ -71,26 +99,6 @@ def hdf5_groups_file(tmpdir):
return filepath


@pytest.fixture
def netcdf4_files(tmpdir):
# Set up example xarray dataset
ds = xr.tutorial.open_dataset("air_temperature")

# split inrto equal chunks so we can concatenate them back together later
ds1 = ds.isel(time=slice(None, 1460))
ds2 = ds.isel(time=slice(1460, None))

# Save it to disk as netCDF (in temporary directory)
filepath1 = f"{tmpdir}/air1.nc"
filepath2 = f"{tmpdir}/air2.nc"
ds1.to_netcdf(filepath1)
ds2.to_netcdf(filepath2)
ds1.close()
ds2.close()

return filepath1, filepath2


@pytest.fixture
def hdf5_empty(tmpdir):
filepath = f"{tmpdir}/empty.nc"
Expand Down
1 change: 1 addition & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ New Features

- Add a ``virtual_backend_kwargs`` keyword argument to file readers and to ``open_virtual_dataset``, to allow reader-specific options to be passed down.
(:pull:`315`) By `Tom Nicholas <https://github.com/TomNicholas>`_.
- Added append functionality to `to_icechunk` (:pull:`272`) By `Aimee Barciauskas <https://github.com/abarciauskas-bgse>`_.

Breaking changes
~~~~~~~~~~~~~~~~
Expand Down
Loading
Loading