Skip to content

Commit 30b7c00

Browse files
authored
Add group option to dataset_to_icechunk (#383)
* Bump ruff pre-commit hook and fix formatting * Bump ruff target version to match min Python version * Add `group` param to `dataset_to_icechunk` function * Add unit tests for non-root groups Fixes #341
1 parent 8f64962 commit 30b7c00

File tree

6 files changed

+144
-106
lines changed

6 files changed

+144
-106
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111

1212
- repo: https://github.com/astral-sh/ruff-pre-commit
1313
# Ruff version.
14-
rev: "v0.8.6"
14+
rev: v0.9.2
1515
hooks:
1616
# Run the linter.
1717
- id: ruff

docs/releases.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ New Features
1515
for the `to_icechunk` method to add timestamps as checksums when writing virtual references to an icechunk store. This
1616
is useful for ensuring that virtual references are not stale when reading from an icechunk store, which can happen if the
1717
underlying data has changed since the virtual references were written.
18+
- Add ``group=None`` keyword-only parameter to ``dataset_to_icechunk`` function to
19+
allow writing to a nested group at the specified path (root group, if not specified).
20+
(:issue:`341`) By `Chuck Daniels <https://github.com/chuckwondo>`_.
1821

1922
Breaking changes
2023
~~~~~~~~~~~~~~~~
@@ -26,6 +29,10 @@ Breaking changes
2629
Also a warning is no longer thrown when ``indexes=None`` is passed to ``open_virtual_dataset``, and the recommendations in the docs updated to match.
2730
This also means that ``xarray.combine_by_coords`` will now work when the necessary dimension coordinates are specified in ``loadable_variables``.
2831
(:issue:`18`, :pull:`357`, :pull:`358`) By `Tom Nicholas <https://github.com/TomNicholas>`_.
32+
- For function ``dataset_to_icechunk``, parameters ``append_dim`` and ``last_updated_at``
33+
are now keyword-only parameters, rather than positional or keyword. This change is
34+
breaking _only_ where arguments for these parameters are currently given positionally.
35+
(:issue:`341`) By `Chuck Daniels <https://github.com/chuckwondo>`_.
2936

3037
Deprecations
3138
~~~~~~~~~~~~

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,15 @@ ignore_missing_imports = true
111111
# Same as Black.
112112
line-length = 88
113113
indent-width = 4
114-
target-version = "py39"
114+
target-version = "py310"
115115

116116
exclude = [
117117
"docs",
118-
".eggs"]
118+
".eggs"
119+
]
119120

120121
[tool.ruff.lint]
121-
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
122+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
122123
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
123124
# McCabe complexity (`C901`) by default.
124125
select = ["E4", "E7", "E9", "F", "I"]

virtualizarr/tests/test_readers/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def filter_and_cf_roundtrip_hdf5_file(tmpdir, request):
306306

307307
from random import randint
308308

309-
filepath = f"{tmpdir}/{request.param}_{randint(0,100)}_cf_roundtrip.nc"
309+
filepath = f"{tmpdir}/{request.param}_{randint(0, 100)}_cf_roundtrip.nc"
310310
ds.to_netcdf(filepath, engine="h5netcdf", encoding=encoding)
311311

312312
return filepath

0 commit comments

Comments
 (0)