Skip to content

Restrict native grid vertical extent for z-restricted downloads#366

Open
glwagner wants to merge 7 commits into
mainfrom
glorys-z-restricted-native-grid
Open

Restrict native grid vertical extent for z-restricted downloads#366
glwagner wants to merge 7 commits into
mainfrom
glorys-z-restricted-native-grid

Conversation

@glwagner

Copy link
Copy Markdown
Member

Summary

A BoundingBox/Column z = (z_bottom, z_top) already restricts the CopernicusMarine/GLORYS download (via the already-merged depth_bounds_kw). This PR extends that so the native grid built from the restricted file follows the file's vertical extent rather than the dataset's full-column Nz.

  • GLORYS region_suffix appends a z_suffix so a z-restricted download caches to a distinct file — skip_existing no longer hands back the full-column file. Regions without z keep their existing filenames (backward compatible).
  • New vertical_size helper: an explicit z-interface vector sets Nz to length(z) - 1; a tuple/nothing keeps the dataset's full-column Nz. Wired into all three construct_native_grid methods (::Nothing, BoundingBox, Column).
  • Docstring updates for the BoundingBox z keyword.

Tests

  • vertical_size unit tests (vector → length-1, tuple → full Nz)
  • depth_bounds_kw mapping (negative-downward z → positive Copernicus depth bounds; empty bbox → unrestricted)
  • z-restricted download builds a grid with shrunken Nz matching the file, and the field loads onto it
  • distributed-vs-serial GLORYS set! check across Partition(4,1), (1,4), (2,2)

Notes

  • No Project.toml dependency changes.
  • Backward compatible: regions without z keep prior filenames and full Nz.
  • The download/distributed tests require CopernicusMarine credentials + network, so they run only in the relevant CI lanes.

🤖 Generated with Claude Code

glwagner and others added 2 commits June 19, 2026 09:26
A `BoundingBox`/`Column` `z = (z_bottom, z_top)` already restricts the
CopernicusMarine/GLORYS download. Extend it so the native grid built from
the restricted file follows the file's vertical extent rather than the
dataset's full-column `Nz`.

- GLORYS `region_suffix` appends a `z_suffix` so a z-restricted download
  caches to a distinct file; `skip_existing` no longer returns the
  full-column file. Regions without `z` keep their existing filenames.
- New `vertical_size` helper: an explicit z-interface vector sets `Nz` to
  `length(z) - 1`; a tuple/`nothing` keeps the dataset's full-column `Nz`.
  Wired into all three `construct_native_grid` methods.
- Docstring updates for `BoundingBox` `z`.
- Tests: `vertical_size` units, depth-bounds mapping, z-restricted grid
  shrink + field load, and a distributed-vs-serial GLORYS `set\!` check.

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

# Conflicts:
#	test/test_metadata.jl
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/DataWrangling/metadata_field.jl 60.00% 2 Missing ⚠️
src/DataWrangling/GLORYS/GLORYS.jl 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread test/test_distributed_utils.jl Outdated
using Oceananigans.DistributedComputations
using Oceananigans.DistributedComputations: reconstruct_global_grid

# h5py/hdf5 are required to write the CopernicusMarine subset; add them once on

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this has been fixes in CopernicusMarine v0.1.2. But, given that the new CopernicusMarine does not use python, we probably do not need it

Comment thread test/test_distributed_utils.jl Outdated
glwagner and others added 2 commits June 24, 2026 11:28
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