Expand ZarrWriter test coverage; add Zarr to benchmarking + read mode#5610
Open
glwagner wants to merge 4 commits into
Open
Expand ZarrWriter test coverage; add Zarr to benchmarking + read mode#5610glwagner wants to merge 4 commits into
glwagner wants to merge 4 commits into
Conversation
Test side (`test/test_zarr_writer.jl`)
Adds a new Phase 8 testset that sweeps round-trip behaviour across grid
types beyond `RectilinearGrid`:
- `LatitudeLongitudeGrid` (regular + stretched): asserted `@test`.
- `TripolarGrid`, `RotatedLatitudeLongitudeGrid`: `@test_broken` —
these have no `constructor_arguments` method, so grid serialization
throws at write time.
- `ImmersedBoundaryGrid` over `RectilinearGrid`,
`LatitudeLongitudeGrid`, and `TripolarGrid`: `@test_broken` — the
Zarr extension's `reconstruct_zarr_grid` explicitly throws for IBG.
Tests are scoped to surface the gaps without fixing them. Follow-ups
will land `constructor_arguments` for OSSG / Tripolar / Rotated, and
full IBG serialization (mask + bottom_height) in a separate PR; when
they land, the `@test_broken` calls flip to `@test` automatically.
Benchmark side (`benchmarking/`)
- `Project.toml`: adds `Zarr` (0.10).
- `result.jl`: `IOBenchmarkResult` gains `chunk_shape`. Adds
`ReadBenchmarkResult`, modeled on `IOBenchmarkResult` but reporting
bulk read, iteration, and per-snapshot timings.
- `utils.jl`: adds `path_size` (recursive walkdir for directory
stores), `zarr_chunk_shape` (reads spatial chunks back from the
written `.zarray`), extends `run_io_benchmark` to dispatch
`ZarrWriter` for `output_format = "zarr"`, and adds
`run_read_benchmark` which writes a source dataset then times
`FieldTimeSeries(path, name)` construction plus a `fts[n]`
iteration loop.
- `OceananigansBenchmarks.jl`: re-exports `path_size`,
`run_read_benchmark`, and `ReadBenchmarkResult`; adds `using Zarr`.
- `run_benchmarks.jl`:
- `--output_format` now accepts `zarr`.
- `--format` (read mode), `--zarr_chunks`, `--read_variable` added.
- New `--mode=read` branch dispatching to `run_read_benchmark`.
- Summary table and markdown report extended with `Size` and
`Chunks` columns; read entries render with per-snapshot units.
Verified locally on CPU:
- `test/test_zarr_writer.jl`: 110 pass, 5 broken (the new
`@test_broken` cases), 0 errored.
- `--mode=io` with `--output_format=zarr|jld2|netcdf` all produce
expected JSON + markdown.
- `--mode=read` with `--format=zarr|jld2|netcdf` all produce expected
JSON + markdown.
- `--mode=benchmark` regression-clean.
Out of scope (deferred per design):
- `constructor_arguments` for OSSG family.
- `ImmersedBoundaryGrid` serialization (mask + bottom_height).
- `--mode=data_forced` (continuous disk reads during stepping).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per @glwagner: let CI fail loudly on the known-broken grids so the gap is unambiguous in build status. Every grid in the sweep is now asserted with plain `@test`. The 5 currently-broken rows (Tripolar, RotatedLatLon, and the three ImmersedBoundaryGrid variants) will stay red until the OSSG + NetCDF support PR lands `constructor_arguments` for the OSSG family and serializes the immersed boundary. Also widens the `try`/`catch` inside `zarr_round_trip` to cover model construction, since `HydrostaticFreeSurfaceModel` over `TripolarGrid` throws an `ArgumentError` about variable substepping in the auto-picked `SplitExplicitFreeSurface` — previously that escaped the catch and reported the row as ERROR rather than FAIL. Local CPU result: 110 pass, 5 fail, 0 errored, 0 broken. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #5605. Two independent additions in one PR:
ZarrWriter(no fixes yet, by design).ZarrWritertobenchmarking/, add a new--mode=readaxis, and report on-disk size + chunk shape for Zarr.Test coverage (
test/test_zarr_writer.jl)New Phase 8 testset sweeps round-trip behaviour across grid types beyond
RectilinearGrid:LatitudeLongitudeGrid(regular)@testLatitudeLongitudeGrid(stretched)@testTripolarGrid@test_brokenRotatedLatitudeLongitudeGrid@test_brokenImmersedBoundaryGridoverRectilinearGrid@test_brokenImmersedBoundaryGridoverLatitudeLongitudeGrid@test_brokenImmersedBoundaryGridoverTripolarGrid@test_brokenLocal run: 110 pass, 5 broken, 0 errored. The broken markers will flip to
@testautomatically once the follow-ups land.Known gaps (intentional, not fixed in this PR)
OrthogonalSphericalShellGrid/TripolarGrid/RotatedLatitudeLongitudeGridhave noconstructor_argumentsmethod — grid serialization throws at write time.ImmersedBoundaryGridserialization throws at read time (Immersed-boundary reconstruction not yet implemented for Zarr.atext/OceananigansZarrExt/zarr_writer.jl:388); inside the writer, anUndefVarError: GridFittedBottomis also reachable when the underlying-grid serialization succeeds.Filed for a separate PR.
Benchmarks (
benchmarking/)Project.toml: addsZarr(0.10).result.jl:IOBenchmarkResultgainschunk_shape::Union{Nothing, Vector{Int}}. NewReadBenchmarkResultreports bulk-read, iteration, and per-snapshot timings.utils.jl:path_size(p): recursivewalkdirfor directory stores (needed for Zarr'sDirectoryStore).zarr_chunk_shape(path, name): reads back the spatial chunk shape from the written.zarray.run_io_benchmarkacceptsoutput_format = "zarr"(alongside"jld2"and"netcdf") and azarr_chunkskwarg.run_read_benchmarkwrites a source dataset usingrun_io_benchmarkthen timesFieldTimeSeries(path, name)construction +fts[n]iteration.OceananigansBenchmarks.jl:using Zarr; re-exportspath_size,run_read_benchmark,ReadBenchmarkResult.run_benchmarks.jl:--output_formatnow acceptszarr.--format,--zarr_chunks,--read_variableadded.--mode=readdispatches torun_read_benchmark.SizeandChunkscolumns.--mode=data_forcedis deferred to a future PR.Test plan
julia --project=test -e 'using Pkg; Pkg.test("Oceananigans", test_args=["zarr_writer"])'— Phase 8 reports 110 pass / 5 broken locally on CPU.--mode=io --output_format=zarrproduceschunk_shapeandtotal_output_size_bytesin JSON; markdown renders Size + Chunks columns.--mode=io --output_format=jld2|netcdfregression-clean;chunk_shapeisnull.--mode=read --format=zarr|jld2|netcdfall produce aReadBenchmarkResult.--mode=benchmarkregression-clean (no IO).test_distributed_zarr_writer.jl) — untouched here, still RectilinearGrid-only.🤖 Generated with Claude Code