Skip to content

Add FieldTimeSeries round-trip test harness across writers and grids#5654

Draft
glwagner wants to merge 2 commits into
mainfrom
glw/fts-round-trip-tests
Draft

Add FieldTimeSeries round-trip test harness across writers and grids#5654
glwagner wants to merge 2 commits into
mainfrom
glw/fts-round-trip-tests

Conversation

@glwagner

@glwagner glwagner commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds a parametrized test harness that exercises FieldTimeSeries reconstruction from disk across the cross-product of output writers and grid types. Motivated by #5639 and the observation that round-trip coverage was essentially limited to uniform RectilinearGrid (the Langmuir-turbulence example); the four reconstruction-sensitive grid categories had no FieldTimeSeries round-trip test.

The harness writes a short simulation, reconstructs via FieldTimeSeries(path, name), and asserts on:

  • grid — type, size, topology (and underlying-grid type for ImmersedBoundaryGrid)
  • field values — NaN-tolerant comparison against in-memory snapshots (immersed cells come back as NaN)

Coverage

Grids (the four categories + OSSG variants):

  • stretched RectilinearGrid
  • immersed RectilinearGrid (GridFittedBottom)
  • stretched LatitudeLongitudeGrid
  • TripolarGrid
  • immersed TripolarGrid
  • ConformalCubedSpherePanelGrid

Writers: JLD2Writer, NetCDFWriter, ZarrWriter.

Status

  • JLD2 round-trips all six grid types (verified locally, CPU). It serializes the grid object directly, so even immersed and OSSG cases reconstruct cleanly.
  • NetCDF / Zarr gaps (e.g. the Zarr + immersed limitation in Support ImmersedBoundaryGrid for reading zarr output #5639) surface as plain test failures rather than being hidden behind @test_broken.

Set ENV["FTS_ROUND_TRIP_WRITERS"] (e.g. "jld2" or "jld2,netcdf") to run a subset; only the needed writer extension packages (Zarr/NCDatasets) are loaded.

Draft: NetCDF/Zarr columns are expected to fail until the corresponding reconstruction paths are completed — this PR is the spec.

🤖 Generated with Claude Code

Parametrized harness that writes output, reconstructs a FieldTimeSeries,
and compares grid (type/size/topology) and field values. Covers the four
reconstruction-sensitive grid categories that lacked coverage — stretched
rectilinear, immersed boundary, stretched lat-lon, and orthogonal spherical
shell (tripolar, immersed tripolar, cubed-sphere panel) — across the JLD2,
NetCDF, and Zarr writers.

JLD2 round-trips all six grids. NetCDF/Zarr gaps (e.g. #5639) surface
as plain test failures rather than being hidden.

Set ENV["FTS_ROUND_TRIP_WRITERS"] (e.g. "jld2") to run a subset; only the
needed writer extension packages are loaded.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@glwagner

glwagner commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@vopikamm this is the test we talked about

topology=(Periodic, Periodic, Bounded))
immersed_rectilinear = ImmersedBoundaryGrid(underlying_rectilinear, GridFittedBottom((x, y) -> -0.5))

stretched_z_deep = [-1000.0, -600.0, -300.0, -100.0, 0.0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that all that "stretched" means? Non-equidistant in z? Or am I missing something? That would make almost all configurations I came across "stretched"

end
end

function grids_match(reconstructed, original)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we test only size and other metadata of the grid. We do not test the coordinate values themselves, shouldn't we? Otherwise the stretching of coordinates will not be detected anywhere.

@vopikamm vopikamm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful tests! My only concern is if the difference between "stretched" or "not stretched" is just the values of the z coord, but we never assess those values, there is no test of the stretched case? I would guess that the grid will still be reconstructed and the tests pass even if they shouldn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants