Skip to content

Feature/#4386 vectorbracket basis kind#4387

Merged
tclune merged 6 commits intorelease/MAPL-v3from
feature/#4386-vectorbracket-basis-kind
Feb 12, 2026
Merged

Feature/#4386 vectorbracket basis kind#4387
tclune merged 6 commits intorelease/MAPL-v3from
feature/#4386-vectorbracket-basis-kind

Conversation

@tclune
Copy link
Collaborator

@tclune tclune commented Feb 12, 2026

Types of change(s)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Trivial change (affects only documentation or cleanup)
  • Refactor (no functional changes, no api changes)

Checklist

  • Tested this change with a run of GEOSgcm
  • Ran the Unit Tests (make tests)

Description

Summary

Extends vector_basis_kind support (from PR #4376) to VectorBracket regridding and generalizes the regridding code to handle VectorBrackets with any even number of fields (not just 4).

Background

VectorBrackets represent both temporal bracketing and geometric vector aspects, containing vector fields at multiple timesteps. The structure is:

  • Canonical case: 4 fields for 2 timesteps: [u(t=0), v(t=0), u(t=1), v(t=1)]
  • Degenerate case: 2 fields for 1 timestep ("off-the-end-of-data")
  • Future: 6+ fields for higher-order temporal interpolation

The regridding code was hardcoded for 4 fields and didn't propagate the vector_basis_kind metadata needed for rotated vector regridding.

Changes

VectorBracketClassAspect

  • Added vector_basis_kind field (non-allocatable, defaults to VECTOR_BASIS_KIND_NS)
  • Constructor accepts optional vector_basis_kind parameter
  • Stores vector_basis_kind in bundle metadata during create()

Regridder

  • Generalized VectorBracket regridding to handle any even number of fields
  • Extracts vector_basis_kind from parent bundle and propagates to temporary vector pair bundles
  • Dynamic loop over n_pairs = size(field_list) / 2 instead of hardcoded indices
  • Added validation to ensure even number of fields

VariableSpec

  • Simplified vector_basis_kind validation using _ASSERT and any()
  • Always initialize to VECTOR_BASIS_KIND_NS default, then override if specified
  • Pass vector_basis_kind to VectorBracketClassAspect constructor when allocated

Testing

  • All 420 generic3g tests pass (NAG compiler)
  • Incremental build and test workflow verified

Related Issues

Fixes #4386
Builds on #4376

Related Issue

This implements issue #4376 by introducing VectorBasisKind to distinguish
between NS (North-South/geographic) and GRID (grid-relative) vector
components during regridding operations.

Key changes:
- New VectorBasisKind enum (NS, GRID, INVALID) in esmf_utils
- String-based VariableSpec API: vector_basis_kind='NS' or 'GRID'
- Field bundle metadata storage via FieldBundleSet/Get
- Regridder integration: passes basis kind directly to get_basis()
- Validation ensures vector_basis_kind only used with VECTOR bundles
- get_basis() refactored with early returns (no nesting)
- Comprehensive test suite (12 tests covering all scenarios)

User API supports vector_basis_kind='NS' (default for vectors) or 'GRID'.
The enum-based internal API ensures type safety throughout the stack.
- VariableSpec: Check allocation before accessing vector_basis_kind
- VariableSpec: Default to VECTOR_BASIS_KIND_NS when unallocated
- FieldBundleCreate: Auto-set NS basis for VECTOR bundles
- Remove unused status variable in verify_deferred_items
Addresses reviewer feedback to use the canonical itemType field
instead of heuristics (vector_component_names, standard_name format)
to determine if a VariableSpec represents a vector.

Changes:
- VariableSpec: Check itemType == MAPL_STATEITEM_VECTOR
- Removed complex heuristic logic and unused is_vector variable
- Test_VectorBasisKind: Added itemtype parameter and import
- Add vector_basis_kind support to VectorBracketClassAspect
- Generalize VectorBracket regridding for any even number of fields
- Simplify vector_basis_kind validation in VariableSpec
- Make vector_basis_kind non-allocatable (always has default value)
@tclune tclune requested a review from a team as a code owner February 12, 2026 01:06
@tclune tclune added 🎁 New Feature This is a new feature 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. 📈 MAPL3 MAPL 3 Related Changelog Skip Skips the Changelog Enforcer labels Feb 12, 2026
Rename MAPL_STATEITEM_VECTOR_BRACKET to MAPL_STATEITEM_VECTORBRACKET
for consistency with naming convention MAPL_STATEITEM_<class> where
the class is VectorBracket (no underscore in compound name).
@tclune tclune merged commit 59cbbd3 into release/MAPL-v3 Feb 12, 2026
33 checks passed
@tclune tclune deleted the feature/#4386-vectorbracket-basis-kind branch February 12, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 Diff The changes in this pull request have verified to be zero-diff with the target branch. Changelog Skip Skips the Changelog Enforcer 📈 MAPL3 MAPL 3 Related 🎁 New Feature This is a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants