Skip to content

Commit

Permalink
Add group option to dataset_to_icechunk (#383)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
chuckwondo authored Jan 23, 2025
1 parent 8f64962 commit 30b7c00
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.8.6"
rev: v0.9.2
hooks:
# Run the linter.
- id: ruff
Expand Down
7 changes: 7 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ New Features
for the `to_icechunk` method to add timestamps as checksums when writing virtual references to an icechunk store. This
is useful for ensuring that virtual references are not stale when reading from an icechunk store, which can happen if the
underlying data has changed since the virtual references were written.
- Add ``group=None`` keyword-only parameter to ``dataset_to_icechunk`` function to
allow writing to a nested group at the specified path (root group, if not specified).
(:issue:`341`) By `Chuck Daniels <https://github.com/chuckwondo>`_.

Breaking changes
~~~~~~~~~~~~~~~~
Expand All @@ -26,6 +29,10 @@ Breaking changes
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.
This also means that ``xarray.combine_by_coords`` will now work when the necessary dimension coordinates are specified in ``loadable_variables``.
(:issue:`18`, :pull:`357`, :pull:`358`) By `Tom Nicholas <https://github.com/TomNicholas>`_.
- For function ``dataset_to_icechunk``, parameters ``append_dim`` and ``last_updated_at``
are now keyword-only parameters, rather than positional or keyword. This change is
breaking _only_ where arguments for these parameters are currently given positionally.
(:issue:`341`) By `Chuck Daniels <https://github.com/chuckwondo>`_.

Deprecations
~~~~~~~~~~~~
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ ignore_missing_imports = true
# Same as Black.
line-length = 88
indent-width = 4
target-version = "py39"
target-version = "py310"

exclude = [
"docs",
".eggs"]
".eggs"
]

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F", "I"]
Expand Down
2 changes: 1 addition & 1 deletion virtualizarr/tests/test_readers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def filter_and_cf_roundtrip_hdf5_file(tmpdir, request):

from random import randint

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

return filepath
Expand Down
Loading

0 comments on commit 30b7c00

Please sign in to comment.